aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0872-Add-BlockFace-to-BlockDamageEvent.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-06-16 12:56:00 +0200
committerNassim Jahnke <[email protected]>2024-06-16 12:56:00 +0200
commitdc684c60d16f66ea84467ec8e253f2a36a17a7c8 (patch)
treee516f1bd4bfbdb37a5aeee42384aade111eca3e1 /patches/server/0872-Add-BlockFace-to-BlockDamageEvent.patch
parent752f957e12e4ceb8b7d2043a4a7dbce786b7b98f (diff)
downloadPaper-dc684c60d16f66ea84467ec8e253f2a36a17a7c8.tar.gz
Paper-dc684c60d16f66ea84467ec8e253f2a36a17a7c8.zip
Remove bad server.scheduleOnMain disconnect calls from old patches
The new behavior of disconnect to block the current thread until the disconnect succeeded is better than throwing it off to happen at some point
Diffstat (limited to 'patches/server/0872-Add-BlockFace-to-BlockDamageEvent.patch')
-rw-r--r--patches/server/0872-Add-BlockFace-to-BlockDamageEvent.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/patches/server/0872-Add-BlockFace-to-BlockDamageEvent.patch b/patches/server/0872-Add-BlockFace-to-BlockDamageEvent.patch
new file mode 100644
index 0000000000..7ad1e7c9e4
--- /dev/null
+++ b/patches/server/0872-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 7b1de2fddd5ff236c477439142c6e38a580d7f56..361ad90853dbd7dc2d502f224f355d6d5e9c92cc 100644
+--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+@@ -651,13 +651,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;