diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/InventorySubcontainer.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/InventorySubcontainer.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/InventorySubcontainer.patch b/patch-remap/og/net/minecraft/world/InventorySubcontainer.patch new file mode 100644 index 0000000000..c77b2aa78e --- /dev/null +++ b/patch-remap/og/net/minecraft/world/InventorySubcontainer.patch @@ -0,0 +1,75 @@ +--- a/net/minecraft/world/InventorySubcontainer.java ++++ b/net/minecraft/world/InventorySubcontainer.java +@@ -14,6 +14,12 @@ + import net.minecraft.world.item.Item; + import net.minecraft.world.item.ItemStack; + ++// CraftBukkit start ++import org.bukkit.Location; ++import org.bukkit.craftbukkit.entity.CraftHumanEntity; ++import org.bukkit.entity.HumanEntity; ++// CraftBukkit end ++ + public class InventorySubcontainer implements IInventory, AutoRecipeOutput { + + private final int size; +@@ -21,7 +27,59 @@ + @Nullable + private List<IInventoryListener> listeners; + ++ // CraftBukkit start - add fields and methods ++ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); ++ private int maxStack = MAX_STACK; ++ protected org.bukkit.inventory.InventoryHolder bukkitOwner; ++ ++ public List<ItemStack> getContents() { ++ return this.items; ++ } ++ ++ public void onOpen(CraftHumanEntity who) { ++ transaction.add(who); ++ } ++ ++ public void onClose(CraftHumanEntity who) { ++ transaction.remove(who); ++ } ++ ++ public List<HumanEntity> getViewers() { ++ return transaction; ++ } ++ ++ @Override ++ public int getMaxStackSize() { ++ return maxStack; ++ } ++ ++ public void setMaxStackSize(int i) { ++ maxStack = i; ++ } ++ ++ public org.bukkit.inventory.InventoryHolder getOwner() { ++ return bukkitOwner; ++ } ++ ++ @Override ++ public Location getLocation() { ++ return null; ++ } ++ ++ public InventorySubcontainer(InventorySubcontainer original) { ++ this(original.size); ++ for (int slot = 0; slot < original.size; slot++) { ++ this.items.set(slot, original.items.get(slot).copy()); ++ } ++ } ++ + public InventorySubcontainer(int i) { ++ this(i, null); ++ } ++ ++ public InventorySubcontainer(int i, org.bukkit.inventory.InventoryHolder owner) { ++ this.bukkitOwner = owner; ++ // CraftBukkit end + this.size = i; + this.items = NonNullList.withSize(i, ItemStack.EMPTY); + } |