当前位置: 首页>>代码示例>>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;未经允许,请勿转载。