content: package net.minecraft.item;
  
  import net.minecraft.creativetab.CreativeTabs;
  import net.minecraft.entity.player.EntityPlayer;
  import net.minecraft.potion.Potion;
  import net.minecraft.potion.PotionEffect;
  import net.minecraft.world.World;
  
  import java.util.List;
  
  public class ItemAppleGold extends ItemFood {
      public ItemAppleGold(int amount, float saturation, boolean isWolfFood) {
          super(amount, saturation, isWolfFood);
          this.setHasSubtypes(true);
      }
  
      public boolean hasEffect(ItemStack stack) {
          return stack.getMetadata() > 0;
      }
  
      public EnumRarity getRarity(ItemStack stack) {
          return stack.getMetadata() == 0 ? EnumRarity.RARE : EnumRarity.EPIC;
      }
  
      protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) {
          if (!worldIn.isRemote) {
              player.addPotionEffect(new PotionEffect(Potion.absorption.id, 2400, 0));
          }
  
          if (stack.getMetadata() > 0) {
              if (!worldIn.isRemote) {
                  player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 4));
                  player.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
                  player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
              }
          } else {
              super.onFoodEaten(stack, worldIn, player);
          }
      }
  
      public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
          subItems.add(new ItemStack(itemIn, 1, 0));
          subItems.add(new ItemStack(itemIn, 1, 1));
      }
  }
  