aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/CompoundContainer.java.patch
blob: 0d3f513d34c6b9487cdc2e8f643486894b075485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- a/net/minecraft/world/CompoundContainer.java
+++ b/net/minecraft/world/CompoundContainer.java
@@ -3,17 +3,42 @@
 import net.minecraft.world.entity.player.Player;
 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 CompoundContainer implements Container {
 
     private final Container container1;
     private final Container container2;
 
-    public CompoundContainer(Container container, Container container1) {
-        this.container1 = container;
-        this.container2 = container1;
+    // 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;
     }
 
     @Override
+    public Location getLocation() {
+        return container1.getLocation(); // TODO: right?
+    }
+    // CraftBukkit end
+
+    public CompoundContainer(Container container1, Container container2) {
+        this.container1 = container1;
+        this.container2 = container2;
+    }
+
     @Override
     public int getContainerSize() {
         return this.container1.getContainerSize() + this.container2.getContainerSize();
@@ -61,7 +105,7 @@
     @Override
     @Override
     public int getMaxStackSize() {
-        return this.container1.getMaxStackSize();
+        return Math.min(this.container1.getMaxStackSize(), this.container2.getMaxStackSize()); // CraftBukkit - check both sides
     }
 
     @Override