I think this should work:
package kaiKaii99Items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.UseHoeEvent;
public class SpecialItemHoe extends Item
{
protected EnumToolMaterial theToolMaterial;
public SpecialItemHoe(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1);
this.theToolMaterial = par2EnumToolMaterial;
this.maxStackSize = 1;
this.setMaxDamage(par2EnumToolMaterial.getMaxUses());
this.setCreativeTab(CreativeTabs.tabTools);
}
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
{
return false;
}
else
{
UseHoeEvent event = new UseHoeEvent(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6);
if (MinecraftForge.EVENT_BUS.post(event))
{
return false;
}
if (event.getResult() == Result.ALLOW)
{
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
int i1 = par3World.getBlockId(par4, par5, par6);
int i2 = par3World.getBlockId(par4+1, par5, par6);
int i3 = par3World.getBlockId(par4, par5, par6+1);
int i4 = par3World.getBlockId(par4+1, par5, par6+1);
int i5 = par3World.getBlockId(par4-1, par5, par6);
int i6 = par3World.getBlockId(par4, par5, par6-1);
int i7 = par3World.getBlockId(par4-1, par5, par6-1);
int i8 = par3World.getBlockId(par4-1, par5, par6+1);
int i9 = par3World.getBlockId(par4+1, par5, par6-1);
int j1 = par3World.getBlockId(par4, par5 + 1, par6);
if ((par7 == 0 || j1 != 0 || i1 != Block.grass.blockID) && i1 != Block.dirt.blockID && i2 != Block.dirt.blockID && i3 != Block.dirt.blockID && i4 != Block.dirt.blockID && i5 != Block.dirt.blockID && i6 != Block.dirt.blockID && i7 != Block.dirt.blockID && i8 != Block.dirt.blockID && i9 != Block.dirt.blockID)
{
return false;
}
else
{
Block block = Block.tilledField;
par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (par3World.isRemote)
{
return true;
}
else
{
par3World.setBlock(par4+1, par5, par6, block.blockID);
par3World.setBlock(par4, par5, par6+1, block.blockID);
par3World.setBlock(par4+1, par5, par6+1, block.blockID);
par3World.setBlock(par4-1, par5, par6, block.blockID);
par3World.setBlock(par4, par5, par6-1, block.blockID);
par3World.setBlock(par4-1, par5, par6-1, block.blockID);
par3World.setBlock(par4-1, par5, par6+1, block.blockID);
par3World.setBlock(par4+1, par5, par6-1, block.blockID);
par3World.setBlock(par4, par5, par6, block.blockID);
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
}
}
@SideOnly(Side.CLIENT)
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* Returns the name of the material this tool is made from as it is declared in EnumToolMaterial (meaning diamond
* would return "EMERALD")
*/
public String getMaterialName()
{
return this.theToolMaterial.toString();
}
}
just make an item that extens SpecialItemHoe and done