aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/InventoryLargeChest.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/InventoryLargeChest.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/InventoryLargeChest.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/InventoryLargeChest.patch b/patch-remap/og/net/minecraft/world/InventoryLargeChest.patch
new file mode 100644
index 0000000000..871fff1b74
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/InventoryLargeChest.patch
@@ -0,0 +1,74 @@
+--- a/net/minecraft/world/InventoryLargeChest.java
++++ b/net/minecraft/world/InventoryLargeChest.java
+@@ -3,11 +3,62 @@
+ import net.minecraft.world.entity.player.EntityHuman;
+ import net.minecraft.world.item.ItemStack;
+
++// CraftBukkit start
++import java.util.ArrayList;
++import java.util.List;
++import org.bukkit.Location;
++
++import org.bukkit.craftbukkit.entity.CraftHumanEntity;
++import org.bukkit.entity.HumanEntity;
++// CraftBukkit end
++
+ public class InventoryLargeChest implements IInventory {
+
+ public final IInventory container1;
+ public final IInventory container2;
+
++ // CraftBukkit start - add fields and methods
++ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
++
++ public List<ItemStack> getContents() {
++ List<ItemStack> result = new ArrayList<ItemStack>(this.getContainerSize());
++ for (int i = 0; i < this.getContainerSize(); i++) {
++ result.add(this.getItem(i));
++ }
++ return result;
++ }
++
++ public void onOpen(CraftHumanEntity who) {
++ this.container1.onOpen(who);
++ this.container2.onOpen(who);
++ transaction.add(who);
++ }
++
++ public void onClose(CraftHumanEntity who) {
++ this.container1.onClose(who);
++ this.container2.onClose(who);
++ transaction.remove(who);
++ }
++
++ public List<HumanEntity> getViewers() {
++ return transaction;
++ }
++
++ public org.bukkit.inventory.InventoryHolder getOwner() {
++ return null; // This method won't be called since CraftInventoryDoubleChest doesn't defer to here
++ }
++
++ public void setMaxStackSize(int size) {
++ this.container1.setMaxStackSize(size);
++ this.container2.setMaxStackSize(size);
++ }
++
++ @Override
++ public Location getLocation() {
++ return container1.getLocation(); // TODO: right?
++ }
++ // CraftBukkit end
++
+ public InventoryLargeChest(IInventory iinventory, IInventory iinventory1) {
+ this.container1 = iinventory;
+ this.container2 = iinventory1;
+@@ -54,7 +105,7 @@
+
+ @Override
+ public int getMaxStackSize() {
+- return this.container1.getMaxStackSize();
++ return Math.min(this.container1.getMaxStackSize(), this.container2.getMaxStackSize()); // CraftBukkit - check both sides
+ }
+
+ @Override