Where is ChangeBlockEvent.Break in sponge 8.0 ?๋

Where is event list of this in sponge 8.0 ?
List of Event

  • ChangeBlockEvent.Break
  • ChangeBlockEvent.Modify
  • ChangeBlockEvent.Place

Please help me.

So all of what you want now come under one single event of ChangeBlockEvent.All with the separating factor being the Operation. (There is also changeBlockEvent post and pre but they dont have the transaction method. Instead post having the results of what happened, or pre having the affecting locations)

This was changed due to some scenarios whereby you place a torch under sand. The sand breaks but the torch was placed.

https://jd.spongepowered.org/spongeapi/8.0.0/org/spongepowered/api/event/block/ChangeBlockEvent.All.html

1 Like

Thank for you care!

Could you please send me an example code to check that event is from break or place ?

Sure thing.

public void onBlockPlacement(ChangeBlockEvent.All event){
    Stream<BlockTransaction> allBlocksPlaced = event.transactions​(Operations.PLACE);
}
public void onBlockBreak(ChangeBlockEvent.All event){
    Stream<BlockTransaction> allBlocksBroken = event.transactions​(Operations.BREAK);
}
1 Like

Thank for you care!