    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.item.ItemStack;
    008import net.minecraft.util.Icon;
    009import net.minecraft.world.World;
    010
    011public class BlockPotato extends BlockCrops
    012{
    013    @SideOnly(Side.CLIENT)
    014    private Icon[] field_94365_a;
    015
    016    public BlockPotato(int par1)
    017    {
    018        super(par1);
    019    }
    020
    021    @SideOnly(Side.CLIENT)
    022
    023    /**
    024     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    025     */
    026    public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
    027    {
    028        if (par2 < 7)
    029        {
    030            if (par2 == 6)
    031            {
    032                par2 = 5;
    033            }
    034
    035            return this.field_94365_a[par2 >> 1];
    036        }
    037        else
    038        {
    039            return this.field_94365_a[3];
    040        }
    041    }
    042
    043    /**
    044     * Generate a seed ItemStack for this crop.
    045     */
    046    protected int getSeedItem()
    047    {
    048        return Item.potato.itemID;
    049    }
    050
    051    /**
    052     * Generate a crop produce ItemStack for this crop.
    053     */
    054    protected int getCropItem()
    055    {
    056        return Item.potato.itemID;
    057    }
    058
    059    /**
    060     * Drops the block items with a specified chance of dropping the specified items
    061     */
    062    public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
    063    {
    064        super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
    065
    066        if (!par1World.isRemote)
    067        {
    068            if (par5 >= 7 && par1World.rand.nextInt(50) == 0)
    069            {
    070                this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.poisonousPotato));
    071            }
    072        }
    073    }
    074
    075    @SideOnly(Side.CLIENT)
    076    public void func_94332_a(IconRegister par1IconRegister)
    077    {
    078        this.field_94365_a = new Icon[4];
    079
    080        for (int i = 0; i < this.field_94365_a.length; ++i)
    081        {
    082            this.field_94365_a[i] = par1IconRegister.func_94245_a("potatoes_" + i);
    083        }
    084    }
    085}