aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0868-Add-BlockFace-to-BlockDamageEvent.patch
diff options
context:
space:
mode:
authorNewwind <[email protected]>2024-08-31 19:29:50 +0100
committerGitHub <[email protected]>2024-08-31 20:29:50 +0200
commit509ea2fd17fa03ce04f86046098607733b8767ba (patch)
tree3f7c9a29481fafbb6ad9f846839ec8f4863d2363 /patches/server/0868-Add-BlockFace-to-BlockDamageEvent.patch
parente01ddf46279fbb68d157749a906b7a2ecc60da1a (diff)
downloadPaper-509ea2fd17fa03ce04f86046098607733b8767ba.tar.gz
Paper-509ea2fd17fa03ce04f86046098607733b8767ba.zip
Fix horse armor desync (#11341)
Diffstat (limited to 'patches/server/0868-Add-BlockFace-to-BlockDamageEvent.patch')
-rw-r--r--patches/server/0868-Add-BlockFace-to-BlockDamageEvent.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/patches/server/0868-Add-BlockFace-to-BlockDamageEvent.patch b/patches/server/0868-Add-BlockFace-to-BlockDamageEvent.patch
new file mode 100644
index 0000000000..28fdbf6dc6
--- /dev/null
+++ b/patches/server/0868-Add-BlockFace-to-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] Add BlockFace to BlockDamageEvent
+
+
+diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+index c680f081ba548f84f07a968a46811090c53e57e3..d839f8df658c894f144ba4637d290ffbed77e132 100644
+--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
++++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+@@ -261,7 +261,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 - Add BlockFace to BlockDamageEvent
+
+ 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 50346dda83472bddc043f8e8c45f9131c2e5958c..d80587afa3d0c8c5a0dd8112bbb73bc56ac1722d 100644
+--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+@@ -661,13 +661,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 - Add BlockFace to BlockDamageEvent
+ 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 - Add BlockFace to BlockDamageEvent
+ player.getServer().getPluginManager().callEvent(event);
+
+ return event;