Hi all,
I seach how to get the break block when a player break blocks. I want to prevent the player from being able to break the glass but he can break the other blocks (it depends on the game state). I use Flan’s mod, and the ammunition of their weapons can break glass (that’s cool but …). I think the entity is a Sand block. So I want to prevent this entity from breaking the glass.
How can i prevent the break block of only one block (glass) by player (left click) and prevent the break block when the entity is a Sand block ?
@Listener
public void onBreak(ChangeBlockEvent.Break e) {
if(main.isState(State.BUILD) || main.isState(State.FIGHT)) {
//Prevent the break of block of glass
}
if(main.isState(State.WAIT) || main.isState(State.FINISH))
e.setCancelled(true);
}
Thank you for your answers.
maxou54200.