001 package net.minecraft.src; 002 003 import cpw.mods.fml.common.Side; 004 import cpw.mods.fml.common.asm.SideOnly; 005 import cpw.mods.fml.common.registry.GameData; 006 import cpw.mods.fml.common.registry.GameRegistry; 007 008 import java.util.List; 009 import java.util.Random; 010 011 public class Item 012 { 013 private CreativeTabs tabToDisplayOn = null; 014 015 /** The RNG used by the Item subclasses. */ 016 protected static Random itemRand = new Random(); 017 018 /** A 32000 elements Item array. */ 019 public static Item[] itemsList = new Item[32000]; 020 public static Item shovelSteel = (new ItemSpade(0, EnumToolMaterial.IRON)).setIconCoord(2, 5).setItemName("shovelIron"); 021 public static Item pickaxeSteel = (new ItemPickaxe(1, EnumToolMaterial.IRON)).setIconCoord(2, 6).setItemName("pickaxeIron"); 022 public static Item axeSteel = (new ItemAxe(2, EnumToolMaterial.IRON)).setIconCoord(2, 7).setItemName("hatchetIron"); 023 public static Item flintAndSteel = (new ItemFlintAndSteel(3)).setIconCoord(5, 0).setItemName("flintAndSteel"); 024 public static Item appleRed = (new ItemFood(4, 4, 0.3F, false)).setIconCoord(10, 0).setItemName("apple"); 025 public static Item bow = (new ItemBow(5)).setIconCoord(5, 1).setItemName("bow"); 026 public static Item arrow = (new Item(6)).setIconCoord(5, 2).setItemName("arrow").setCreativeTab(CreativeTabs.tabCombat); 027 public static Item coal = (new ItemCoal(7)).setIconCoord(7, 0).setItemName("coal"); 028 public static Item diamond = (new Item(8)).setIconCoord(7, 3).setItemName("diamond").setCreativeTab(CreativeTabs.tabMaterials); 029 public static Item ingotIron = (new Item(9)).setIconCoord(7, 1).setItemName("ingotIron").setCreativeTab(CreativeTabs.tabMaterials); 030 public static Item ingotGold = (new Item(10)).setIconCoord(7, 2).setItemName("ingotGold").setCreativeTab(CreativeTabs.tabMaterials); 031 public static Item swordSteel = (new ItemSword(11, EnumToolMaterial.IRON)).setIconCoord(2, 4).setItemName("swordIron"); 032 public static Item swordWood = (new ItemSword(12, EnumToolMaterial.WOOD)).setIconCoord(0, 4).setItemName("swordWood"); 033 public static Item shovelWood = (new ItemSpade(13, EnumToolMaterial.WOOD)).setIconCoord(0, 5).setItemName("shovelWood"); 034 public static Item pickaxeWood = (new ItemPickaxe(14, EnumToolMaterial.WOOD)).setIconCoord(0, 6).setItemName("pickaxeWood"); 035 public static Item axeWood = (new ItemAxe(15, EnumToolMaterial.WOOD)).setIconCoord(0, 7).setItemName("hatchetWood"); 036 public static Item swordStone = (new ItemSword(16, EnumToolMaterial.STONE)).setIconCoord(1, 4).setItemName("swordStone"); 037 public static Item shovelStone = (new ItemSpade(17, EnumToolMaterial.STONE)).setIconCoord(1, 5).setItemName("shovelStone"); 038 public static Item pickaxeStone = (new ItemPickaxe(18, EnumToolMaterial.STONE)).setIconCoord(1, 6).setItemName("pickaxeStone"); 039 public static Item axeStone = (new ItemAxe(19, EnumToolMaterial.STONE)).setIconCoord(1, 7).setItemName("hatchetStone"); 040 public static Item swordDiamond = (new ItemSword(20, EnumToolMaterial.EMERALD)).setIconCoord(3, 4).setItemName("swordDiamond"); 041 public static Item shovelDiamond = (new ItemSpade(21, EnumToolMaterial.EMERALD)).setIconCoord(3, 5).setItemName("shovelDiamond"); 042 public static Item pickaxeDiamond = (new ItemPickaxe(22, EnumToolMaterial.EMERALD)).setIconCoord(3, 6).setItemName("pickaxeDiamond"); 043 public static Item axeDiamond = (new ItemAxe(23, EnumToolMaterial.EMERALD)).setIconCoord(3, 7).setItemName("hatchetDiamond"); 044 public static Item stick = (new Item(24)).setIconCoord(5, 3).setFull3D().setItemName("stick").setCreativeTab(CreativeTabs.tabMaterials); 045 public static Item bowlEmpty = (new Item(25)).setIconCoord(7, 4).setItemName("bowl").setCreativeTab(CreativeTabs.tabMaterials); 046 public static Item bowlSoup = (new ItemSoup(26, 6)).setIconCoord(8, 4).setItemName("mushroomStew"); 047 public static Item swordGold = (new ItemSword(27, EnumToolMaterial.GOLD)).setIconCoord(4, 4).setItemName("swordGold"); 048 public static Item shovelGold = (new ItemSpade(28, EnumToolMaterial.GOLD)).setIconCoord(4, 5).setItemName("shovelGold"); 049 public static Item pickaxeGold = (new ItemPickaxe(29, EnumToolMaterial.GOLD)).setIconCoord(4, 6).setItemName("pickaxeGold"); 050 public static Item axeGold = (new ItemAxe(30, EnumToolMaterial.GOLD)).setIconCoord(4, 7).setItemName("hatchetGold"); 051 public static Item silk = (new ItemReed(31, Block.tripWire)).setIconCoord(8, 0).setItemName("string").setCreativeTab(CreativeTabs.tabMaterials); 052 public static Item feather = (new Item(32)).setIconCoord(8, 1).setItemName("feather").setCreativeTab(CreativeTabs.tabMaterials); 053 public static Item gunpowder = (new Item(33)).setIconCoord(8, 2).setItemName("sulphur").setPotionEffect(PotionHelper.gunpowderEffect).setCreativeTab(CreativeTabs.tabMaterials); 054 public static Item hoeWood = (new ItemHoe(34, EnumToolMaterial.WOOD)).setIconCoord(0, 8).setItemName("hoeWood"); 055 public static Item hoeStone = (new ItemHoe(35, EnumToolMaterial.STONE)).setIconCoord(1, 8).setItemName("hoeStone"); 056 public static Item hoeSteel = (new ItemHoe(36, EnumToolMaterial.IRON)).setIconCoord(2, 8).setItemName("hoeIron"); 057 public static Item hoeDiamond = (new ItemHoe(37, EnumToolMaterial.EMERALD)).setIconCoord(3, 8).setItemName("hoeDiamond"); 058 public static Item hoeGold = (new ItemHoe(38, EnumToolMaterial.GOLD)).setIconCoord(4, 8).setItemName("hoeGold"); 059 public static Item seeds = (new ItemSeeds(39, Block.crops.blockID, Block.tilledField.blockID)).setIconCoord(9, 0).setItemName("seeds"); 060 public static Item wheat = (new Item(40)).setIconCoord(9, 1).setItemName("wheat").setCreativeTab(CreativeTabs.tabMaterials); 061 public static Item bread = (new ItemFood(41, 5, 0.6F, false)).setIconCoord(9, 2).setItemName("bread"); 062 public static Item helmetLeather = (new ItemArmor(42, EnumArmorMaterial.CLOTH, 0, 0)).setIconCoord(0, 0).setItemName("helmetCloth"); 063 public static Item plateLeather = (new ItemArmor(43, EnumArmorMaterial.CLOTH, 0, 1)).setIconCoord(0, 1).setItemName("chestplateCloth"); 064 public static Item legsLeather = (new ItemArmor(44, EnumArmorMaterial.CLOTH, 0, 2)).setIconCoord(0, 2).setItemName("leggingsCloth"); 065 public static Item bootsLeather = (new ItemArmor(45, EnumArmorMaterial.CLOTH, 0, 3)).setIconCoord(0, 3).setItemName("bootsCloth"); 066 public static Item helmetChain = (new ItemArmor(46, EnumArmorMaterial.CHAIN, 1, 0)).setIconCoord(1, 0).setItemName("helmetChain"); 067 public static Item plateChain = (new ItemArmor(47, EnumArmorMaterial.CHAIN, 1, 1)).setIconCoord(1, 1).setItemName("chestplateChain"); 068 public static Item legsChain = (new ItemArmor(48, EnumArmorMaterial.CHAIN, 1, 2)).setIconCoord(1, 2).setItemName("leggingsChain"); 069 public static Item bootsChain = (new ItemArmor(49, EnumArmorMaterial.CHAIN, 1, 3)).setIconCoord(1, 3).setItemName("bootsChain"); 070 public static Item helmetSteel = (new ItemArmor(50, EnumArmorMaterial.IRON, 2, 0)).setIconCoord(2, 0).setItemName("helmetIron"); 071 public static Item plateSteel = (new ItemArmor(51, EnumArmorMaterial.IRON, 2, 1)).setIconCoord(2, 1).setItemName("chestplateIron"); 072 public static Item legsSteel = (new ItemArmor(52, EnumArmorMaterial.IRON, 2, 2)).setIconCoord(2, 2).setItemName("leggingsIron"); 073 public static Item bootsSteel = (new ItemArmor(53, EnumArmorMaterial.IRON, 2, 3)).setIconCoord(2, 3).setItemName("bootsIron"); 074 public static Item helmetDiamond = (new ItemArmor(54, EnumArmorMaterial.DIAMOND, 3, 0)).setIconCoord(3, 0).setItemName("helmetDiamond"); 075 public static Item plateDiamond = (new ItemArmor(55, EnumArmorMaterial.DIAMOND, 3, 1)).setIconCoord(3, 1).setItemName("chestplateDiamond"); 076 public static Item legsDiamond = (new ItemArmor(56, EnumArmorMaterial.DIAMOND, 3, 2)).setIconCoord(3, 2).setItemName("leggingsDiamond"); 077 public static Item bootsDiamond = (new ItemArmor(57, EnumArmorMaterial.DIAMOND, 3, 3)).setIconCoord(3, 3).setItemName("bootsDiamond"); 078 public static Item helmetGold = (new ItemArmor(58, EnumArmorMaterial.GOLD, 4, 0)).setIconCoord(4, 0).setItemName("helmetGold"); 079 public static Item plateGold = (new ItemArmor(59, EnumArmorMaterial.GOLD, 4, 1)).setIconCoord(4, 1).setItemName("chestplateGold"); 080 public static Item legsGold = (new ItemArmor(60, EnumArmorMaterial.GOLD, 4, 2)).setIconCoord(4, 2).setItemName("leggingsGold"); 081 public static Item bootsGold = (new ItemArmor(61, EnumArmorMaterial.GOLD, 4, 3)).setIconCoord(4, 3).setItemName("bootsGold"); 082 public static Item flint = (new Item(62)).setIconCoord(6, 0).setItemName("flint").setCreativeTab(CreativeTabs.tabMaterials); 083 public static Item porkRaw = (new ItemFood(63, 3, 0.3F, true)).setIconCoord(7, 5).setItemName("porkchopRaw"); 084 public static Item porkCooked = (new ItemFood(64, 8, 0.8F, true)).setIconCoord(8, 5).setItemName("porkchopCooked"); 085 public static Item painting = (new ItemHangingEntity(65, EntityPainting.class)).setIconCoord(10, 1).setItemName("painting"); 086 public static Item appleGold = (new ItemAppleGold(66, 4, 1.2F, false)).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 5, 0, 1.0F).setIconCoord(11, 0).setItemName("appleGold"); 087 public static Item sign = (new ItemSign(67)).setIconCoord(10, 2).setItemName("sign"); 088 public static Item doorWood = (new ItemDoor(68, Material.wood)).setIconCoord(11, 2).setItemName("doorWood"); 089 public static Item bucketEmpty = (new ItemBucket(69, 0)).setIconCoord(10, 4).setItemName("bucket").setMaxStackSize(16); 090 public static Item bucketWater = (new ItemBucket(70, Block.waterMoving.blockID)).setIconCoord(11, 4).setItemName("bucketWater").setContainerItem(bucketEmpty); 091 public static Item bucketLava = (new ItemBucket(71, Block.lavaMoving.blockID)).setIconCoord(12, 4).setItemName("bucketLava").setContainerItem(bucketEmpty); 092 public static Item minecartEmpty = (new ItemMinecart(72, 0)).setIconCoord(7, 8).setItemName("minecart"); 093 public static Item saddle = (new ItemSaddle(73)).setIconCoord(8, 6).setItemName("saddle"); 094 public static Item doorSteel = (new ItemDoor(74, Material.iron)).setIconCoord(12, 2).setItemName("doorIron"); 095 public static Item redstone = (new ItemRedstone(75)).setIconCoord(8, 3).setItemName("redstone").setPotionEffect(PotionHelper.redstoneEffect); 096 public static Item snowball = (new ItemSnowball(76)).setIconCoord(14, 0).setItemName("snowball"); 097 public static Item boat = (new ItemBoat(77)).setIconCoord(8, 8).setItemName("boat"); 098 public static Item leather = (new Item(78)).setIconCoord(7, 6).setItemName("leather").setCreativeTab(CreativeTabs.tabMaterials); 099 public static Item bucketMilk = (new ItemBucketMilk(79)).setIconCoord(13, 4).setItemName("milk").setContainerItem(bucketEmpty); 100 public static Item brick = (new Item(80)).setIconCoord(6, 1).setItemName("brick").setCreativeTab(CreativeTabs.tabMaterials); 101 public static Item clay = (new Item(81)).setIconCoord(9, 3).setItemName("clay").setCreativeTab(CreativeTabs.tabMaterials); 102 public static Item reed = (new ItemReed(82, Block.reed)).setIconCoord(11, 1).setItemName("reeds").setCreativeTab(CreativeTabs.tabMaterials); 103 public static Item paper = (new Item(83)).setIconCoord(10, 3).setItemName("paper").setCreativeTab(CreativeTabs.tabMisc); 104 public static Item book = (new Item(84)).setIconCoord(11, 3).setItemName("book").setCreativeTab(CreativeTabs.tabMisc); 105 public static Item slimeBall = (new Item(85)).setIconCoord(14, 1).setItemName("slimeball").setCreativeTab(CreativeTabs.tabMisc); 106 public static Item minecartCrate = (new ItemMinecart(86, 1)).setIconCoord(7, 9).setItemName("minecartChest"); 107 public static Item minecartPowered = (new ItemMinecart(87, 2)).setIconCoord(7, 10).setItemName("minecartFurnace"); 108 public static Item egg = (new ItemEgg(88)).setIconCoord(12, 0).setItemName("egg"); 109 public static Item compass = (new Item(89)).setIconCoord(6, 3).setItemName("compass").setCreativeTab(CreativeTabs.tabTools); 110 public static Item fishingRod = (new ItemFishingRod(90)).setIconCoord(5, 4).setItemName("fishingRod"); 111 public static Item pocketSundial = (new Item(91)).setIconCoord(6, 4).setItemName("clock").setCreativeTab(CreativeTabs.tabTools); 112 public static Item lightStoneDust = (new Item(92)).setIconCoord(9, 4).setItemName("yellowDust").setPotionEffect(PotionHelper.glowstoneEffect).setCreativeTab(CreativeTabs.tabMaterials); 113 public static Item fishRaw = (new ItemFood(93, 2, 0.3F, false)).setIconCoord(9, 5).setItemName("fishRaw"); 114 public static Item fishCooked = (new ItemFood(94, 5, 0.6F, false)).setIconCoord(10, 5).setItemName("fishCooked"); 115 public static Item dyePowder = (new ItemDye(95)).setIconCoord(14, 4).setItemName("dyePowder"); 116 public static Item bone = (new Item(96)).setIconCoord(12, 1).setItemName("bone").setFull3D().setCreativeTab(CreativeTabs.tabMisc); 117 public static Item sugar = (new Item(97)).setIconCoord(13, 0).setItemName("sugar").setPotionEffect(PotionHelper.sugarEffect).setCreativeTab(CreativeTabs.tabMaterials); 118 public static Item cake = (new ItemReed(98, Block.cake)).setMaxStackSize(1).setIconCoord(13, 1).setItemName("cake").setCreativeTab(CreativeTabs.tabFood); 119 public static Item bed = (new ItemBed(99)).setMaxStackSize(1).setIconCoord(13, 2).setItemName("bed"); 120 public static Item redstoneRepeater = (new ItemReed(100, Block.redstoneRepeaterIdle)).setIconCoord(6, 5).setItemName("diode").setCreativeTab(CreativeTabs.tabRedstone); 121 public static Item cookie = (new ItemFood(101, 2, 0.1F, false)).setIconCoord(12, 5).setItemName("cookie"); 122 public static ItemMap map = (ItemMap)(new ItemMap(102)).setIconCoord(12, 3).setItemName("map"); 123 124 /** 125 * Item introduced on 1.7 version, is a shear to cut leaves (you can keep the block) or get wool from sheeps. 126 */ 127 public static ItemShears shears = (ItemShears)(new ItemShears(103)).setIconCoord(13, 5).setItemName("shears"); 128 public static Item melon = (new ItemFood(104, 2, 0.3F, false)).setIconCoord(13, 6).setItemName("melon"); 129 public static Item pumpkinSeeds = (new ItemSeeds(105, Block.pumpkinStem.blockID, Block.tilledField.blockID)).setIconCoord(13, 3).setItemName("seeds_pumpkin"); 130 public static Item melonSeeds = (new ItemSeeds(106, Block.melonStem.blockID, Block.tilledField.blockID)).setIconCoord(14, 3).setItemName("seeds_melon"); 131 public static Item beefRaw = (new ItemFood(107, 3, 0.3F, true)).setIconCoord(9, 6).setItemName("beefRaw"); 132 public static Item beefCooked = (new ItemFood(108, 8, 0.8F, true)).setIconCoord(10, 6).setItemName("beefCooked"); 133 public static Item chickenRaw = (new ItemFood(109, 2, 0.3F, true)).setPotionEffect(Potion.hunger.id, 30, 0, 0.3F).setIconCoord(9, 7).setItemName("chickenRaw"); 134 public static Item chickenCooked = (new ItemFood(110, 6, 0.6F, true)).setIconCoord(10, 7).setItemName("chickenCooked"); 135 public static Item rottenFlesh = (new ItemFood(111, 4, 0.1F, true)).setPotionEffect(Potion.hunger.id, 30, 0, 0.8F).setIconCoord(11, 5).setItemName("rottenFlesh"); 136 public static Item enderPearl = (new ItemEnderPearl(112)).setIconCoord(11, 6).setItemName("enderPearl"); 137 public static Item blazeRod = (new Item(113)).setIconCoord(12, 6).setItemName("blazeRod").setCreativeTab(CreativeTabs.tabMaterials); 138 public static Item ghastTear = (new Item(114)).setIconCoord(11, 7).setItemName("ghastTear").setPotionEffect(PotionHelper.ghastTearEffect).setCreativeTab(CreativeTabs.tabBrewing); 139 public static Item goldNugget = (new Item(115)).setIconCoord(12, 7).setItemName("goldNugget").setCreativeTab(CreativeTabs.tabMaterials); 140 public static Item netherStalkSeeds = (new ItemSeeds(116, Block.netherStalk.blockID, Block.slowSand.blockID)).setIconCoord(13, 7).setItemName("netherStalkSeeds").setPotionEffect("+4"); 141 public static ItemPotion potion = (ItemPotion)(new ItemPotion(117)).setIconCoord(13, 8).setItemName("potion"); 142 public static Item glassBottle = (new ItemGlassBottle(118)).setIconCoord(12, 8).setItemName("glassBottle"); 143 public static Item spiderEye = (new ItemFood(119, 2, 0.8F, false)).setPotionEffect(Potion.poison.id, 5, 0, 1.0F).setIconCoord(11, 8).setItemName("spiderEye").setPotionEffect(PotionHelper.spiderEyeEffect); 144 public static Item fermentedSpiderEye = (new Item(120)).setIconCoord(10, 8).setItemName("fermentedSpiderEye").setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setCreativeTab(CreativeTabs.tabBrewing); 145 public static Item blazePowder = (new Item(121)).setIconCoord(13, 9).setItemName("blazePowder").setPotionEffect(PotionHelper.blazePowderEffect).setCreativeTab(CreativeTabs.tabBrewing); 146 public static Item magmaCream = (new Item(122)).setIconCoord(13, 10).setItemName("magmaCream").setPotionEffect(PotionHelper.magmaCreamEffect).setCreativeTab(CreativeTabs.tabBrewing); 147 public static Item brewingStand = (new ItemReed(123, Block.brewingStand)).setIconCoord(12, 10).setItemName("brewingStand").setCreativeTab(CreativeTabs.tabBrewing); 148 public static Item cauldron = (new ItemReed(124, Block.cauldron)).setIconCoord(12, 9).setItemName("cauldron").setCreativeTab(CreativeTabs.tabBrewing); 149 public static Item eyeOfEnder = (new ItemEnderEye(125)).setIconCoord(11, 9).setItemName("eyeOfEnder"); 150 public static Item speckledMelon = (new Item(126)).setIconCoord(9, 8).setItemName("speckledMelon").setPotionEffect(PotionHelper.speckledMelonEffect).setCreativeTab(CreativeTabs.tabBrewing); 151 public static Item monsterPlacer = (new ItemMonsterPlacer(127)).setIconCoord(9, 9).setItemName("monsterPlacer"); 152 153 /** 154 * Bottle o' Enchanting. Drops between 1 and 3 experience orbs when thrown. 155 */ 156 public static Item expBottle = (new ItemExpBottle(128)).setIconCoord(11, 10).setItemName("expBottle"); 157 158 /** 159 * Fire Charge. When used in a dispenser it fires a fireball similiar to a Ghast's. 160 */ 161 public static Item fireballCharge = (new ItemFireball(129)).setIconCoord(14, 2).setItemName("fireball"); 162 public static Item writableBook = (new ItemWritableBook(130)).setIconCoord(11, 11).setItemName("writingBook").setCreativeTab(CreativeTabs.tabMisc); 163 public static Item writtenBook = (new ItemEditableBook(131)).setIconCoord(12, 11).setItemName("writtenBook"); 164 public static Item emerald = (new Item(132)).setIconCoord(10, 11).setItemName("emerald").setCreativeTab(CreativeTabs.tabMaterials); 165 public static Item itemFrame = (new ItemHangingEntity(133, EntityItemFrame.class)).setIconCoord(14, 12).setItemName("frame"); 166 public static Item flowerPot = (new ItemReed(134, Block.flowerPot)).setIconCoord(13, 11).setItemName("flowerPot").setCreativeTab(CreativeTabs.tabDecorations); 167 public static Item carrot = (new ItemSeedFood(135, 4, 0.6F, Block.carrot.blockID, Block.tilledField.blockID)).setIconCoord(8, 7).setItemName("carrots"); 168 public static Item potato = (new ItemSeedFood(136, 1, 0.3F, Block.potato.blockID, Block.tilledField.blockID)).setIconCoord(7, 7).setItemName("potato"); 169 public static Item bakedPotato = (new ItemFood(137, 6, 0.6F, false)).setIconCoord(6, 7).setItemName("potatoBaked"); 170 public static Item poisonousPotato = (new ItemFood(138, 2, 0.3F, false)).setPotionEffect(Potion.poison.id, 5, 0, 0.6F).setIconCoord(6, 8).setItemName("potatoPoisonous"); 171 public static ItemEmptyMap emptyMap = (ItemEmptyMap)(new ItemEmptyMap(139)).setIconCoord(13, 12).setItemName("emptyMap"); 172 public static Item goldenCarrot = (new ItemFood(140, 6, 1.2F, false)).setIconCoord(6, 9).setItemName("carrotGolden").setPotionEffect(PotionHelper.field_82818_l); 173 public static Item skull = (new ItemSkull(141)).setItemName("skull"); 174 public static Item carrotOnAStick = (new ItemCarrotOnAStick(142)).setIconCoord(6, 6).setItemName("carrotOnAStick"); 175 public static Item netherStar = (new ItemSimpleFoiled(143)).setIconCoord(9, 11).setItemName("netherStar").setCreativeTab(CreativeTabs.tabMaterials); 176 public static Item pumpkinPie = (new ItemFood(144, 8, 0.3F, false)).setIconCoord(8, 9).setItemName("pumpkinPie").setCreativeTab(CreativeTabs.tabFood); 177 public static Item record13 = (new ItemRecord(2000, "13")).setIconCoord(0, 15).setItemName("record"); 178 public static Item recordCat = (new ItemRecord(2001, "cat")).setIconCoord(1, 15).setItemName("record"); 179 public static Item recordBlocks = (new ItemRecord(2002, "blocks")).setIconCoord(2, 15).setItemName("record"); 180 public static Item recordChirp = (new ItemRecord(2003, "chirp")).setIconCoord(3, 15).setItemName("record"); 181 public static Item recordFar = (new ItemRecord(2004, "far")).setIconCoord(4, 15).setItemName("record"); 182 public static Item recordMall = (new ItemRecord(2005, "mall")).setIconCoord(5, 15).setItemName("record"); 183 public static Item recordMellohi = (new ItemRecord(2006, "mellohi")).setIconCoord(6, 15).setItemName("record"); 184 public static Item recordStal = (new ItemRecord(2007, "stal")).setIconCoord(7, 15).setItemName("record"); 185 public static Item recordStrad = (new ItemRecord(2008, "strad")).setIconCoord(8, 15).setItemName("record"); 186 public static Item recordWard = (new ItemRecord(2009, "ward")).setIconCoord(9, 15).setItemName("record"); 187 public static Item record11 = (new ItemRecord(2010, "11")).setIconCoord(10, 15).setItemName("record"); 188 public static Item field_85180_cf = (new ItemRecord(2011, "wait")).setIconCoord(11, 15).setItemName("record"); 189 190 /** Item index + 256 */ 191 public final int shiftedIndex; 192 193 /** Maximum size of the stack. */ 194 protected int maxStackSize = 64; 195 196 /** Maximum damage an item can handle. */ 197 private int maxDamage = 0; 198 199 /** Icon index in the icons table. */ 200 protected int iconIndex; 201 202 /** If true, render the object in full 3D, like weapons and tools. */ 203 protected boolean bFull3D = false; 204 205 /** 206 * Some items (like dyes) have multiple subtypes on same item, this is field define this behavior 207 */ 208 protected boolean hasSubtypes = false; 209 private Item containerItem = null; 210 private String potionEffect = null; 211 212 /** full name of item from language file */ 213 private String itemName; 214 215 /** FORGE: To disable repair recipes. */ 216 protected boolean canRepair = true; 217 218 public Item(int par1) 219 { 220 this.shiftedIndex = 256 + par1; 221 222 if (itemsList[256 + par1] != null) 223 { 224 System.out.println("CONFLICT @ " + par1 + " item slot already occupied by " + itemsList[256 + par1] + " while adding " + this); 225 } 226 227 itemsList[256 + par1] = this; 228 GameData.newItemAdded(this); 229 230 if (!(this instanceof ItemBlock)) 231 { 232 isDefaultTexture = "/gui/items.png".equals(getTextureFile()); 233 } 234 } 235 236 /** 237 * Sets the icon index for this item. Returns the item. 238 */ 239 public Item setIconIndex(int par1) 240 { 241 this.iconIndex = par1; 242 return this; 243 } 244 245 public Item setMaxStackSize(int par1) 246 { 247 this.maxStackSize = par1; 248 return this; 249 } 250 251 public Item setIconCoord(int par1, int par2) 252 { 253 this.iconIndex = par1 + par2 * 16; 254 return this; 255 } 256 257 @SideOnly(Side.CLIENT) 258 259 /** 260 * Gets an icon index based on an item's damage value 261 */ 262 public int getIconFromDamage(int par1) 263 { 264 return this.iconIndex; 265 } 266 267 @SideOnly(Side.CLIENT) 268 269 /** 270 * Returns the icon index of the stack given as argument. 271 */ 272 public final int getIconIndex(ItemStack par1ItemStack) 273 { 274 return this.getIconFromDamage(par1ItemStack.getItemDamage()); 275 } 276 277 /** 278 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return 279 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS 280 */ 281 public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) 282 { 283 return false; 284 } 285 286 /** 287 * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if 288 * sword 289 */ 290 public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) 291 { 292 return 1.0F; 293 } 294 295 /** 296 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer 297 */ 298 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) 299 { 300 return par1ItemStack; 301 } 302 303 public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) 304 { 305 return par1ItemStack; 306 } 307 308 /** 309 * Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?* 310 */ 311 public int getItemStackLimit() 312 { 313 return this.maxStackSize; 314 } 315 316 /** 317 * Returns the metadata of the block which this Item (ItemBlock) can place 318 */ 319 public int getMetadata(int par1) 320 { 321 return 0; 322 } 323 324 public boolean getHasSubtypes() 325 { 326 return this.hasSubtypes; 327 } 328 329 protected Item setHasSubtypes(boolean par1) 330 { 331 this.hasSubtypes = par1; 332 return this; 333 } 334 335 /** 336 * Returns the maximum damage an item can take. 337 */ 338 public int getMaxDamage() 339 { 340 return this.maxDamage; 341 } 342 343 /** 344 * set max damage of an Item 345 */ 346 public Item setMaxDamage(int par1) 347 { 348 this.maxDamage = par1; 349 return this; 350 } 351 352 public boolean isDamageable() 353 { 354 return this.maxDamage > 0 && !this.hasSubtypes; 355 } 356 357 /** 358 * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise 359 * the damage on the stack. 360 */ 361 public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) 362 { 363 return false; 364 } 365 366 public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving) 367 { 368 return false; 369 } 370 371 /** 372 * Returns the damage against a given entity. 373 */ 374 public int getDamageVsEntity(Entity par1Entity) 375 { 376 return 1; 377 } 378 379 /** 380 * Returns if the item (tool) can harvest results from the block type. 381 */ 382 public boolean canHarvestBlock(Block par1Block) 383 { 384 return false; 385 } 386 387 /** 388 * dye sheep, place saddles, etc ... 389 */ 390 public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving) 391 { 392 return false; 393 } 394 395 /** 396 * Sets bFull3D to True and return the object. 397 */ 398 public Item setFull3D() 399 { 400 this.bFull3D = true; 401 return this; 402 } 403 404 @SideOnly(Side.CLIENT) 405 406 /** 407 * Returns True is the item is renderer in full 3D when hold. 408 */ 409 public boolean isFull3D() 410 { 411 return this.bFull3D; 412 } 413 414 @SideOnly(Side.CLIENT) 415 416 /** 417 * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities 418 * hands. 419 */ 420 public boolean shouldRotateAroundWhenRendering() 421 { 422 return false; 423 } 424 425 /** 426 * set name of item from language file 427 */ 428 public Item setItemName(String par1Str) 429 { 430 this.itemName = "item." + par1Str; 431 return this; 432 } 433 434 public String getLocalItemName(ItemStack par1ItemStack) 435 { 436 String var2 = this.getItemNameIS(par1ItemStack); 437 return var2 == null ? "" : StatCollector.translateToLocal(var2); 438 } 439 440 public String getItemName() 441 { 442 return this.itemName; 443 } 444 445 public String getItemNameIS(ItemStack par1ItemStack) 446 { 447 return this.itemName; 448 } 449 450 public Item setContainerItem(Item par1Item) 451 { 452 this.containerItem = par1Item; 453 return this; 454 } 455 456 /** 457 * If this returns true, after a recipe involving this item is crafted the container item will be added to the 458 * player's inventory instead of remaining in the crafting grid. 459 */ 460 public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) 461 { 462 return true; 463 } 464 465 /** 466 * If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client. 467 */ 468 public boolean getShareTag() 469 { 470 return true; 471 } 472 473 public Item getContainerItem() 474 { 475 return this.containerItem; 476 } 477 478 /** 479 * True if this Item has a container item (a.k.a. crafting result) 480 */ 481 public boolean hasContainerItem() 482 { 483 return this.containerItem != null; 484 } 485 486 public String getStatName() 487 { 488 return StatCollector.translateToLocal(this.getItemName() + ".name"); 489 } 490 491 public String func_77653_i(ItemStack par1ItemStack) 492 { 493 return StatCollector.translateToLocal(this.getItemNameIS(par1ItemStack) + ".name"); 494 } 495 496 @SideOnly(Side.CLIENT) 497 public int getColorFromItemStack(ItemStack par1ItemStack, int par2) 498 { 499 return 16777215; 500 } 501 502 /** 503 * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and 504 * update it's contents. 505 */ 506 public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {} 507 508 /** 509 * Called when item is crafted/smelted. Used only by maps so far. 510 */ 511 public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {} 512 513 /** 514 * false for all Items except sub-classes of ItemMapBase 515 */ 516 public boolean isMap() 517 { 518 return false; 519 } 520 521 /** 522 * returns the action that specifies what animation to play when the items is being used 523 */ 524 public EnumAction getItemUseAction(ItemStack par1ItemStack) 525 { 526 return EnumAction.none; 527 } 528 529 /** 530 * How long it takes to use or consume an item 531 */ 532 public int getMaxItemUseDuration(ItemStack par1ItemStack) 533 { 534 return 0; 535 } 536 537 /** 538 * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount 539 */ 540 public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) {} 541 542 /** 543 * Sets the string representing this item's effect on a potion when used as an ingredient. 544 */ 545 protected Item setPotionEffect(String par1Str) 546 { 547 this.potionEffect = par1Str; 548 return this; 549 } 550 551 /** 552 * Returns a string representing what this item does to a potion. 553 */ 554 public String getPotionEffect() 555 { 556 return this.potionEffect; 557 } 558 559 /** 560 * Returns true if this item serves as a potion ingredient (its ingredient information is not null). 561 */ 562 public boolean isPotionIngredient() 563 { 564 return this.potionEffect != null; 565 } 566 567 @SideOnly(Side.CLIENT) 568 569 /** 570 * allows items to add custom lines of information to the mouseover description 571 */ 572 public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {} 573 574 public String getItemDisplayName(ItemStack par1ItemStack) 575 { 576 return ("" + StringTranslate.getInstance().translateNamedKey(this.getLocalItemName(par1ItemStack))).trim(); 577 } 578 579 @SideOnly(Side.CLIENT) 580 public boolean hasEffect(ItemStack par1ItemStack) 581 { 582 return par1ItemStack.isItemEnchanted(); 583 } 584 585 @SideOnly(Side.CLIENT) 586 587 /** 588 * Return an item rarity from EnumRarity 589 */ 590 public EnumRarity getRarity(ItemStack par1ItemStack) 591 { 592 return par1ItemStack.isItemEnchanted() ? EnumRarity.rare : EnumRarity.common; 593 } 594 595 /** 596 * Checks isDamagable and if it cannot be stacked 597 */ 598 public boolean isItemTool(ItemStack par1ItemStack) 599 { 600 return this.getItemStackLimit() == 1 && this.isDamageable(); 601 } 602 603 protected MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3) 604 { 605 float var4 = 1.0F; 606 float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4; 607 float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4; 608 double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)var4; 609 double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double)var4 + 1.62D - (double)par2EntityPlayer.yOffset; 610 double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)var4; 611 Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11); 612 float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI); 613 float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI); 614 float var16 = -MathHelper.cos(-var5 * 0.017453292F); 615 float var17 = MathHelper.sin(-var5 * 0.017453292F); 616 float var18 = var15 * var16; 617 float var20 = var14 * var16; 618 double var21 = 5.0D; 619 if (par2EntityPlayer instanceof EntityPlayerMP) 620 { 621 var21 = ((EntityPlayerMP)par2EntityPlayer).theItemInWorldManager.getBlockReachDistance(); 622 } 623 Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21); 624 return par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3); 625 } 626 627 /** 628 * Return the enchantability factor of the item, most of the time is based on material. 629 */ 630 public int getItemEnchantability() 631 { 632 return 0; 633 } 634 635 @SideOnly(Side.CLIENT) 636 public boolean requiresMultipleRenderPasses() 637 { 638 return false; 639 } 640 641 @SideOnly(Side.CLIENT) 642 643 /** 644 * Gets an icon index based on an item's damage value and the given render pass 645 */ 646 public int getIconFromDamageForRenderPass(int par1, int par2) 647 { 648 return this.getIconFromDamage(par1); 649 } 650 651 @SideOnly(Side.CLIENT) 652 653 /** 654 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) 655 */ 656 public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) 657 { 658 par3List.add(new ItemStack(par1, 1, 0)); 659 } 660 661 /** 662 * returns this; 663 */ 664 public Item setCreativeTab(CreativeTabs par1CreativeTabs) 665 { 666 this.tabToDisplayOn = par1CreativeTabs; 667 return this; 668 } 669 670 @SideOnly(Side.CLIENT) 671 672 /** 673 * gets the CreativeTab this item is displayed on 674 */ 675 public CreativeTabs getCreativeTab() 676 { 677 return this.tabToDisplayOn; 678 } 679 680 public boolean func_82788_x() 681 { 682 return true; 683 } 684 685 /** 686 * Return whether this item is repairable in an anvil. 687 */ 688 public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) 689 { 690 return false; 691 } 692 693 static 694 { 695 StatList.initStats(); 696 } 697 698 /* =========================================================== FORGE START ===============================================================*/ 699 public boolean isDefaultTexture = true; 700 private String currentTexture = "/gui/items.png"; 701 702 /** 703 * Called when a player drops the item into the world, 704 * returning false from this will prevent the item from 705 * being removed from the players inventory and spawning 706 * in the world 707 * 708 * @param player The player that dropped the item 709 * @param item The item stack, before the item is removed. 710 */ 711 public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) 712 { 713 return true; 714 } 715 716 /** 717 * This is called when the item is used, before the block is activated. 718 * @param stack The Item Stack 719 * @param player The Player that used the item 720 * @param world The Current World 721 * @param x Target X Position 722 * @param y Target Y Position 723 * @param z Target Z Position 724 * @param side The side of the target hit 725 * @return Return true to prevent any further processing. 726 */ 727 public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) 728 { 729 return onItemUseFirst(stack, player, world, x, y, z, side); 730 } 731 732 /** 733 * See onItemUseFirst above, this is deprecated in favor of the more aware version. 734 * Only here for compaibility. 735 */ 736 @Deprecated 737 public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side) 738 { 739 return false; 740 } 741 742 /** 743 * Metadata-sensitive version of getStrVsBlock 744 * @param itemstack The Item Stack 745 * @param block The block the item is trying to break 746 * @param metadata The items current metadata 747 * @return The damage strength 748 */ 749 public float getStrVsBlock(ItemStack itemstack, Block block, int metadata) 750 { 751 return getStrVsBlock(itemstack, block); 752 } 753 754 /** 755 * Called by CraftingManager to determine if an item is reparable. 756 * @return True if reparable 757 */ 758 public boolean isRepairable() 759 { 760 return canRepair && isDamageable(); 761 } 762 763 /** 764 * Call to disable repair recipes. 765 * @return The current Item instance 766 */ 767 public Item setNoRepair() 768 { 769 canRepair = false; 770 return this; 771 } 772 773 /** 774 * Called before a block is broken. Return true to prevent default block harvesting. 775 * 776 * Note: In SMP, this is called on both client and server sides! 777 * 778 * @param itemstack The current ItemStack 779 * @param X The X Position 780 * @param Y The X Position 781 * @param Z The X Position 782 * @param player The Player that is wielding the item 783 * @return True to prevent harvesting, false to continue as normal 784 */ 785 public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) 786 { 787 return false; 788 } 789 790 /** 791 * Called each tick while using an item. 792 * @param stack The Item being used 793 * @param player The Player using the item 794 * @param count The amount of time in tick the item has been used for continuously 795 */ 796 public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count) 797 { 798 } 799 800 /** 801 * Called when the player Left Clicks (attacks) an entity. 802 * Processed before damage is done, if return value is true further processing is canceled 803 * and the entity is not attacked. 804 * 805 * @param stack The Item being used 806 * @param player The player that is attacking 807 * @param entity The entity being attacked 808 * @return True to cancel the rest of the interaction. 809 */ 810 public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) 811 { 812 return false; 813 } 814 815 /** 816 * Player, Render pass, and item usage sensitive version of getIconIndex. 817 * 818 * @param stack The item stack to get the icon for. (Usually this, and usingItem will be the same if usingItem is not null) 819 * @param renderPass The pass to get the icon for, 0 is default. 820 * @param player The player holding the item 821 * @param usingItem The item the player is actively using. Can be null if not using anything. 822 * @param useRemaining The ticks remaining for the active item. 823 * @return The icon index 824 */ 825 public int getIconIndex(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) 826 { 827 /* 828 * Here is an example usage for Vanilla bows. 829 if (usingItem != null && usingItem.getItem().shiftedIndex == Item.bow.shiftedIndex) 830 { 831 int k = usingItem.getMaxItemUseDuration() - useRemaining; 832 if (k >= 18) return 133; 833 if (k > 13) return 117; 834 if (k > 0) return 101; 835 } 836 */ 837 return getIconIndex(stack); 838 } 839 840 /** 841 * Returns the number of render passes/layers this item has. 842 * Usually equates to ItemRenderer.renderItem being called for this many passes. 843 * Does not get called unless requiresMultipleRenderPasses() is true; 844 * 845 * @param metadata The item's metadata 846 * @return The number of passes to run. 847 */ 848 public int getRenderPasses(int metadata) 849 { 850 return requiresMultipleRenderPasses() ? 2 : 1; 851 } 852 853 /** 854 * Grabs the current texture file used for this block 855 */ 856 public String getTextureFile() 857 { 858 if (this instanceof ItemBlock) 859 { 860 return Block.blocksList[((ItemBlock)this).getBlockID()].getTextureFile(); 861 } 862 return currentTexture; 863 } 864 865 /** 866 * Sets the current texture file for this item, used when rendering. 867 * Default is "/gui/items.png" 868 * 869 * @param texture The texture file 870 */ 871 public Item setTextureFile(String texture) 872 { 873 currentTexture = texture; 874 isDefaultTexture = false; 875 return this; 876 } 877 878 /** 879 * ItemStack sensitive version of getContainerItem. 880 * Returns a full ItemStack instance of the result. 881 * 882 * @param itemStack The current ItemStack 883 * @return The resulting ItemStack 884 */ 885 public ItemStack getContainerItemStack(ItemStack itemStack) 886 { 887 if (!hasContainerItem()) 888 { 889 return null; 890 } 891 return new ItemStack(getContainerItem()); 892 } 893 894 /** 895 * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. 896 * This is in ticks, standard result is 6000, or 5 mins. 897 * 898 * @param itemStack The current ItemStack 899 * @param world The world the entity is in 900 * @return The normal lifespan in ticks. 901 */ 902 public int getEntityLifespan(ItemStack itemStack, World world) 903 { 904 return 6000; 905 } 906 907 /** 908 * Determines if this Item has a special entity for when they are in the world. 909 * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity 910 * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. 911 * 912 * @param stack The current item stack 913 * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called 914 */ 915 public boolean hasCustomEntity(ItemStack stack) 916 { 917 return false; 918 } 919 920 /** 921 * This function should return a new entity to replace the dropped item. 922 * Returning null here will not kill the EntityItem and will leave it to function normally. 923 * Called when the item it placed in a world. 924 * 925 * @param world The world object 926 * @param location The EntityItem object, useful for getting the position of the entity 927 * @param itemstack The current item stack 928 * @return A new Entity object to spawn or null 929 */ 930 public Entity createEntity(World world, Entity location, ItemStack itemstack) 931 { 932 return null; 933 } 934 935 /** 936 * Gets a list of tabs that items belonging to this class can display on, 937 * combined properly with getSubItems allows for a single item to span 938 * many sub-items across many tabs. 939 * 940 * @return A list of all tabs that this item could possibly be one. 941 */ 942 public CreativeTabs[] getCreativeTabs() 943 { 944 return new CreativeTabs[]{ getCreativeTab() }; 945 } 946 947 /** 948 * Determines the base experience for a player when they remove this item from a furnace slot. 949 * This number must be between 0 and 1 for it to be valid. 950 * This number will be multiplied by the stack size to get the total experience. 951 * 952 * @param item The item stack the player is picking up. 953 * @return The amount to award for each item. 954 */ 955 public float getSmeltingExperience(ItemStack item) 956 { 957 return -1; //-1 will default to the old lookups. 958 } 959 960 /** 961 * Return the correct icon for rendering based on the supplied ItemStack and render pass. 962 * 963 * Defers to {@link #getIconFromDamageForRenderPass(int, int)} 964 * @param stack to render for 965 * @param pass the multi-render pass 966 * @return the icon index 967 */ 968 public int getIconFromItemStackForMultiplePasses(ItemStack stack, int pass) 969 { 970 return getIconFromDamageForRenderPass(stack.getItemDamage(), pass); 971 } 972 }