aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0379-Add-PlayerRecipeBookClickEvent.patch
diff options
context:
space:
mode:
authorNoah van der Aa <[email protected]>2024-04-29 23:14:35 +0200
committerNoah van der Aa <[email protected]>2024-04-29 23:14:35 +0200
commit5b962f83c66fb8400a4ad1a46ac021ab998595df (patch)
tree163e7cfd71dbda6b410e7b88aaa32571b4304041 /patches/server/0379-Add-PlayerRecipeBookClickEvent.patch
parent5a954bea77bbe687843615a4017c71d3156b305f (diff)
downloadPaper-5b962f83c66fb8400a4ad1a46ac021ab998595df.tar.gz
Paper-5b962f83c66fb8400a4ad1a46ac021ab998595df.zip
Re-add dropped patches, mojang missed some stuff
Diffstat (limited to 'patches/server/0379-Add-PlayerRecipeBookClickEvent.patch')
-rw-r--r--patches/server/0379-Add-PlayerRecipeBookClickEvent.patch55
1 files changed, 0 insertions, 55 deletions
diff --git a/patches/server/0379-Add-PlayerRecipeBookClickEvent.patch b/patches/server/0379-Add-PlayerRecipeBookClickEvent.patch
deleted file mode 100644
index 21e43aed85..0000000000
--- a/patches/server/0379-Add-PlayerRecipeBookClickEvent.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: JRoy <[email protected]>
-Date: Fri, 5 Jun 2020 18:24:06 -0400
-Subject: [PATCH] Add PlayerRecipeBookClickEvent
-
-
-diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 2e27141c6cc2dec758f294381da39a683c4e194d..a6cd53e08a0770b93876f98efa7ebfe5b77a2f15 100644
---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -3045,16 +3045,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- if (!this.player.containerMenu.stillValid(this.player)) {
- ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
- } else {
-+ // Paper start - Add PlayerRecipeBookClickEvent
-+ ResourceLocation recipeName = packet.getRecipe();
-+ boolean makeAll = packet.isShiftDown();
-+ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent paperEvent = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent(
-+ this.player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(recipeName), makeAll
-+ );
-+ if (!paperEvent.callEvent()) {
-+ return;
-+ }
-+ recipeName = CraftNamespacedKey.toMinecraft(paperEvent.getRecipe());
-+ makeAll = paperEvent.isMakeAll();
-+ if (org.bukkit.event.player.PlayerRecipeBookClickEvent.getHandlerList().getRegisteredListeners().length > 0) {
-+ // Paper end - Add PlayerRecipeBookClickEvent
- // CraftBukkit start - implement PlayerRecipeBookClickEvent
-- org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(packet.getRecipe()));
-+ org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(recipeName)); // Paper
- if (recipe == null) {
- return;
- }
-- org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, packet.isShiftDown());
-+ // Paper start - Add PlayerRecipeBookClickEvent
-+ org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, makeAll);
-+ recipeName = CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey());
-+ makeAll = event.isShiftClick();
-+ }
-+ if (!(this.player.containerMenu instanceof RecipeBookMenu<?> recipeBookMenu)) {
-+ return;
-+ }
-+ // Paper end - Add PlayerRecipeBookClickEvent
-
- // Cast to keyed should be safe as the recipe will never be a MerchantRecipe.
-- this.server.getRecipeManager().byKey(CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).ifPresent((recipeholder) -> {
-- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(event.isShiftClick(), recipeholder, this.player);
-+ // Paper start - Add PlayerRecipeBookClickEvent
-+ final boolean finalMakeAll = makeAll;
-+ this.server.getRecipeManager().byKey(recipeName).ifPresent((recipeholder) -> {
-+ recipeBookMenu.handlePlacement(finalMakeAll, recipeholder, this.player);
-+ // Paper end - Add PlayerRecipeBookClickEvent
- });
- // CraftBukkit end
- }