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