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


Java EntityPlayer.dropItem方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.dropItem方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.dropItem方法的具体用法?Java EntityPlayer.dropItem怎么用?Java EntityPlayer.dropItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


在下文中一共展示了EntityPlayer.dropItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the container is closed.
 */
public void onContainerClosed(EntityPlayer playerIn)
{
    super.onContainerClosed(playerIn);

    if (!this.worldPointer.isRemote)
    {
        for (int i = 0; i < this.tableInventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.tableInventory.removeStackFromSlot(i);

            if (itemstack != null)
            {
                playerIn.dropItem(itemstack, false);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:ContainerEnchantment.java

示例2: onPlayerTossEvent

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item, boolean includeName)
{
    player.captureDrops = true;
    EntityItem ret = player.dropItem(item, false, includeName);
    player.capturedDrops.clear();
    player.captureDrops = false;

    if (ret == null)
    {
        return null;
    }

    ItemTossEvent event = new ItemTossEvent(ret, player);
    if (MinecraftForge.EVENT_BUS.post(event))
    {
        return null;
    }

    if (!player.worldObj.isRemote)
    {
        player.getEntityWorld().spawnEntityInWorld(event.getEntityItem());
    }
    return event.getEntityItem();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:ForgeHooks.java

示例3: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override //&& state.getValue(GENERATED)==1
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
		EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
	if(heldItem == null){
		return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
	}
	
	if( !worldIn.isRemote  && heldItem.getItem() == Items.BOWL && side != EnumFacing.UP && side != EnumFacing.DOWN){
		
                  ItemStack itemstack1 = new ItemStack(ItemRegistry.rubber_sap);

                  if (--heldItem.stackSize == 0)
                  {
                      playerIn.setHeldItem(hand, itemstack1);
                  }
                  else if (!playerIn.inventory.addItemStackToInventory(itemstack1))
                  {
                      playerIn.dropItem(itemstack1, false);
                  }
	}
	return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
	
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:24,代码来源:SappyLog.java

示例4: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the container is closed.
 */
public void onContainerClosed(EntityPlayer playerIn)
{
    super.onContainerClosed(playerIn);

    if (!this.worldPointer.isRemote)
    {
        for (int i = 0; i < this.tableInventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.tableInventory.removeStackFromSlot(i);

            if (!itemstack.func_190926_b())
            {
                playerIn.dropItem(itemstack, false);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:ContainerEnchantment.java

示例5: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the container is closed.
 */
public void onContainerClosed(EntityPlayer playerIn)
{
    super.onContainerClosed(playerIn);

    if (!this.worldObj.isRemote)
    {
        for (int i = 0; i < 9; ++i)
        {
            ItemStack itemstack = this.craftMatrix.removeStackFromSlot(i);

            if (itemstack != null)
            {
                playerIn.dropItem(itemstack, false);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:ContainerWorkbench.java

示例6: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the container is closed.
 */
public void onContainerClosed(EntityPlayer playerIn)
{
    super.onContainerClosed(playerIn);
    this.theMerchant.setCustomer((EntityPlayer)null);
    super.onContainerClosed(playerIn);

    if (!this.theWorld.isRemote)
    {
        ItemStack itemstack = this.merchantInventory.removeStackFromSlot(0);

        if (itemstack != null)
        {
            playerIn.dropItem(itemstack, false);
        }

        itemstack = this.merchantInventory.removeStackFromSlot(1);

        if (itemstack != null)
        {
            playerIn.dropItem(itemstack, false);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:ContainerMerchant.java

示例7: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the container is closed.
 */
@Override
public void onContainerClosed(EntityPlayer player)
{
	super.onContainerClosed(player);

	if (!worldObj.isRemote)
	{
		for (int i = 0; i < 9; ++i)
		{
			ItemStack itemstack = craftMatrix.removeStackFromSlot(i);

			if (itemstack != null)
			{
				player.dropItem(itemstack, false);
			}
		}
	}
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:22,代码来源:ContainerSimpleWorkbench.java

示例8: turnBottleIntoItem

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected ItemStack turnBottleIntoItem(ItemStack p_185061_1_, EntityPlayer player, ItemStack stack)
{
    p_185061_1_.func_190918_g(1);
    player.addStat(StatList.getObjectUseStats(this));

    if (p_185061_1_.func_190926_b())
    {
        return stack;
    }
    else
    {
        if (!player.inventory.addItemStackToInventory(stack))
        {
            player.dropItem(stack, false);
        }

        return p_185061_1_;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:ItemGlassBottle.java

示例9: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = ItemMap.func_190906_a(itemStackIn, worldIn.posX, worldIn.posZ, (byte)0, true, false);
    ItemStack itemstack1 = worldIn.getHeldItem(playerIn);
    itemstack1.func_190918_g(1);

    if (itemstack1.func_190926_b())
    {
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
    else
    {
        if (!worldIn.inventory.addItemStackToInventory(itemstack.copy()))
        {
            worldIn.dropItem(itemstack, false);
        }

        worldIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemstack1);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:ItemEmptyMap.java

示例10: turnBottleIntoItem

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected ItemStack turnBottleIntoItem(ItemStack p_185061_1_, EntityPlayer player, ItemStack stack)
{
    --p_185061_1_.stackSize;
    player.addStat(StatList.getObjectUseStats(this));

    if (p_185061_1_.stackSize <= 0)
    {
        return stack;
    }
    else
    {
        if (!player.inventory.addItemStackToInventory(stack))
        {
            player.dropItem(stack, false);
        }

        return p_185061_1_;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:ItemGlassBottle.java

示例11: fillBucket

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private ItemStack fillBucket(ItemStack emptyBuckets, EntityPlayer player, Item fullBucket)
{
    if (player.capabilities.isCreativeMode)
    {
        return emptyBuckets;
    }
    else if (--emptyBuckets.stackSize <= 0)
    {
        return new ItemStack(fullBucket);
    }
    else
    {
        if (!player.inventory.addItemStackToInventory(new ItemStack(fullBucket)))
        {
            player.dropItem(new ItemStack(fullBucket), false);
        }

        return emptyBuckets;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:ItemBucket.java

示例12: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the container is closed.
 */
public void onContainerClosed(EntityPlayer playerIn)
{
    super.onContainerClosed(playerIn);

    for (int i = 0; i < 4; ++i)
    {
        ItemStack itemstack = this.craftMatrix.removeStackFromSlot(i);

        if (!itemstack.func_190926_b())
        {
            playerIn.dropItem(itemstack, false);
        }
    }

    this.craftResult.setInventorySlotContents(0, ItemStack.field_190927_a);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:ContainerPlayer.java

示例13: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the container is closed.
 */
public void onContainerClosed(EntityPlayer playerIn)
{
    super.onContainerClosed(playerIn);

    if (!this.theWorld.isRemote)
    {
        for (int i = 0; i < this.inputSlots.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inputSlots.removeStackFromSlot(i);

            if (!itemstack.func_190926_b())
            {
                playerIn.dropItem(itemstack, false);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:ContainerRepair.java

示例14: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the container is closed.
 */
public void onContainerClosed(EntityPlayer playerIn)
{
    super.onContainerClosed(playerIn);
    this.theMerchant.setCustomer((EntityPlayer)null);
    super.onContainerClosed(playerIn);

    if (!this.theWorld.isRemote)
    {
        ItemStack itemstack = this.merchantInventory.removeStackFromSlot(0);

        if (!itemstack.func_190926_b())
        {
            playerIn.dropItem(itemstack, false);
        }

        itemstack = this.merchantInventory.removeStackFromSlot(1);

        if (!itemstack.func_190926_b())
        {
            playerIn.dropItem(itemstack, false);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:ContainerMerchant.java

示例15: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the container is closed.
 */
public void onContainerClosed(EntityPlayer playerIn)
{
    super.onContainerClosed(playerIn);

    if (playerIn != null && !playerIn.worldObj.isRemote)
    {
        ItemStack itemstack = this.beaconSlot.decrStackSize(this.beaconSlot.getSlotStackLimit());

        if (itemstack != null)
        {
            playerIn.dropItem(itemstack, false);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:ContainerBeacon.java


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