001 package net.minecraft.src; 002 003 public class ItemSeeds extends Item 004 { 005 /** 006 * The type of block this seed turns into (wheat or pumpkin stems for instance) 007 */ 008 private int blockType; 009 010 /** BlockID of the block the seeds can be planted on. */ 011 private int soilBlockID; 012 013 public ItemSeeds(int par1, int par2, int par3) 014 { 015 super(par1); 016 this.blockType = par2; 017 this.soilBlockID = par3; 018 this.setTabToDisplayOn(CreativeTabs.tabMaterials); 019 } 020 021 public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) 022 { 023 if (par7 != 1) 024 { 025 return false; 026 } 027 else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6)) 028 { 029 int var11 = par3World.getBlockId(par4, par5, par6); 030 031 if (var11 == this.soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6)) 032 { 033 par3World.setBlockWithNotify(par4, par5 + 1, par6, this.blockType); 034 --par1ItemStack.stackSize; 035 return true; 036 } 037 else 038 { 039 return false; 040 } 041 } 042 else 043 { 044 return false; 045 } 046 } 047 }