Skip to content

Commit

Permalink
Fix ExplosionEvent.Pre cancelling
Browse files Browse the repository at this point in the history
  • Loading branch information
aromaa committed Dec 22, 2024
1 parent 4b7c7e8 commit e5e0121
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,14 @@ public abstract class ServerLevelMixin_Tracker extends LevelMixin_Tracker implem
this.tracker$apiExplosion = apiExplosion;
}

@Inject(method = "explode", cancellable = true, at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/level/ServerExplosion;explode()V", shift = At.Shift.AFTER))
private void tracker$onCancelled(final CallbackInfo ci) {
if (this.tracker$apiExplosion == null) {
ci.cancel();
}
}

/**
* See {@link net.minecraft.client.multiplayer.ClientPacketListener#handleExplosion} for client side handling
*/
Expand Down

0 comments on commit e5e0121

Please sign in to comment.