本文整理匯總了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()));
}