PaperMC/nms-patches/InventoryCraftResult.patch

54 lines
1.4 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/InventoryCraftResult.java
+++ b/net/minecraft/server/InventoryCraftResult.java
2019-04-23 04:00:00 +02:00
@@ -2,12 +2,50 @@
2016-11-17 02:41:03 +01:00
import java.util.Iterator;
2017-05-14 04:00:00 +02:00
import javax.annotation.Nullable;
+// CraftBukkit start
2016-02-29 22:32:46 +01:00
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
2016-05-10 13:47:39 +02:00
2018-07-15 02:00:00 +02:00
public class InventoryCraftResult implements IInventory, RecipeHolder {
2016-11-17 02:41:03 +01:00
private final NonNullList<ItemStack> items;
2019-04-23 04:00:00 +02:00
private IRecipe<?> b;
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
+ private int maxStack = MAX_STACK;
+
2016-11-17 02:41:03 +01:00
+ public java.util.List<ItemStack> getContents() {
+ return this.items;
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return null; // Result slots don't get an owner
+ }
+
+ // Don't need a transaction; the InventoryCrafting keeps track of it for us
+ public void onOpen(CraftHumanEntity who) {}
+ public void onClose(CraftHumanEntity who) {}
+ public java.util.List<HumanEntity> getViewers() {
+ return new java.util.ArrayList<HumanEntity>();
+ }
+
2019-04-23 04:00:00 +02:00
+ @Override
+ public int getMaxStackSize() {
+ return maxStack;
+ }
+
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
2016-02-29 22:32:46 +01:00
+
+ @Override
+ public Location getLocation() {
+ return null;
+ }
2015-02-26 23:41:06 +01:00
+ // CraftBukkit end
+
2016-11-17 02:41:03 +01:00
public InventoryCraftResult() {
2020-06-25 02:00:00 +02:00
this.items = NonNullList.a(1, ItemStack.b);
2016-11-17 02:41:03 +01:00
}