    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.util.List;
    006
    007    public class BlockCloth extends Block
    008    {
    009        public BlockCloth()
    010        {
    011            super(35, 64, Material.cloth);
    012            this.setCreativeTab(CreativeTabs.tabBlock);
    013        }
    014
    015        /**
    016         * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    017         */
    018        public int getBlockTextureFromSideAndMetadata(int par1, int par2)
    019        {
    020            if (par2 == 0)
    021            {
    022                return this.blockIndexInTexture;
    023            }
    024            else
    025            {
    026                par2 = ~(par2 & 15);
    027                return 113 + ((par2 & 8) >> 3) + (par2 & 7) * 16;
    028            }
    029        }
    030
    031        /**
    032         * Determines the damage on the item the block drops. Used in cloth and wood.
    033         */
    034        protected int damageDropped(int par1)
    035        {
    036            return par1;
    037        }
    038
    039        /**
    040         * Takes a dye damage value and returns the block damage value to match
    041         */
    042        public static int getBlockFromDye(int par0)
    043        {
    044            return ~par0 & 15;
    045        }
    046
    047        /**
    048         * Takes a block damage value and returns the dye damage value to match
    049         */
    050        public static int getDyeFromBlock(int par0)
    051        {
    052            return ~par0 & 15;
    053        }
    054
    055        @SideOnly(Side.CLIENT)
    056
    057        /**
    058         * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
    059         */
    060        public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
    061        {
    062            for (int var4 = 0; var4 < 16; ++var4)
    063            {
    064                par3List.add(new ItemStack(par1, 1, var4));
    065            }
    066        }
    067    }