001 package net.minecraft.src;
002
003 import cpw.mods.fml.common.Side;
004 import cpw.mods.fml.common.asm.SideOnly;
005 import java.util.List;
006
007 public class ItemAppleGold extends ItemFood
008 {
009 public ItemAppleGold(int par1, int par2, float par3, boolean par4)
010 {
011 super(par1, par2, par3, par4);
012 this.setHasSubtypes(true);
013 }
014
015 @SideOnly(Side.CLIENT)
016 public boolean hasEffect(ItemStack par1ItemStack)
017 {
018 return par1ItemStack.getItemDamage() > 0;
019 }
020
021 @SideOnly(Side.CLIENT)
022
023 /**
024 * Return an item rarity from EnumRarity
025 */
026 public EnumRarity getRarity(ItemStack par1ItemStack)
027 {
028 return par1ItemStack.getItemDamage() == 0 ? EnumRarity.rare : EnumRarity.epic;
029 }
030
031 protected void func_77849_c(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
032 {
033 if (par1ItemStack.getItemDamage() > 0)
034 {
035 if (!par2World.isRemote)
036 {
037 par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 3));
038 par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
039 par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
040 }
041 }
042 else
043 {
044 super.func_77849_c(par1ItemStack, par2World, par3EntityPlayer);
045 }
046 }
047
048 @SideOnly(Side.CLIENT)
049
050 /**
051 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
052 */
053 public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
054 {
055 par3List.add(new ItemStack(par1, 1, 0));
056 par3List.add(new ItemStack(par1, 1, 1));
057 }
058 }