本文整理汇总了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());
}
示例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());
}
示例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());
}
}
}
示例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));
}
}
示例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){}
}
}
}
示例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());
}
示例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);
}
}
}
示例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());
}
示例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);
}
}
示例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()));
}