    001package net.minecraft.block;
    002
    003import java.util.Random;
    004import net.minecraft.block.material.Material;
    005import net.minecraft.creativetab.CreativeTabs;
    006import net.minecraft.item.Item;
    007
    008public class BlockMelon extends Block
    009{
    010    protected BlockMelon(int par1)
    011    {
    012        super(par1, Material.pumpkin);
    013        this.blockIndexInTexture = 136;
    014        this.setCreativeTab(CreativeTabs.tabBlock);
    015    }
    016
    017    /**
    018     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    019     */
    020    public int getBlockTextureFromSideAndMetadata(int par1, int par2)
    021    {
    022        return par1 != 1 && par1 != 0 ? 136 : 137;
    023    }
    024
    025    /**
    026     * Returns the block texture based on the side being looked at.  Args: side
    027     */
    028    public int getBlockTextureFromSide(int par1)
    029    {
    030        return par1 != 1 && par1 != 0 ? 136 : 137;
    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 var3 = this.quantityDropped(par2Random) + par2Random.nextInt(1 + par1);
    055
    056        if (var3 > 9)
    057        {
    058            var3 = 9;
    059        }
    060
    061        return var3;
    062    }
    063}