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