aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server
diff options
context:
space:
mode:
authorBjarne Koll <[email protected]>2024-07-19 11:21:26 +0200
committerGitHub <[email protected]>2024-07-19 11:21:26 +0200
commit2a392767942799bc93a70a8698a0ef4ca7b8b6f9 (patch)
treed99a5021027ceee49e8209566236cc4474c6832f /patches/server
parentd08e8d1afabcce6a40bab5863f2c297cd7ba8cfa (diff)
downloadPaper-2a392767942799bc93a70a8698a0ef4ca7b8b6f9.tar.gz
Paper-2a392767942799bc93a70a8698a0ef4ca7b8b6f9.zip
Add CrafterCraftEvent (#11082)
Ports the proposed CrafterCraftEvent proposed in an open upstream PR. See: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/1044
Diffstat (limited to 'patches/server')
-rw-r--r--patches/server/1041-Add-CrafterCraftEvent.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/patches/server/1041-Add-CrafterCraftEvent.patch b/patches/server/1041-Add-CrafterCraftEvent.patch
new file mode 100644
index 0000000000..28eb5f5746
--- /dev/null
+++ b/patches/server/1041-Add-CrafterCraftEvent.patch
@@ -0,0 +1,31 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: ploppyperson <[email protected]>
+Date: Thu, 18 Jul 2024 16:38:48 +0200
+Subject: [PATCH] Add CrafterCraftEvent
+
+While not a one-to-one copy from the proposed commit upstream,
+the patch calls the preemtively pulled CrafterCraftEvent.
+
+See: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1450/overview
+
+diff --git a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java
+index 6c24b25a7c8ce6e34aceb5702f1a0a6732ebca44..391a6af36d4c27a04000b31583297a25b89125d3 100644
+--- a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java
++++ b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java
+@@ -163,6 +163,16 @@ public class CrafterBlock extends BaseEntityBlock {
+ } else {
+ RecipeHolder<CraftingRecipe> recipeHolder = optional.get();
+ ItemStack itemStack = recipeHolder.value().assemble(var11, world.registryAccess());
++ // Paper start - call CrafterCraftEvent
++ final org.bukkit.event.block.CrafterCraftEvent event = new org.bukkit.event.block.CrafterCraftEvent(
++ org.bukkit.craftbukkit.block.CraftBlock.at(world, pos),
++ (org.bukkit.inventory.CraftingRecipe) recipeHolder.toBukkitRecipe(),
++ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack)
++ );
++ if (!event.callEvent()) return;
++
++ itemStack = org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getResult());
++ // Paper end - call CrafterCraftEvent
+ if (itemStack.isEmpty()) {
+ world.levelEvent(1050, pos, 0);
+ } else {