Add CartographyItemEvent and get/setResult for CartographyInventory (#10396)
This commit is contained in:
@@ -3,6 +3,7 @@ From: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Date: Sat, 25 Apr 2020 23:31:28 +0200
|
||||
Subject: [PATCH] Add item slot convenience methods
|
||||
|
||||
Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@@ -73,6 +74,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/CartographyInventory.java b/src/main/java/org/bukkit/inventory/CartographyInventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/CartographyInventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/CartographyInventory.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.inventory;
|
||||
/**
|
||||
* Interface to the inventory of a Cartography table.
|
||||
*/
|
||||
-public interface CartographyInventory extends Inventory { }
|
||||
+public interface CartographyInventory extends Inventory {
|
||||
+ // Paper begin - add getResult/setResult to CartographyInventory
|
||||
+ /**
|
||||
+ * Check what item is in the result slot of this smithing table.
|
||||
+ *
|
||||
+ * @return the result item
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ default ItemStack getResult() {
|
||||
+ return this.getItem(2); // net.minecraft.world.inventory.CartographyTableMenu.RESULT_SLOT
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set the item in the result slot of the smithing table
|
||||
+ *
|
||||
+ * @param newResult the new result item
|
||||
+ */
|
||||
+ default void setResult(final @org.jetbrains.annotations.Nullable ItemStack newResult) {
|
||||
+ this.setItem(2, newResult); // net.minecraft.world.inventory.CartographyTableMenu.RESULT_SLOT
|
||||
+ }
|
||||
+ // Paper end - add getResult/setResult to CartographyInventory
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java
|
||||
|
||||
Reference in New Issue
Block a user