    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.client.renderer.texture.IconRegister;
    008import net.minecraft.creativetab.CreativeTabs;
    009import net.minecraft.item.ItemStack;
    010import net.minecraft.util.Icon;
    011
    012public class BlockCloth extends Block
    013{
    014    @SideOnly(Side.CLIENT)
    015    private Icon[] field_94349_a;
    016
    017    public BlockCloth()
    018    {
    019        super(35, Material.cloth);
    020        this.setCreativeTab(CreativeTabs.tabBlock);
    021    }
    022
    023    @SideOnly(Side.CLIENT)
    024
    025    /**
    026     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    027     */
    028    public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
    029    {
    030        return this.field_94349_a[par2];
    031    }
    032
    033    /**
    034     * Determines the damage on the item the block drops. Used in cloth and wood.
    035     */
    036    public int damageDropped(int par1)
    037    {
    038        return par1;
    039    }
    040
    041    /**
    042     * Takes a dye damage value and returns the block damage value to match
    043     */
    044    public static int getBlockFromDye(int par0)
    045    {
    046        return ~par0 & 15;
    047    }
    048
    049    /**
    050     * Takes a block damage value and returns the dye damage value to match
    051     */
    052    public static int getDyeFromBlock(int par0)
    053    {
    054        return ~par0 & 15;
    055    }
    056
    057    @SideOnly(Side.CLIENT)
    058
    059    /**
    060     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
    061     */
    062    public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
    063    {
    064        for (int j = 0; j < 16; ++j)
    065        {
    066            par3List.add(new ItemStack(par1, 1, j));
    067        }
    068    }
    069
    070    @SideOnly(Side.CLIENT)
    071    public void func_94332_a(IconRegister par1IconRegister)
    072    {
    073        this.field_94349_a = new Icon[16];
    074
    075        for (int i = 0; i < this.field_94349_a.length; ++i)
    076        {
    077            this.field_94349_a[i] = par1IconRegister.func_94245_a("cloth_" + i);
    078        }
    079    }
    080}