public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { super.onItemUseFinish(stack, worldIn, entityLiving); return new ItemStack(Items.BOWL); } }
@Override public @Nonnull ItemStack onItemUseFinish(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull EntityLivingBase entityLiving) { ItemStack remaining = super.onItemUseFinish(stack, worldIn, entityLiving); final ItemStack containerItem = EnderFood.get(stack).getContainerItem(); if (Prep.isInvalid(containerItem)) { // no container return remaining; } if (Prep.isInvalid(remaining)) { // not stackable return containerItem; } if (entityLiving instanceof EntityPlayer) { // stackable with container item... ((EntityPlayer) entityLiving).addItemStackToInventory(containerItem); } else { entityLiving.entityDropItem(containerItem, 0); } return remaining; }
@Override public ItemStack onItemUseFinish(ItemStack itemStack, World world, EntityLivingBase entity) { ItemStack itemStackRemaining = super.onItemUseFinish(itemStack, world, entity); if (getContainerItem() != null) { ItemStack container = getContainerItem(itemStack); if (itemStackRemaining == null || itemStackRemaining.stackSize <= 0) return container; else if (!(entity instanceof EntityPlayer) || !((EntityPlayer) entity).inventory.addItemStackToInventory(container)) entity.entityDropItem(container, 0); } return itemStackRemaining; }
@Override public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase entityLiving) { super.onItemUseFinish(stack, world, entityLiving); if (entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityLiving; if (stack.getCount() >= 0) if (!player.inventory.addItemStackToInventory(getContainerItem(stack))) player.dropItem(getContainerItem(stack), false); } return stack; }
@Override public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { final IFluidHandler handler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (handler != null && entityLiving instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) entityLiving; entityplayer.getFoodStats().addStats(this, stack); worldIn.playSound(null, entityplayer.posX, entityplayer.posY, entityplayer.posZ, SoundEvents.ENTITY_GENERIC_DRINK, SoundCategory.PLAYERS, 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); this.onFoodEaten(stack, worldIn, entityplayer); entityplayer.addStat(StatList.getObjectUseStats(this)); handler.drain(Integer.MAX_VALUE, true); if (entityplayer instanceof EntityPlayerMP) { CriteriaTriggers.CONSUME_ITEM.trigger((EntityPlayerMP) entityplayer, stack); } return stack; } else { return super.onItemUseFinish(stack, worldIn, entityLiving); } }