Include anvil result in inventory size. Fixes BUKKIT-3741

This commit is contained in:
Travis Watkins 2013-03-30 02:51:26 -05:00
parent af7ea28bc7
commit a1c38cd8f3
2 changed files with 19 additions and 3 deletions

View File

@ -376,7 +376,7 @@ public class ContainerAnvil extends Container {
return bukkitEntity; 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); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity; return bukkitEntity;
} }

View File

@ -4,7 +4,23 @@ import net.minecraft.server.IInventory;
import org.bukkit.inventory.AnvilInventory; import org.bukkit.inventory.AnvilInventory;
public class CraftInventoryAnvil extends CraftInventory implements AnvilInventory { public class CraftInventoryAnvil extends CraftInventory implements AnvilInventory {
public CraftInventoryAnvil(IInventory anvil) { private final IInventory resultInventory;
super(anvil);
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();
} }
} }