001 package net.minecraft.src; 002 003 import java.util.Random; 004 005 public class BlockMelon extends Block 006 { 007 protected BlockMelon(int par1) 008 { 009 super(par1, Material.pumpkin); 010 this.blockIndexInTexture = 136; 011 this.setCreativeTab(CreativeTabs.tabBlock); 012 } 013 014 /** 015 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata 016 */ 017 public int getBlockTextureFromSideAndMetadata(int par1, int par2) 018 { 019 return par1 != 1 && par1 != 0 ? 136 : 137; 020 } 021 022 /** 023 * Returns the block texture based on the side being looked at. Args: side 024 */ 025 public int getBlockTextureFromSide(int par1) 026 { 027 return par1 != 1 && par1 != 0 ? 136 : 137; 028 } 029 030 /** 031 * Returns the ID of the items to drop on destruction. 032 */ 033 public int idDropped(int par1, Random par2Random, int par3) 034 { 035 return Item.melon.shiftedIndex; 036 } 037 038 /** 039 * Returns the quantity of items to drop on block destruction. 040 */ 041 public int quantityDropped(Random par1Random) 042 { 043 return 3 + par1Random.nextInt(5); 044 } 045 046 /** 047 * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive). 048 */ 049 public int quantityDroppedWithBonus(int par1, Random par2Random) 050 { 051 int var3 = this.quantityDropped(par2Random) + par2Random.nextInt(1 + par1); 052 053 if (var3 > 9) 054 { 055 var3 = 9; 056 } 057 058 return var3; 059 } 060 }