disappears when right clicked with only a certain item? I am trying to make a dungeon in my mod, that has different layers. However, i want them to only be accesible with a key from the previous layer, ie: rightclick the entrance, and the block disappears, but only if you have the item in your hand.
There is a method called: public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) in the block class, which gets fired when ever a player right clicks the block
player.inventory.getCurrentItem().getItem() gives you the item the player has currently in has hand, you can use this for your ifstatement
world.setBlock(x, y, z, Blocks.Air) should remove your block and put air in its place instead
I'm not at home right know so I hope I didn't missspell something
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.