From a1c38cd8f331709157d1923e0a133b28b9b0585f Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Sat, 30 Mar 2013 02:51:26 -0500 Subject: [PATCH] Include anvil result in inventory size. Fixes BUKKIT-3741 --- .../net/minecraft/server/ContainerAnvil.java | 2 +- .../inventory/CraftInventoryAnvil.java | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java index 21cf62758d..9aaa8f9620 100644 --- a/src/main/java/net/minecraft/server/ContainerAnvil.java +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java @@ -376,7 +376,7 @@ public class ContainerAnvil extends Container { return bukkitEntity; } - org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.g); + org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.g, this.f); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); return bukkitEntity; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java index 57f54be940..a91d81aeb4 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java @@ -4,7 +4,23 @@ import net.minecraft.server.IInventory; import org.bukkit.inventory.AnvilInventory; public class CraftInventoryAnvil extends CraftInventory implements AnvilInventory { - public CraftInventoryAnvil(IInventory anvil) { - super(anvil); + private final IInventory resultInventory; + + public CraftInventoryAnvil(IInventory inventory, IInventory resultInventory) { + super(inventory); + this.resultInventory = resultInventory; + } + + public IInventory getResultInventory() { + return resultInventory; + } + + public IInventory getIngredientsInventory() { + return inventory; + } + + @Override + public int getSize() { + return getResultInventory().getSize() + getIngredientsInventory().getSize(); } }