001 package net.minecraft.src; 002 003 import cpw.mods.fml.common.Side; 004 import cpw.mods.fml.common.asm.SideOnly; 005 006 public class ItemWood extends ItemBlock 007 { 008 /** The instance of Block. */ 009 private Block theWoodBlock; 010 011 public ItemWood(int par1, Block par2Block) 012 { 013 super(par1); 014 this.theWoodBlock = par2Block; 015 this.setMaxDamage(0); 016 this.setHasSubtypes(true); 017 } 018 019 @SideOnly(Side.CLIENT) 020 021 /** 022 * Gets an icon index based on an item's damage value 023 */ 024 public int getIconFromDamage(int par1) 025 { 026 return this.theWoodBlock.getBlockTextureFromSideAndMetadata(2, par1); 027 } 028 029 /** 030 * Returns the metadata of the block which this Item (ItemBlock) can place 031 */ 032 public int getMetadata(int par1) 033 { 034 return par1; 035 } 036 037 public String getItemNameIS(ItemStack par1ItemStack) 038 { 039 int var2 = par1ItemStack.getItemDamage(); 040 041 if (var2 < 0 || var2 >= BlockWood.woodType.length) 042 { 043 var2 = 0; 044 } 045 046 return super.getItemName() + "." + BlockWood.woodType[var2]; 047 } 048 }