    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.util.Icon;
    007
    008public class ItemMultiTextureTile extends ItemBlock
    009{
    010    private final Block theBlock;
    011    private final String[] field_82804_b;
    012
    013    public ItemMultiTextureTile(int par1, Block par2Block, String[] par3ArrayOfStr)
    014    {
    015        super(par1);
    016        this.theBlock = par2Block;
    017        this.field_82804_b = par3ArrayOfStr;
    018        this.setMaxDamage(0);
    019        this.setHasSubtypes(true);
    020    }
    021
    022    @SideOnly(Side.CLIENT)
    023
    024    /**
    025     * Gets an icon index based on an item's damage value
    026     */
    027    public Icon getIconFromDamage(int par1)
    028    {
    029        return this.theBlock.getIcon(2, par1);
    030    }
    031
    032    /**
    033     * Returns the metadata of the block which this Item (ItemBlock) can place
    034     */
    035    public int getMetadata(int par1)
    036    {
    037        return par1;
    038    }
    039
    040    /**
    041     * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
    042     * different names based on their damage or NBT.
    043     */
    044    public String getUnlocalizedName(ItemStack par1ItemStack)
    045    {
    046        int i = par1ItemStack.getItemDamage();
    047
    048        if (i < 0 || i >= this.field_82804_b.length)
    049        {
    050            i = 0;
    051        }
    052
    053        return super.getUnlocalizedName() + "." + this.field_82804_b[i];
    054    }
    055}