I am trying to give a person an item if they right click on a block. I have this:
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
ItemStack heldItem = par5EntityPlayer.inventory.getCurrentItem();
ItemStack CDOrb = new ItemStack(MagicksMod.CDiamondOrb, 1);
if (heldItem == new ItemStack(MagicksMod.CDiamondOrb, 1)){
par5EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.diamond));
}
return false;
}
But it doesn't work. What am I doing wrong?
PS It doesn't have any error, it just doesn't do anything.