I created an item with metadata for 2 states. We'll call it "active" and "inactive". The item is just an item, not a food, or a tool. I need it so that when the item is used (read Left-Clicked) on a grass block, it changes from metadata 0 to 1, spawns lightning at the players position,kills the player, and shows a custom death message.
I've gotten the metadata to change by using this in the items class:
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
if(par1ItemStack.getItemDamage() == 0)
{
if(par2Block.blockID == 2)
{
this.setDamage(par1ItemStack, 1);
}
//ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Test mode: Bingo!");
}
return 1.0F;
}
This does change the item from inactive to active when hitting a grass block.
That's is about all the success I've had with it. I've gotten some of the other things to work, but none of them together. I've even been trying things in my event handler.
Any help would be appreciated.