2020-06-23 06:33:08 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
2021-04-18 11:02:48 +02:00
|
|
|
index dd26d1ad34600250de7572c09bd4d74331142ad9..20c6a61101e40b09babf0ce6ad05a889d9fdfe46 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
2021-04-18 11:02:48 +02:00
|
|
|
@@ -2771,9 +2771,15 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
2020-06-23 06:33:08 +02:00
|
|
|
PlayerConnectionUtils.ensureMainThread(packetplayinautorecipe, this, this.player.getWorldServer());
|
|
|
|
this.player.resetIdleTimer();
|
|
|
|
if (!this.player.isSpectator() && this.player.activeContainer.windowId == packetplayinautorecipe.b() && this.player.activeContainer.c(this.player) && this.player.activeContainer instanceof ContainerRecipeBook) {
|
2020-08-25 04:22:08 +02:00
|
|
|
- this.minecraftServer.getCraftingManager().getRecipe(packetplayinautorecipe.c()).ifPresent((irecipe) -> {
|
2020-06-23 06:33:08 +02:00
|
|
|
- ((ContainerRecipeBook) this.player.activeContainer).a(packetplayinautorecipe.d(), 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(packetplayinautorecipe.c()), packetplayinautorecipe.d());
|
|
|
|
+ if (event.callEvent()) {
|
2020-08-25 04:22:08 +02:00
|
|
|
+ this.minecraftServer.getCraftingManager().getRecipe(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getRecipe())).ifPresent((irecipe) -> {
|
2020-06-23 06:33:08 +02:00
|
|
|
+ ((ContainerRecipeBook) this.player.activeContainer).a(event.isMakeAll(), irecipe, this.player);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|