2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/InventoryLargeChest.java
|
|
|
|
+++ b/net/minecraft/server/InventoryLargeChest.java
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -1,11 +1,62 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
+// CraftBukkit start
|
2016-11-17 02:41:03 +01:00
|
|
|
+import java.util.ArrayList;
|
2014-11-25 22:32:16 +01:00
|
|
|
+import java.util.List;
|
2016-02-29 22:32:46 +01:00
|
|
|
+import org.bukkit.Location;
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
|
|
+import org.bukkit.entity.HumanEntity;
|
|
|
|
+// CraftBukkit end
|
2016-11-17 02:41:03 +01:00
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
public class InventoryLargeChest implements ITileInventory {
|
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
private final String a;
|
2016-06-09 03:43:49 +02:00
|
|
|
public final ITileInventory left;
|
|
|
|
public final ITileInventory right;
|
2015-06-06 11:33:48 +02:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start - add fields and methods
|
|
|
|
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
|
|
|
+
|
2016-11-17 02:41:03 +01:00
|
|
|
+ public List<ItemStack> getContents() {
|
|
|
|
+ List<ItemStack> result = new ArrayList<ItemStack>(this.getSize());
|
|
|
|
+ for (int i = 0; i < this.getSize(); i++) {
|
|
|
|
+ result.add(this.getItem(i));
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void onOpen(CraftHumanEntity who) {
|
|
|
|
+ this.left.onOpen(who);
|
|
|
|
+ this.right.onOpen(who);
|
|
|
|
+ transaction.add(who);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void onClose(CraftHumanEntity who) {
|
|
|
|
+ this.left.onClose(who);
|
|
|
|
+ this.right.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.left.setMaxStackSize(size);
|
|
|
|
+ this.right.setMaxStackSize(size);
|
|
|
|
+ }
|
2016-02-29 22:32:46 +01:00
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Location getLocation() {
|
|
|
|
+ return left.getLocation(); // TODO: right?
|
|
|
|
+ }
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit end
|
2015-06-06 11:33:48 +02:00
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
public InventoryLargeChest(String s, ITileInventory itileinventory, ITileInventory itileinventory1) {
|
|
|
|
this.a = s;
|
2015-06-06 11:33:48 +02:00
|
|
|
if (itileinventory == null) {
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -72,7 +123,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getMaxStackSize() {
|
|
|
|
- return this.left.getMaxStackSize();
|
|
|
|
+ return Math.min(this.left.getMaxStackSize(), this.right.getMaxStackSize()); // CraftBukkit - check both sides
|
|
|
|
}
|
|
|
|
|
|
|
|
public void update() {
|