本文整理汇总了Java中net.minecraftforge.event.entity.item.ItemTossEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java ItemTossEvent.getPlayer方法的具体用法?Java ItemTossEvent.getPlayer怎么用?Java ItemTossEvent.getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.entity.item.ItemTossEvent
的用法示例。
在下文中一共展示了ItemTossEvent.getPlayer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: itemToss
import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void itemToss(ItemTossEvent event) {
ItemStack stack=(event.getEntityItem().getItem());
if(!event.getPlayer().world.isRemote && stack.getItem() instanceof ItemUsable && stack.getCapability(TF2weapons.WEAPONS_DATA_CAP, null).active > 0){
//event.getPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).state = 0;
if(stack.getCapability(TF2weapons.WEAPONS_DATA_CAP, null).active == 2){
TF2weapons.network.sendTo(new TF2Message.WeaponDroppedMessage(ItemFromData.getData(stack).getName()), (EntityPlayerMP) event.getPlayer());
((ItemUsable) stack.getItem()).holster(event.getPlayer().getCapability(TF2weapons.WEAPONS_CAP, null), stack, event.getPlayer(), event.getPlayer().world);
}
stack.getCapability(TF2weapons.WEAPONS_DATA_CAP, null).active = 0;
}
if(stack.getItem() instanceof ItemFromData && stack.hasTagCompound() && (stack.getTagCompound().getBoolean("Bought") || stack.getTagCompound().getBoolean("Valve"))){
event.getEntity().setEntityInvulnerable(true);
event.getEntityItem().setThrower(event.getPlayer().getName());
}
}
示例2: onTossItem
import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTossItem(ItemTossEvent event)
{
if (event.getEntityItem() != null && event.getPlayer() instanceof EntityPlayerMP)
{
ItemStack stack = event.getEntityItem().getEntityItem();
sendItemStackToClient((EntityPlayerMP)event.getPlayer(), MalmoMessageType.SERVER_DISCARDITEM, stack);
}
}
示例3: onItemTossEvent
import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
/**
* Event listener for Action.DROP (when player drops the item from his
* inventory)
*/
@SubscribeEvent
public void onItemTossEvent(ItemTossEvent event) throws IOException
{
EntityPlayer player = event.getPlayer();
List<Action> events = CommonProxy.manager.getActions(player);
if (!player.worldObj.isRemote && events != null)
{
events.add(new DropAction(event.getEntityItem().getEntityItem()));
}
}
示例4: itemToss
import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
/** Alters behaviour when player drops an item. */
@SubscribeEvent
public void itemToss(ItemTossEvent event) {
EntityPlayer player = event.getPlayer();
Item item = event.getEntityItem().getEntityItem().getItem();
long time = player.world.getWorldTime();
player.getCapability(GeoCaps.CAP_PLAYER, null).addDelay(item, time);
}
示例5: onItemDrop
import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemDrop(ItemTossEvent event){
if(!event.getPlayer().world.isRemote){
if(isThrown(event.getEntityItem().getEntityItem())){
event.getEntityItem().getEntityItem().getTagCompound().setBoolean("thrown", false);
}
}
}
示例6: onItemToss
import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemToss(ItemTossEvent event)
{
if(!event.getPlayer().world.isRemote)
{
if(spawnWolfFromItem(event.getPlayer(), event.getEntityItem(), event.getPlayer()))
{
event.setCanceled(true);
}
}
}
示例7: onItemTossEvent
import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemTossEvent (ItemTossEvent event) {
if (!event.getPlayer().world.isRemote)
if(event.getPlayer().getCapability(ModCapabilities.DRIVE_STATE, null).getInDrive() && !event.getPlayer().getCapability(ModCapabilities.DRIVE_STATE, null).getActiveDriveName().equals(Strings.Form_Anti)) {
event.setCanceled(true);
return;
}
if (event.getEntityItem().getItem().getItem() instanceof ItemKeyblade && (event.getEntityItem().getItem().getItem() != ModItems.WoodenKeyblade && event.getEntityItem().getItem().getItem() != ModItems.WoodenStick && event.getEntityItem().getItem().getItem() != ModItems.DreamSword && event.getEntityItem().getItem().getItem() != ModItems.DreamStaff)) {
event.getEntityItem().isDead = true;
event.getPlayer().getCapability(ModCapabilities.SUMMON_KEYBLADE, null).setIsKeybladeSummoned(EnumHand.MAIN_HAND, false);
if(!ItemStack.areItemStacksEqual(event.getPlayer().getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain().getStackInSlot(0), ItemStack.EMPTY))
PacketDispatcher.sendTo(new SyncKeybladeData(event.getPlayer().getCapability(ModCapabilities.SUMMON_KEYBLADE, null)), (EntityPlayerMP) event.getPlayer());
} else if (event.getEntityItem().getItem().getItem() instanceof ItemMunny) {
event.setCanceled(true);
if (!event.getPlayer().world.isRemote) {
PacketDispatcher.sendTo(new ShowOverlayPacket("munny", event.getEntityItem().getItem().getTagCompound().getInteger("amount")), (EntityPlayerMP) event.getPlayer());
event.getPlayer().getCapability(ModCapabilities.MUNNY, null).addMunny(event.getEntityItem().getItem().getTagCompound().getInteger("amount"));
}
}
if (event.getEntityItem().getItem().getItem() == event.getPlayer().getCapability(ModCapabilities.ORGANIZATION_XIII, null).currentWeapon()) {
event.getEntityItem().isDead = true;
event.getPlayer().getCapability(ModCapabilities.ORGANIZATION_XIII, null).setWeaponSummoned(EnumHand.MAIN_HAND, false);
PacketDispatcher.sendTo(new SyncOrgXIIIData(event.getPlayer().getCapability(ModCapabilities.ORGANIZATION_XIII, null)), (EntityPlayerMP) event.getPlayer());
}
}
示例8: itemTossEvent
import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void itemTossEvent(ItemTossEvent event)
{
EntityPlayer player = event.getPlayer();
if (!Helper.shouldCare(player)) return;
event.getEntityItem().setItem(GlobalBanList.process(player.dimension, event.getEntityItem().getItem()));
}
示例9: onItemTossEvent
import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemTossEvent(ItemTossEvent itemTossEvent) {
NBTHelper.clearStatefulNBTTags(itemTossEvent.getEntityItem().getEntityItem());
//Close the Alchemical Bag GUI when the Alchemical bag is tossed
if (itemTossEvent.getPlayer().openContainer instanceof BagContainer)
{
if (((BagContainer) itemTossEvent.getPlayer().openContainer).isItemStackParent(itemTossEvent.getEntityItem().getEntityItem()))
{
//We have to remove the itemstack we are throwing from the inventory now to prevent a loop (will also happen after this event has been fired)
itemTossEvent.getPlayer().inventory.setItemStack(null);
itemTossEvent.getPlayer().closeScreen();
}
}
}