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