diff options
author | Celtic Minstrel <celtic.minstrel.ca@some.place> | 2012-03-14 10:00:54 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-15 22:44:10 -0400 |
commit | 5c8fd4995f2bd4817e4a822ab63a485e4abc1ab2 (patch) | |
tree | f0da8ed8ed6f0474d0863719a858692105e0fb91 /src/main/java/net/minecraft/server/InventoryCrafting.java | |
parent | 66e067f37335ddb6261487744c42e4efc709d2b9 (diff) | |
download | craftbukkit-5c8fd4995f2bd4817e4a822ab63a485e4abc1ab2.tar craftbukkit-5c8fd4995f2bd4817e4a822ab63a485e4abc1ab2.tar.gz craftbukkit-5c8fd4995f2bd4817e4a822ab63a485e4abc1ab2.tar.lz craftbukkit-5c8fd4995f2bd4817e4a822ab63a485e4abc1ab2.tar.xz craftbukkit-5c8fd4995f2bd4817e4a822ab63a485e4abc1ab2.zip |
[Bleeding] Implemented Inventory.{get,set}MaxStackSize(). Addresses BUKKIT-1076
- Custom inventories also respect this setting now.
Diffstat (limited to 'src/main/java/net/minecraft/server/InventoryCrafting.java')
-rw-r--r-- | src/main/java/net/minecraft/server/InventoryCrafting.java | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/main/java/net/minecraft/server/InventoryCrafting.java b/src/main/java/net/minecraft/server/InventoryCrafting.java index ade98090..857ad0e7 100644 --- a/src/main/java/net/minecraft/server/InventoryCrafting.java +++ b/src/main/java/net/minecraft/server/InventoryCrafting.java @@ -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() {} |