    001package net.minecraft.block;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.client.renderer.texture.IconRegister;
    006import net.minecraft.item.Item;
    007import net.minecraft.util.Icon;
    008
    009public class BlockCarrot extends BlockCrops
    010{
    011    @SideOnly(Side.CLIENT)
    012    private Icon[] iconArray;
    013
    014    public BlockCarrot(int par1)
    015    {
    016        super(par1);
    017    }
    018
    019    @SideOnly(Side.CLIENT)
    020
    021    /**
    022     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    023     */
    024    public Icon getIcon(int par1, int par2)
    025    {
    026        if (par2 < 7)
    027        {
    028            if (par2 == 6)
    029            {
    030                par2 = 5;
    031            }
    032
    033            return this.iconArray[par2 >> 1];
    034        }
    035        else
    036        {
    037            return this.iconArray[3];
    038        }
    039    }
    040
    041    /**
    042     * Generate a seed ItemStack for this crop.
    043     */
    044    protected int getSeedItem()
    045    {
    046        return Item.carrot.itemID;
    047    }
    048
    049    /**
    050     * Generate a crop produce ItemStack for this crop.
    051     */
    052    protected int getCropItem()
    053    {
    054        return Item.carrot.itemID;
    055    }
    056
    057    @SideOnly(Side.CLIENT)
    058
    059    /**
    060     * When this method is called, your block should register all the icons it needs with the given IconRegister. This
    061     * is the only chance you get to register icons.
    062     */
    063    public void registerIcons(IconRegister par1IconRegister)
    064    {
    065        this.iconArray = new Icon[4];
    066
    067        for (int i = 0; i < this.iconArray.length; ++i)
    068        {
    069            this.iconArray[i] = par1IconRegister.registerIcon("carrots_" + i);
    070        }
    071    }
    072}