Thanks first. I have the following function. I can only break blocks if I have the block in my hand. but if I don't have the block in my hand I can't break it but unfortunately I see the block particle when I hit it in creative. Can you please write me an example of how I might get this into this function?
@SubscribeEvent
public static void blockBreakEv(final BreakEvent event) {
final Block block = event.getState().getBlock();
if (block instanceof Inversiveblock) {
final EntityPlayer player = event.getPlayer();
final Item item = player.getHeldItemMainhand().getItem();
if (!(Block.getBlockFromItem(item) instanceof Inversiveblock)) {
event.setCanceled(true);
return;
}
}
}