Paper/Spigot-Server-Patches/0518-Add-PrepareGrindstoneEvent.patch
2020-06-26 21:57:36 -07:00

34 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jan Tuck <jan@tuck.dk>
Date: Sat, 20 Jun 2020 22:34:20 +0200
Subject: [PATCH] Add PrepareGrindstoneEvent
diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java
index fe9a083b724a8657cac8462b3f44d3cc12a4db58..716304021f85a86a2f9492f5fb98e86bb7f089d2 100644
--- a/src/main/java/net/minecraft/server/ContainerGrindstone.java
+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java
@@ -10,6 +10,10 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryGrindstone;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
import org.bukkit.entity.Player;
// CraftBukkit end
+// Paper start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent;
+// Paper end
public class ContainerGrindstone extends Container {
@@ -144,6 +148,11 @@ public class ContainerGrindstone extends Container {
super.a(iinventory);
if (iinventory == this.craftInventory) {
this.e();
+ // Paper start
+ PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(this.getBukkitView(), CraftItemStack.asBukkitCopy(this.resultInventory.getItem(0)));
+ event.callEvent();
+ this.resultInventory.setItem(0, CraftItemStack.asNMSCopy(event.getResult()));
+ // Paper end
}
}