From 453d93caa5c271375badb3b28b2a20b52c7e08aa Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 20 Jun 2021 08:48:15 +1000 Subject: [PATCH] SPIGOT-6586: EntityChangeBlockEvent for falling block does not cancel properly By: md_5 --- .../minecraft/world/entity/item/EntityFallingBlock.patch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/world/entity/item/EntityFallingBlock.patch b/paper-server/nms-patches/net/minecraft/world/entity/item/EntityFallingBlock.patch index f374d5db4a..673ecf6fa4 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/item/EntityFallingBlock.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/item/EntityFallingBlock.patch @@ -18,19 +18,20 @@ this.level.a(blockposition, false); } else if (!this.level.isClientSide) { this.die(); -@@ -165,6 +167,11 @@ +@@ -165,6 +167,12 @@ this.blockState = (IBlockData) this.blockState.set(BlockProperties.WATERLOGGED, true); } + // CraftBukkit start + if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.blockState).isCancelled()) { ++ this.die(); // SPIGOT-6586 called before the event in previous versions + return; + } + // CraftBukkit end if (this.level.setTypeAndData(blockposition, this.blockState, 3)) { ((WorldServer) this.level).getChunkProvider().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getType(blockposition))); this.die(); -@@ -238,7 +245,7 @@ +@@ -238,7 +246,7 @@ if (i < 0) { return false; } else { @@ -39,7 +40,7 @@ DamageSource damagesource1; if (this.blockState.getBlock() instanceof Fallable) { -@@ -254,7 +261,9 @@ +@@ -254,7 +262,9 @@ float f2 = (float) Math.min(MathHelper.d((float) i * this.fallDamagePerDistance), this.fallDamageMax); this.level.getEntities(this, this.getBoundingBox(), predicate).forEach((entity) -> {