001 package net.minecraft.block; 002 003 import net.minecraft.item.Item; 004 import net.minecraft.item.ItemStack; 005 import net.minecraft.world.World; 006 007 public class BlockPotato extends BlockCrops 008 { 009 public BlockPotato(int par1) 010 { 011 super(par1, 200); 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 if (par2 < 7) 020 { 021 if (par2 == 6) 022 { 023 par2 = 5; 024 } 025 026 return this.blockIndexInTexture + (par2 >> 1); 027 } 028 else 029 { 030 return this.blockIndexInTexture + 4; 031 } 032 } 033 034 /** 035 * Generate a seed ItemStack for this crop. 036 */ 037 protected int getSeedItem() 038 { 039 return Item.potato.itemID; 040 } 041 042 /** 043 * Generate a crop produce ItemStack for this crop. 044 */ 045 protected int getCropItem() 046 { 047 return Item.potato.itemID; 048 } 049 050 /** 051 * Drops the block items with a specified chance of dropping the specified items 052 */ 053 public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) 054 { 055 super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); 056 057 if (!par1World.isRemote) 058 { 059 if (par5 >= 7 && par1World.rand.nextInt(50) == 0) 060 { 061 this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.poisonousPotato)); 062 } 063 } 064 } 065 }