mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
69ee95fa42
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues. Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong. This is now resolved. Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me. Please as always, backup your worlds and test before updating to 1.16.2! If you update to 1.16.2, there is no going back to an older build than this. --------------------------------- Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com> Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com> Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com> Co-authored-by: stonar96 <minecraft.stonar96@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Riley Park <rileysebastianpark@gmail.com> Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: commandblockguy <commandblockguy1@gmail.com> Co-authored-by: DigitalRegent <misterwener@gmail.com> Co-authored-by: ishland <ishlandmc@yeah.net>
308 lines
7.9 KiB
Diff
308 lines
7.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Nassim Jahnke <nassim@njahnke.dev>
|
|
Date: Sat, 25 Apr 2020 23:31:28 +0200
|
|
Subject: [PATCH] Add item slot convenience methods
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
|
@@ -0,0 +0,0 @@ public interface AnvilInventory extends Inventory {
|
|
* @param levels the maximum experience cost
|
|
*/
|
|
void setMaximumRepairCost(int levels);
|
|
+
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Gets the item in the left input slot.
|
|
+ *
|
|
+ * @return item in the first slot
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getFirstItem() {
|
|
+ return getItem(0);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the item in the left input slot.
|
|
+ *
|
|
+ * @param firstItem item to set
|
|
+ */
|
|
+ default void setFirstItem(@Nullable ItemStack firstItem) {
|
|
+ setItem(0, firstItem);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the item in the right input slot.
|
|
+ *
|
|
+ * @return item in the second slot
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getSecondItem() {
|
|
+ return getItem(1);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the item in the right input slot.
|
|
+ *
|
|
+ * @param secondItem item to set
|
|
+ */
|
|
+ default void setSecondItem(@Nullable ItemStack secondItem) {
|
|
+ setItem(1, secondItem);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the item in the result slot.
|
|
+ *
|
|
+ * @return item in the result slot
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getResult() {
|
|
+ return getItem(2);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the item in the result slot.
|
|
+ * Note that the client might not be able to take out the item if it does not match the input items.
|
|
+ *
|
|
+ * @param result item to set
|
|
+ */
|
|
+ default void setResult(@Nullable ItemStack result) {
|
|
+ setItem(2, result);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
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
|
|
+++ b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java
|
|
@@ -0,0 +0,0 @@
|
|
package org.bukkit.inventory;
|
|
|
|
+import org.jetbrains.annotations.Nullable; // Paper
|
|
+
|
|
/**
|
|
* Interface to the inventory of a Grindstone.
|
|
*/
|
|
-public interface GrindstoneInventory extends Inventory { }
|
|
+public interface GrindstoneInventory extends Inventory {
|
|
+
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Gets the upper input item.
|
|
+ *
|
|
+ * @return upper input item
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getUpperItem() {
|
|
+ return getItem(0);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the upper input item.
|
|
+ *
|
|
+ * @param upperItem item to set
|
|
+ */
|
|
+ default void setUpperItem(@Nullable ItemStack upperItem) {
|
|
+ setItem(0, upperItem);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the lower input item.
|
|
+ *
|
|
+ * @return lower input item
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getLowerItem() {
|
|
+ return getItem(1);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the lower input item.
|
|
+ *
|
|
+ * @param lowerItem item to set
|
|
+ */
|
|
+ default void setLowerItem(@Nullable ItemStack lowerItem) {
|
|
+ setItem(1, lowerItem);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the result.
|
|
+ *
|
|
+ * @return result
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getResult() {
|
|
+ return getItem(2);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the result.
|
|
+ *
|
|
+ * @param result item to set
|
|
+ */
|
|
+ default void setResult(@Nullable ItemStack result) {
|
|
+ setItem(2, result);
|
|
+ }
|
|
+ // Paper end
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/inventory/LecternInventory.java b/src/main/java/org/bukkit/inventory/LecternInventory.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/LecternInventory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/LecternInventory.java
|
|
@@ -0,0 +0,0 @@ public interface LecternInventory extends Inventory {
|
|
@Nullable
|
|
@Override
|
|
public Lectern getHolder();
|
|
+
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Gets the lectern's held book.
|
|
+ *
|
|
+ * @return book set in the lectern
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getBook() {
|
|
+ return getItem(0);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the lectern's held book.
|
|
+ *
|
|
+ * @param book the new book
|
|
+ */
|
|
+ default void setBook(@Nullable ItemStack book) {
|
|
+ setItem(0, book);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/inventory/SmithingInventory.java b/src/main/java/org/bukkit/inventory/SmithingInventory.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/SmithingInventory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/SmithingInventory.java
|
|
@@ -0,0 +0,0 @@
|
|
package org.bukkit.inventory;
|
|
|
|
+import org.jetbrains.annotations.Nullable; // Paper
|
|
+
|
|
/**
|
|
* Interface to the inventory of a Smithing table.
|
|
*/
|
|
-public interface SmithingInventory extends Inventory { }
|
|
+public interface SmithingInventory extends Inventory {
|
|
+
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Gets the input equipment (first slot).
|
|
+ *
|
|
+ * @return input equipment item
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getInputEquipment() {
|
|
+ return getItem(0);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the input equipment (first slot).
|
|
+ *
|
|
+ * @param itemStack item to set
|
|
+ */
|
|
+ default void setInputEquipment(@Nullable ItemStack itemStack) {
|
|
+ setItem(0, itemStack);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the input mineral (second slot).
|
|
+ *
|
|
+ * @return input mineral item
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getInputMineral() {
|
|
+ return getItem(1);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the input mineral (second slot).
|
|
+ *
|
|
+ * @param itemStack item to set
|
|
+ */
|
|
+ default void setInputMineral(@Nullable ItemStack itemStack) {
|
|
+ setItem(1, itemStack);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the result item.
|
|
+ *
|
|
+ * @return result
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getResult() {
|
|
+ return getItem(2);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the result item.
|
|
+ *
|
|
+ * @param itemStack item to set
|
|
+ */
|
|
+ default void setResult(@Nullable ItemStack itemStack) {
|
|
+ setItem(2, itemStack);
|
|
+ }
|
|
+ // Paper end
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/inventory/StonecutterInventory.java b/src/main/java/org/bukkit/inventory/StonecutterInventory.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/StonecutterInventory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/StonecutterInventory.java
|
|
@@ -0,0 +0,0 @@
|
|
package org.bukkit.inventory;
|
|
|
|
+import org.jetbrains.annotations.Nullable; // Paper
|
|
+
|
|
/**
|
|
* Interface to the inventory of a Stonecutter.
|
|
*/
|
|
-public interface StonecutterInventory extends Inventory { }
|
|
+public interface StonecutterInventory extends Inventory {
|
|
+
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Gets the input item.
|
|
+ *
|
|
+ * @return input item
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getInputItem() {
|
|
+ return getItem(0);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the input item.
|
|
+ *
|
|
+ * @param itemStack item to set
|
|
+ */
|
|
+ default void setInputItem(@Nullable ItemStack itemStack) {
|
|
+ setItem(0, itemStack);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the result item.
|
|
+ *
|
|
+ * @return result
|
|
+ */
|
|
+ @Nullable
|
|
+ default ItemStack getResult() {
|
|
+ return getItem(1);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the result item.
|
|
+ *
|
|
+ * @param itemStack item to set
|
|
+ */
|
|
+ default void setResult(@Nullable ItemStack itemStack) {
|
|
+ setItem(1, itemStack);
|
|
+ }
|
|
+ // Paper end
|
|
+}
|