    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 ItemLeaves extends ItemBlock
    007    {
    008        public ItemLeaves(int par1)
    009        {
    010            super(par1);
    011            this.setMaxDamage(0);
    012            this.setHasSubtypes(true);
    013        }
    014
    015        /**
    016         * Returns the metadata of the block which this Item (ItemBlock) can place
    017         */
    018        public int getMetadata(int par1)
    019        {
    020            return par1 | 4;
    021        }
    022
    023        @SideOnly(Side.CLIENT)
    024
    025        /**
    026         * Gets an icon index based on an item's damage value
    027         */
    028        public int getIconFromDamage(int par1)
    029        {
    030            return Block.leaves.getBlockTextureFromSideAndMetadata(0, par1);
    031        }
    032
    033        @SideOnly(Side.CLIENT)
    034        public int getColorFromDamage(int par1, int par2)
    035        {
    036            return (par1 & 1) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 2) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic());
    037        }
    038
    039        public String getItemNameIS(ItemStack par1ItemStack)
    040        {
    041            int var2 = par1ItemStack.getItemDamage();
    042
    043            if (var2 < 0 || var2 >= BlockLeaves.LEAF_TYPES.length)
    044            {
    045                var2 = 0;
    046            }
    047
    048            return super.getItemName() + "." + BlockLeaves.LEAF_TYPES[var2];
    049        }
    050    }