package squeek.veganoption.items;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class ItemFoodContainered extends ItemFood
{

	public ItemFoodContainered(int hunger, boolean isWolfsFavoriteFood)
	{
		super(hunger, isWolfsFavoriteFood);
	}

	public ItemFoodContainered(int hunger, float saturation, boolean isWolfsFavoriteFood)
	{
		super(hunger, saturation, isWolfsFavoriteFood);
	}

	@Override
	public void onFoodEaten(ItemStack itemStack, World world, EntityPlayer player)
	{
		super.onFoodEaten(itemStack, world, player);

		if (getContainerItem() != null)
		{
			ItemStack container = getContainerItem(itemStack);
			if (itemStack == null || itemStack.stackSize <= 0)
				return;
			else if (!player.inventory.addItemStackToInventory(container))
				player.dropItem(container, false);
		}
	}

}

@@ -28,16 +28,62 @@
 items;%0A%0A
+import net.minecraft.entity.EntityLivingBase;%0A
 import n
@@ -231,16 +231,61 @@
 World;%0A%0A
+import static sun.audio.AudioPlayer.player;%0A%0A
 public c
@@ -610,24 +610,33 @@
 lic 
-void onFoodEaten
+ItemStack onItemUseFinish
 (Ite
@@ -676,45 +676,84 @@
 tity
-Player player)%0A%09%7B%0A%09%09super.onFoodEaten
+LivingBase entity)%0A%09%7B%0A%09%09ItemStack itemStackRemaining = super.onItemUseFinish
 (ite
@@ -767,22 +767,22 @@
  world, 
-player
+entity
 );%0A%0A%09%09if
@@ -885,16 +885,25 @@
 temStack
+Remaining
  == null
@@ -915,16 +915,25 @@
 temStack
+Remaining
 .stackSi
@@ -951,16 +951,26 @@
 %09%09return
+ container
 ;%0A%09%09%09els
@@ -976,22 +976,76 @@
 se if (!
-player
+(entity instanceof EntityPlayer) %7C%7C !((EntityPlayer) entity)
 .invento
@@ -1091,16 +1091,22 @@
 %09%09%09%09
-player.d
+entity.entityD
 ropI
@@ -1124,19 +1124,45 @@
 er, 
-false
+0
 );%0A%09%09%7D
+%0A%0A%09%09return itemStackRemaining;
 %0A%09%7D%0A

Fix port of ItemFoodContainered