package com.arkcraft.mod.core.items;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;

import com.arkcraft.mod.core.GlobalAdditions;
/**
 * @author Vastatio
 */
public class ARKFood extends ItemFood {
	
	private PotionEffect[] effects;
	private boolean alwaysEdible;
	
	public ARKFood(String name, int healAmount, float sat, boolean fav, boolean alwaysEdible, PotionEffect... effects) {
		super(healAmount, sat, fav);
		this.setUnlocalizedName(name);
		this.setCreativeTab(GlobalAdditions.tabARK);
		GameRegistry.registerItem(this, name);
		this.effects = effects;
		this.alwaysEdible = alwaysEdible;
		
	}

	@Override
	protected void onFoodEaten(ItemStack stack, World worldIn,
			EntityPlayer player) {
		super.onFoodEaten(stack, worldIn, player);
		for (int i = 0; i < effects.length; i ++) {
	        if (!worldIn.isRemote && effects[i] != null && effects[i].getPotionID() > 0)
	            player.addPotionEffect(new PotionEffect(this.effects[i].getPotionID(), this.effects[i].getDuration(), this.effects[i].getAmplifier(), this.effects[i].getIsAmbient(), this.effects[i].getIsShowParticles()));
	    }
	}
	@Override
	public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
    {
        if (playerIn.canEat(this.alwaysEdible))
        {
            playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
        }

        return itemStackIn;
    }
		
	@Override
	  public ItemFood setAlwaysEdible()
    {
        this.alwaysEdible = true;
        return this;
    }
	
	
	
	
}

@@ -83,16 +83,49 @@
 layer;%0D%0A
+import net.minecraft.item.Item;%0D%0A
 import n
@@ -1828,19 +1828,785 @@
  %7D%0D%0A%09%0D%0A%09
-%0D%0A%09%0D%0A%09
+public static ItemStack getSeedForBerry(ItemStack stack) %7B%0D%0A%09%09if (stack != null) %7B%0D%0A%09%09%09if (stack.getItem() instanceof ARKSeedItem) %7B%0D%0A%09%09%09%09if (stack.getItem() == (Item) GlobalAdditions.amarBerrySeed)%0D%0A%09%09%09%09%09return new ItemStack(GlobalAdditions.amarBerry);%0D%0A%09%09%09%09if (stack.getItem() == (Item) GlobalAdditions.azulBerrySeed)%0D%0A%09%09%09%09%09return new ItemStack(GlobalAdditions.azulBerry);%0D%0A%09%09%09%09if (stack.getItem() == (Item) GlobalAdditions.mejoBerrySeed)%0D%0A%09%09%09%09%09return new ItemStack(GlobalAdditions.mejoBerry);%0D%0A%09%09%09%09if (stack.getItem() == (Item) GlobalAdditions.narcoBerrySeed)%0D%0A%09%09%09%09%09return new ItemStack(GlobalAdditions.narcoBerry);%0D%0A%09%09%09%09if (stack.getItem() == (Item) GlobalAdditions.tintoBerrySeed)%0D%0A%09%09%09%09%09return new ItemStack(GlobalAdditions.tintoBerry);%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09return null;%0D%0A%09%7D
 %0D%0A%7D%0D%0A

Update to support seeds