geforkt von Mirrors/Paper
d385af0e01
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: 0a4b84d6 SPIGOT-7003: Add missing PlayerAnimationType 830db7d5 SPIGOT-5984: Add non deprecated / magic value way to set pixel in MapCanvas 20caf8ff PR-754: Add DamageCause.SONIC_BOOM CraftBukkit Changes: 576a03704 SPIGOT-7003: Add missing PlayerAnimationType 0dcc5fdd0 SPIGOT-5984: Add non deprecated / magic value way to set pixel in MapCanvas d75aacb43 Update Netty version 3b34c6bea SPIGOT-7044: Modified RandomSourceWrapper to ensure random is not null before setting seed 4b60bfd18 PR-1059: Add DamageCause.SONIC_BOOM
29 Zeilen
2.1 KiB
Diff
29 Zeilen
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: JRoy <joshroy126@gmail.com>
|
|
Date: Fri, 5 Jun 2020 18:24:06 -0400
|
|
Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 1049563602ead577f24bb4b698ffb2fb386cdf21..656b8d83d5f78ab32f7980e6aa5eacd61f1bc598 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2997,9 +2997,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
|
this.player.resetLastActionTime();
|
|
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) {
|
|
- this.server.getRecipeManager().byKey(packet.getRecipe()).ifPresent((irecipe) -> {
|
|
- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(packet.isShiftDown(), irecipe, this.player);
|
|
- });
|
|
+ // Paper start - fire event for clicking recipes in the recipe book
|
|
+ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent event = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent(
|
|
+ player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(packet.getRecipe()), packet.isShiftDown());
|
|
+ if (event.callEvent() && this.player.containerMenu instanceof RecipeBookMenu<?> recipeBookMenu) { // check if inventory changed during event handling
|
|
+ this.server.getRecipeManager().byKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getRecipe())).ifPresent((irecipe) -> {
|
|
+ recipeBookMenu.handlePlacement(event.isMakeAll(), irecipe, this.player);
|
|
+ });
|
|
+ } // Paper end
|
|
}
|
|
}
|
|
|