    001package net.minecraft.block;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import java.util.Random;
    006import net.minecraft.block.material.Material;
    007import net.minecraft.client.renderer.texture.IconRegister;
    008import net.minecraft.creativetab.CreativeTabs;
    009import net.minecraft.item.Item;
    010import net.minecraft.util.Icon;
    011
    012public class BlockMelon extends Block
    013{
    014    @SideOnly(Side.CLIENT)
    015    private Icon field_94423_a;
    016
    017    protected BlockMelon(int par1)
    018    {
    019        super(par1, Material.pumpkin);
    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 par1 != 1 && par1 != 0 ? this.field_94336_cN : this.field_94423_a;
    031    }
    032
    033    /**
    034     * Returns the ID of the items to drop on destruction.
    035     */
    036    public int idDropped(int par1, Random par2Random, int par3)
    037    {
    038        return Item.melon.itemID;
    039    }
    040
    041    /**
    042     * Returns the quantity of items to drop on block destruction.
    043     */
    044    public int quantityDropped(Random par1Random)
    045    {
    046        return 3 + par1Random.nextInt(5);
    047    }
    048
    049    /**
    050     * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
    051     */
    052    public int quantityDroppedWithBonus(int par1, Random par2Random)
    053    {
    054        int j = this.quantityDropped(par2Random) + par2Random.nextInt(1 + par1);
    055
    056        if (j > 9)
    057        {
    058            j = 9;
    059        }
    060
    061        return j;
    062    }
    063
    064    @SideOnly(Side.CLIENT)
    065    public void func_94332_a(IconRegister par1IconRegister)
    066    {
    067        this.field_94336_cN = par1IconRegister.func_94245_a("melon_side");
    068        this.field_94423_a = par1IconRegister.func_94245_a("melon_top");
    069    }
    070}