mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-18 16:45:42 +01:00
d8847bc1f3
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: fde5602a PR-927: Add PlayerRecipeBookSettingsChangeEvent 949ff217 PR-930: Add methods to get/set evoker fang attack delay f6f7c79d SPIGOT-7514, PR-929: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics d40e22da PR-712: Add API to get full result of crafting items CraftBukkit Changes: c8feb0629 PR-1291: Improve precondition message in Entity#playEffect 482c56a00 PR-1285: Add PlayerRecipeBookSettingsChangeEvent cdf798800 PR-1290: Add methods to get/set evoker fang attack delay 2c1b5f78f SPIGOT-7514, PR-1289: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics 6aa644ae9 PR-992: Add API to get full result of crafting items ffb1319bc PR-1287: Fix scoreboards not updating in Player#setStatistic
40 lines
2.5 KiB
Diff
40 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: aerulion <aerulion@gmail.com>
|
|
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 df3feea9ed025bd7be39dfe1f1e1fdc4c1e77035..f73588370d731b58fe7acd51dd9dd3a12b222add 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -652,13 +652,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;
|