mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-21 22:26:17 +00:00
76 lines
2.0 KiB
Diff
76 lines
2.0 KiB
Diff
--- 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);
|
|
}
|