当前位置: 首页>>代码示例>>Java>>正文


Java ItemTossEvent.getPlayer方法代码示例

本文整理汇总了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());
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:19,代码来源:TF2EventsCommon.java

示例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);
    }
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:10,代码来源:RewardForDiscardingItemImplementation.java

示例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()));
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:16,代码来源:ActionHandler.java

示例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);
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:11,代码来源:PlayerEvents.java

示例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);
		}
	}
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:9,代码来源:BoomerangItem.java

示例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);
        }
    }
}
 
开发者ID:iChun,项目名称:BeeBarker,代码行数:12,代码来源:EventHandlerServer.java

示例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());
    }
}
 
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys-Re-Coded,代码行数:29,代码来源:ItemEvents.java

示例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()));
}
 
开发者ID:DoubleDoorDevelopment,项目名称:ItemBlacklist,代码行数:8,代码来源:ServerEventHandlers.java

示例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();
        }
    }
}
 
开发者ID:lorddusk,项目名称:Bagginses,代码行数:16,代码来源:ItemEvent.java


注:本文中的net.minecraftforge.event.entity.item.ItemTossEvent.getPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。