[Bleeding] Implemented Inventory.{get,set}MaxStackSize(). Addresses BUKKIT-1076
- Custom inventories also respect this setting now.
This commit is contained in:
committed by
EvilSeph
parent
66e067f373
commit
5c8fd4995f
@@ -20,7 +20,9 @@ public class InventoryCrafting implements IInventory {
|
||||
public List<HumanEntity> transaction = new ArrayList<HumanEntity>();
|
||||
public CraftingRecipe currentRecipe;
|
||||
public IInventory resultInventory;
|
||||
|
||||
private EntityHuman owner;
|
||||
private int maxStack = MAX_STACK;
|
||||
|
||||
public ItemStack[] getContents() {
|
||||
return this.items;
|
||||
}
|
||||
@@ -28,7 +30,7 @@ public class InventoryCrafting implements IInventory {
|
||||
public void onOpen(CraftHumanEntity who) {
|
||||
transaction.add(who);
|
||||
}
|
||||
|
||||
|
||||
public InventoryType getInvType() {
|
||||
return items.length == 4 ? InventoryType.CRAFTING : InventoryType.WORKBENCH;
|
||||
}
|
||||
@@ -36,13 +38,23 @@ public class InventoryCrafting implements IInventory {
|
||||
public void onClose(CraftHumanEntity who) {
|
||||
transaction.remove(who);
|
||||
}
|
||||
|
||||
|
||||
public List<HumanEntity> getViewers() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
|
||||
public InventoryHolder getOwner() {
|
||||
return null; // TODO: Crafting grids don't really have an owner? Maybe they should?
|
||||
return owner.getBukkitEntity();
|
||||
}
|
||||
|
||||
public void setMaxStackSize(int size) {
|
||||
maxStack = size;
|
||||
resultInventory.setMaxStackSize(size);
|
||||
}
|
||||
|
||||
public InventoryCrafting(Container container, int i, int j, EntityHuman player) {
|
||||
this(container, i, j);
|
||||
this.owner = player;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -116,7 +128,7 @@ public class InventoryCrafting implements IInventory {
|
||||
}
|
||||
|
||||
public int getMaxStackSize() {
|
||||
return 64;
|
||||
return maxStack; // CraftBukkit
|
||||
}
|
||||
|
||||
public void update() {}
|
||||
|
||||
Reference in New Issue
Block a user