package com.probossgamers.turtlemod.items;

import com.probossgamers.turtlemod.TurtleMain;

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

public class ItemModFood extends ItemFood
{

	private PotionEffect[] effects;
	
	 public ItemModFood(String unlocalizedName, int amount, float saturation, boolean isWolfFood, PotionEffect... effects) {
	        super(amount, saturation, isWolfFood);
	        this.setUnlocalizedName(unlocalizedName);
	        this.setCreativeTab(TurtleMain.tabCustom);
	        this.effects = effects;
	    }
	 
	 @Override
	 protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player)
	 {
	     super.onFoodEaten(stack, world, player);
	     
	     for (int i = 0; i < effects.length; i ++) {
	         effects[i].getPotion();
			if (!world.isRemote && effects[i] != null && Potion.getIdFromPotion(effects[i].getPotion()) > 0)
	             player.addPotionEffect(new PotionEffect(this.effects[i]));
	     }
	 }
	 
	 
}

@@ -865,22 +865,53 @@
 ;%0A%09     
-%0A%09    
+if(!(effects == null))%0A         %7B%0A%09%09%09
  for (in
@@ -944,24 +944,22 @@
 h; i
- 
 ++)
- %7B%0A%09        
+%0A%09%09%09 %7B%0A%09%09%09%09
  eff
@@ -982,16 +982,18 @@
 n();%0A%09%09%09
+%09 
 if (!wor
@@ -1082,28 +1082,27 @@
 ) %3E 0)%0A%09
-            
+%09%09%09 %7B%0A%09%09%09%09%09
  player.
@@ -1154,20 +1154,30 @@
 %5Bi%5D));%0A%09
-    
+%09%09%09 %7D%0A%09%09%09 %7D%0A%09%09
  %7D%0A%09 %7D%0A%09

Check for null potion effects.