當前位置: 首頁>>代碼示例>>Java>>正文


Java AttachCapabilitiesEvent.Entity方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.AttachCapabilitiesEvent.Entity方法的典型用法代碼示例。如果您正苦於以下問題:Java AttachCapabilitiesEvent.Entity方法的具體用法?Java AttachCapabilitiesEvent.Entity怎麽用?Java AttachCapabilitiesEvent.Entity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.AttachCapabilitiesEvent的用法示例。


在下文中一共展示了AttachCapabilitiesEvent.Entity方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onAttach

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onAttach(AttachCapabilitiesEvent event)
{
	Map<ResourceLocation, ICapabilityProvider> map = Maps.newHashMap();
	if (event instanceof AttachCapabilitiesEvent.Item)
		handle(map, event.getObject(), ((AttachCapabilitiesEvent.Item) event).getItemStack());
	else if (event instanceof AttachCapabilitiesEvent.Entity)
		handle(map, event.getObject(), ((AttachCapabilitiesEvent.Entity) event).getEntity());
	else if (event instanceof AttachCapabilitiesEvent.TileEntity)
		handle(map, event.getObject(), ((AttachCapabilitiesEvent.TileEntity) event).getTileEntity());
	else
		handle(map, event.getObject(), event.getObject());
	for (ICapabilityProvider iCapabilityProvider : event.getCapabilities().values())
		handle(map, iCapabilityProvider, event.getObject());
	for (Map.Entry<ResourceLocation, ICapabilityProvider> entry : map.entrySet())
		event.addCapability(entry.getKey(), entry.getValue());
}
 
開發者ID:InfinityStudio,項目名稱:InspiringWorld,代碼行數:18,代碼來源:CapabilityInterfaceInject.java

示例2: attachCapability

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void attachCapability(AttachCapabilitiesEvent.Entity e) {
   if (e.getEntity() instanceof EntityPlayer
         && !e.getEntity().hasCapability(XP_CAPABILITY, null))
      e.addCapability(new ResourceLocation(MODID, "xpCapability"),
            new XPCapability.Provider());
}
 
開發者ID:arucil,項目名稱:mc-XPBox,代碼行數:8,代碼來源:XPBox.java

示例3: onEntityConstructing

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onEntityConstructing(AttachCapabilitiesEvent.Entity event){
    if (event.getEntity() instanceof EntityPlayer) {
        if (!event.getEntity().hasCapability(PlayerProperties.PLAYER_WHEEL_CONFIGURATION, null)) {
            event.addCapability(new ResourceLocation(InteractionWheel.MODID, "hotkeys"), new PropertiesDispatcher());
        }
    }
}
 
開發者ID:McJty,項目名稱:interactionwheel,代碼行數:9,代碼來源:ForgeEventHandlers.java

示例4: onAttachCapabilities

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onAttachCapabilities(AttachCapabilitiesEvent.Entity event) {
    if (event.getEntity() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getEntity();
        event.addCapability(new ResourceLocation(Possessed.MODID, "PossessedData"), new PossessCapability.Serializable(player));
    }
}
 
開發者ID:Fararise,項目名稱:Possessed,代碼行數:8,代碼來源:ServerEventHandler.java

示例5: addEntityCapabilities

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@SubscribeEvent
   public void addEntityCapabilities(AttachCapabilitiesEvent.Entity event) {
       if(event.getEntity() instanceof EntityPlayer) {
       	if(!event.getCapabilities().containsKey(ExtendedPlayerProvider.KEY))	{
 	    	  try{
 	    		  event.addCapability(ExtendedPlayerProvider.KEY, new ExtendedPlayerProvider((EntityPlayer) event.getEntity()));
 	    	  }catch(Exception e){}
       	}
       }
   }
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:12,代碼來源:EventHandler.java

示例6: attachCapability

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
/**
 * Attach capabilities (well, only one, right now)
 */
@SubscribeEvent
public void attachCapability(AttachCapabilitiesEvent.Entity event)
{
    if (!(event.getEntity() instanceof EntityPlayer)) return;

    event.addCapability(MORPHING_CAP, new MorphingProvider());
}
 
開發者ID:mchorse,項目名稱:metamorph,代碼行數:11,代碼來源:CapabilityHandler.java

示例7: PlayerConstructingEvent

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent
@SuppressWarnings("deprecation")
public void PlayerConstructingEvent(AttachCapabilitiesEvent.Entity event)
{
	if ((event.getEntity() instanceof EntityPlayer))
	{
		EntityPlayer player = (EntityPlayer) event.getEntity();
		PlayerAetherProvider provider = new PlayerAetherProvider(new PlayerAether(player));

		if (PlayerAether.get(player) == null)
		{
			event.addCapability(PLAYER_LOCATION,  provider);
		}
	}
}
 
開發者ID:Modding-Legacy,項目名稱:Aether-Legacy,代碼行數:16,代碼來源:PlayerAetherEvents.java

示例8: attachCapability

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
/**
 * Attach capabilities (well, only one, right now)
 */
@SubscribeEvent
@SuppressWarnings("deprecation")
public void attachCapability(AttachCapabilitiesEvent.Entity event)
{
    if (!(event.getEntity() instanceof EntityPlayer)) return;

    event.addCapability(RECORDING_CAP, new RecordingProvider());
}
 
開發者ID:mchorse,項目名稱:blockbuster,代碼行數:12,代碼來源:CapabilityHandler.java

示例9: attach

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void attach(AttachCapabilitiesEvent.Entity event) {
    if(event.getEntity() instanceof EntityPlayer) {
        event.addCapability(PLAYER_DATA_NAME, PROVIDER);
    }
}
 
開發者ID:ExoMagica,項目名稱:ExoMagica,代碼行數:7,代碼來源:CapabilityHandler.java

示例10: attachCapability

import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void attachCapability(AttachCapabilitiesEvent.Entity event){
	if (!(event.getEntity() instanceof EntityPlayer)) return;
	event.addCapability(CAP, new ARKPlayer((EntityPlayer) event.getEntity()));
}
 
開發者ID:BubbleTrouble14,項目名稱:ARKCraft,代碼行數:6,代碼來源:PlayerCommonEventHandler.java


注:本文中的net.minecraftforge.event.AttachCapabilitiesEvent.Entity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。