001package net.minecraft.item; 002 003import cpw.mods.fml.relauncher.Side; 004import cpw.mods.fml.relauncher.SideOnly; 005import net.minecraft.block.Block; 006import net.minecraft.block.BlockCloth; 007import net.minecraft.util.Icon; 008 009public class ItemCloth extends ItemBlock 010{ 011 public ItemCloth(int par1) 012 { 013 super(par1); 014 this.setMaxDamage(0); 015 this.setHasSubtypes(true); 016 } 017 018 @SideOnly(Side.CLIENT) 019 020 /** 021 * Gets an icon index based on an item's damage value 022 */ 023 public Icon getIconFromDamage(int par1) 024 { 025 return Block.cloth.getIcon(2, BlockCloth.getBlockFromDye(par1)); 026 } 027 028 /** 029 * Returns the metadata of the block which this Item (ItemBlock) can place 030 */ 031 public int getMetadata(int par1) 032 { 033 return par1; 034 } 035 036 /** 037 * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have 038 * different names based on their damage or NBT. 039 */ 040 public String getUnlocalizedName(ItemStack par1ItemStack) 041 { 042 return super.getUnlocalizedName() + "." + ItemDye.dyeColorNames[BlockCloth.getBlockFromDye(par1ItemStack.getItemDamage())]; 043 } 044}