001 package net.minecraft.src;
002
003 public class BlockPotato extends BlockCrops
004 {
005 public BlockPotato(int par1)
006 {
007 super(par1, 200);
008 }
009
010 /**
011 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
012 */
013 public int getBlockTextureFromSideAndMetadata(int par1, int par2)
014 {
015 if (par2 < 7)
016 {
017 if (par2 == 6)
018 {
019 par2 = 5;
020 }
021
022 return this.blockIndexInTexture + (par2 >> 1);
023 }
024 else
025 {
026 return this.blockIndexInTexture + 4;
027 }
028 }
029
030 /**
031 * Generate a seed ItemStack for this crop.
032 */
033 protected int getSeedItem()
034 {
035 return Item.potatoe.shiftedIndex;
036 }
037
038 /**
039 * Generate a crop produce ItemStack for this crop.
040 */
041 protected int getCropItem()
042 {
043 return Item.potatoe.shiftedIndex;
044 }
045
046 /**
047 * Drops the block items with a specified chance of dropping the specified items
048 */
049 public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
050 {
051 super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
052
053 if (!par1World.isRemote)
054 {
055 if (par5 >= 7 && par1World.rand.nextInt(50) == 0)
056 {
057 this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.poisonousPotato));
058 }
059 }
060 }
061 }