aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0958-Add-CartographyItemEvent.patch
diff options
context:
space:
mode:
authorRiley Park <[email protected]>2024-05-15 17:06:59 -0700
committerGitHub <[email protected]>2024-05-15 17:06:59 -0700
commitf17519338bc589c045e0b32bfc37e048b23544d5 (patch)
treee50182ec698b4a9de8f366f485ee089b1901bbd9 /patches/server/0958-Add-CartographyItemEvent.patch
parent3fc93581bb876e8149b2ca423375a98f5ca12d27 (diff)
downloadPaper-f17519338bc589c045e0b32bfc37e048b23544d5.tar.gz
Paper-f17519338bc589c045e0b32bfc37e048b23544d5.zip
Expose server build information (#10729)
* Expose server build information * squash patches * final tweaks --------- Co-authored-by: Jake Potrebic <[email protected]> Co-authored-by: masmc05 <[email protected]>
Diffstat (limited to 'patches/server/0958-Add-CartographyItemEvent.patch')
-rw-r--r--patches/server/0958-Add-CartographyItemEvent.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/patches/server/0958-Add-CartographyItemEvent.patch b/patches/server/0958-Add-CartographyItemEvent.patch
new file mode 100644
index 0000000000..c867a928b3
--- /dev/null
+++ b/patches/server/0958-Add-CartographyItemEvent.patch
@@ -0,0 +1,43 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Janet Blackquill <[email protected]>
+Date: Sun, 7 Apr 2024 16:52:42 -0400
+Subject: [PATCH] Add CartographyItemEvent
+
+
+diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+index e13097ceba283fdf165d7e6327fe78590252fe94..bead9625a04a9c1139c54d6a56f055b80eb2d701 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -3092,6 +3092,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+ }
+ }
+
++ // Paper start - cartography item event
++ if (packet.getSlotNum() == net.minecraft.world.inventory.CartographyTableMenu.RESULT_SLOT && top instanceof org.bukkit.inventory.CartographyInventory cartographyInventory) {
++ org.bukkit.inventory.ItemStack result = cartographyInventory.getResult();
++ if (result != null && !result.isEmpty()) {
++ if (click == ClickType.NUMBER_KEY) {
++ event = new io.papermc.paper.event.player.CartographyItemEvent(inventory, type, packet.getSlotNum(), click, action, packet.getButtonNum());
++ } else {
++ event = new io.papermc.paper.event.player.CartographyItemEvent(inventory, type, packet.getSlotNum(), click, action);
++ }
++ }
++ }
++ // Paper end - cartography item event
++
+ event.setCancelled(cancelled);
+ AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224
+ this.cserver.getPluginManager().callEvent(event);
+diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
+index ab98637bf967ac19f0bc06e8cb7f18a8b13ec809..a90e2c56c54797b2fec40eb3865835c5f640a544 100644
+--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
++++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
+@@ -71,7 +71,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
+ this.resultContainer = new ResultContainer(this.createBlockHolder(context)) { // Paper - Add missing InventoryHolders
+ @Override
+ public void setChanged() {
+- CartographyTableMenu.this.slotsChanged(this);
++ // CartographyTableMenu.this.slotsChanged(this); // Paper - Add CatographyItemEvent - do not recompute results if the result slot changes - allows to set the result slot via api
+ super.setChanged();
+ }
+