diff options
Diffstat (limited to 'patches/server/0998-Expose-clicked-BlockFace-during-BlockDamageEvent.patch')
-rw-r--r-- | patches/server/0998-Expose-clicked-BlockFace-during-BlockDamageEvent.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/patches/server/0998-Expose-clicked-BlockFace-during-BlockDamageEvent.patch b/patches/server/0998-Expose-clicked-BlockFace-during-BlockDamageEvent.patch new file mode 100644 index 0000000000..4ab00d4010 --- /dev/null +++ b/patches/server/0998-Expose-clicked-BlockFace-during-BlockDamageEvent.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: aerulion <[email protected]> +Date: Mon, 21 Aug 2023 04:36:07 +0200 +Subject: [PATCH] Expose clicked BlockFace during BlockDamageEvent + + +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +index ee12ca53c7919d6d424c4306b90d25660eb14af6..cd57234a5f1131f48c9726f89262f253e61b9811 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +@@ -258,7 +258,7 @@ public class ServerPlayerGameMode { + } + return; + } +- org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, pos, this.player.getInventory().getSelected(), f >= 1.0f); ++ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, pos, direction, this.player.getInventory().getSelected(), f >= 1.0f); // Paper - Expose BlockFace + + if (blockEvent.isCancelled()) { + // Let the client know the block still exists +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index 3ac67ef07f574eacc09d8dc966800cb94caea3c6..975f4fe01ce0c3f98c4467927242558a66bc19f3 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -650,13 +650,13 @@ public class CraftEventFactory { + /** + * BlockDamageEvent + */ +- public static BlockDamageEvent callBlockDamageEvent(ServerPlayer who, BlockPos pos, ItemStack itemstack, boolean instaBreak) { ++ public static BlockDamageEvent callBlockDamageEvent(ServerPlayer who, BlockPos pos, Direction direction, ItemStack itemstack, boolean instaBreak) { // Paper - Expose BlockFace + Player player = who.getBukkitEntity(); + CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack); + + Block blockClicked = CraftBlock.at(who.level(), pos); + +- BlockDamageEvent event = new BlockDamageEvent(player, blockClicked, itemInHand, instaBreak); ++ BlockDamageEvent event = new BlockDamageEvent(player, blockClicked, CraftBlock.notchToBlockFace(direction), itemInHand, instaBreak); // Paper - Expose BlockFace + player.getServer().getPluginManager().callEvent(event); + + return event; |