    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 getColorFromItemStack(ItemStack par1ItemStack, int par2)
    035        {
    036            int var3 = par1ItemStack.getItemDamage();
    037            return (var3 & 1) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((var3 & 2) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic());
    038        }
    039
    040        public String getItemNameIS(ItemStack par1ItemStack)
    041        {
    042            int var2 = par1ItemStack.getItemDamage();
    043
    044            if (var2 < 0 || var2 >= BlockLeaves.LEAF_TYPES.length)
    045            {
    046                var2 = 0;
    047            }
    048
    049            return super.getItemName() + "." + BlockLeaves.LEAF_TYPES[var2];
    050        }
    051    }