diff options
author | Erik Broes <erikbroes@grum.nl> | 2012-02-29 22:31:04 +0100 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2012-03-01 01:12:41 +0000 |
commit | 33ba9f0a2f56bdba89574d25b44905af95480dbe (patch) | |
tree | dd446975bfd0406c3deac50c0bc1e156ca737698 /src/main/java/net/minecraft/server/Container.java | |
parent | 8524ff8ef7be2d386e98f65fdca14c0157e8309f (diff) | |
download | craftbukkit-33ba9f0a2f56bdba89574d25b44905af95480dbe.tar craftbukkit-33ba9f0a2f56bdba89574d25b44905af95480dbe.tar.gz craftbukkit-33ba9f0a2f56bdba89574d25b44905af95480dbe.tar.lz craftbukkit-33ba9f0a2f56bdba89574d25b44905af95480dbe.tar.xz craftbukkit-33ba9f0a2f56bdba89574d25b44905af95480dbe.zip |
Updated to rename revision 02
Diffstat (limited to 'src/main/java/net/minecraft/server/Container.java')
-rw-r--r-- | src/main/java/net/minecraft/server/Container.java | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java index 248ae3a2..63ec6374 100644 --- a/src/main/java/net/minecraft/server/Container.java +++ b/src/main/java/net/minecraft/server/Container.java @@ -12,6 +12,7 @@ import org.bukkit.inventory.InventoryView; // CraftBukkit end public abstract class Container { + public List d = new ArrayList(); public List e = new ArrayList(); public int windowId = 0; @@ -24,10 +25,10 @@ public abstract class Container { public abstract InventoryView getBukkitView(); public void transferTo(Container other, CraftHumanEntity player) { InventoryView source = this.getBukkitView(), destination = other.getBukkitView(); - ((CraftInventory)source.getTopInventory()).getInventory().onClose(player); - ((CraftInventory)source.getBottomInventory()).getInventory().onClose(player); - ((CraftInventory)destination.getTopInventory()).getInventory().onOpen(player); - ((CraftInventory)destination.getBottomInventory()).getInventory().onOpen(player); + ((CraftInventory) source.getTopInventory()).getInventory().onClose(player); + ((CraftInventory) source.getBottomInventory()).getInventory().onClose(player); + ((CraftInventory) destination.getTopInventory()).getInventory().onOpen(player); + ((CraftInventory) destination.getBottomInventory()).getInventory().onOpen(player); } // CraftBukkit end @@ -39,7 +40,7 @@ public abstract class Container { this.d.add(null); } - public void a(ICrafting icrafting) { + public void addSlotListener(ICrafting icrafting) { if (this.listeners.contains(icrafting)) { throw new IllegalArgumentException("Listener already listening"); } else { @@ -91,7 +92,7 @@ public abstract class Container { return null; } - public Slot b(int i) { + public Slot getSlot(int i) { return (Slot) this.e.get(i); } @@ -101,7 +102,7 @@ public abstract class Container { return slot != null ? slot.getItem() : null; } - public ItemStack a(int i, int j, boolean flag, EntityHuman entityhuman) { + public ItemStack clickItem(int i, int j, boolean flag, EntityHuman entityhuman) { ItemStack itemstack = null; if (j > 1) { @@ -111,16 +112,16 @@ public abstract class Container { PlayerInventory playerinventory = entityhuman.inventory; if (i == -999) { - if (playerinventory.l() != null && i == -999) { + if (playerinventory.getCarried() != null && i == -999) { if (j == 0) { - entityhuman.b(playerinventory.l()); - playerinventory.b((ItemStack) null); + entityhuman.drop(playerinventory.getCarried()); + playerinventory.setCarried((ItemStack) null); } if (j == 1) { - entityhuman.b(playerinventory.l().a(1)); - if (playerinventory.l().count == 0) { - playerinventory.b((ItemStack) null); + entityhuman.drop(playerinventory.getCarried().a(1)); + if (playerinventory.getCarried().count == 0) { + playerinventory.setCarried((ItemStack) null); } } } @@ -147,7 +148,7 @@ public abstract class Container { if (slot1 != null) { slot1.d(); ItemStack itemstack2 = slot1.getItem(); - ItemStack itemstack3 = playerinventory.l(); + ItemStack itemstack3 = playerinventory.getCarried(); if (itemstack2 != null) { itemstack = itemstack2.cloneItemStack(); @@ -162,21 +163,21 @@ public abstract class Container { l = slot1.a(); } - slot1.c(itemstack3.a(l)); + slot1.set(itemstack3.a(l)); if (itemstack3.count == 0) { - playerinventory.b((ItemStack) null); + playerinventory.setCarried((ItemStack) null); } } } else if (itemstack3 == null) { l = j == 0 ? itemstack2.count : (itemstack2.count + 1) / 2; ItemStack itemstack4 = slot1.a(l); - playerinventory.b(itemstack4); + playerinventory.setCarried(itemstack4); if (itemstack2.count == 0) { - slot1.c((ItemStack) null); + slot1.set((ItemStack) null); } - slot1.b(playerinventory.l()); + slot1.b(playerinventory.getCarried()); } else if (slot1.isAllowed(itemstack3)) { if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) { l = j == 0 ? itemstack3.count : 1; @@ -190,13 +191,13 @@ public abstract class Container { itemstack3.a(l); if (itemstack3.count == 0) { - playerinventory.b((ItemStack) null); + playerinventory.setCarried((ItemStack) null); } itemstack2.count += l; } else if (itemstack3.count <= slot1.a()) { - slot1.c(itemstack3); - playerinventory.b(itemstack2); + slot1.set(itemstack3); + playerinventory.setCarried(itemstack2); } } else if (itemstack2.id == itemstack3.id && itemstack3.getMaxStackSize() > 1 && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) { l = itemstack2.count; @@ -204,10 +205,10 @@ public abstract class Container { itemstack3.count += l; itemstack2.a(l); if (itemstack2.count == 0) { - slot1.c((ItemStack) null); + slot1.set((ItemStack) null); } - slot1.b(playerinventory.l()); + slot1.b(playerinventory.getCarried()); } } } @@ -219,15 +220,15 @@ public abstract class Container { } protected void b(int i, int j, boolean flag, EntityHuman entityhuman) { - this.a(i, j, flag, entityhuman); + this.clickItem(i, j, flag, entityhuman); } public void a(EntityHuman entityhuman) { PlayerInventory playerinventory = entityhuman.inventory; - if (playerinventory.l() != null) { - entityhuman.b(playerinventory.l()); - playerinventory.b((ItemStack) null); + if (playerinventory.getCarried() != null) { + entityhuman.drop(playerinventory.getCarried()); + playerinventory.setCarried((ItemStack) null); } } @@ -235,8 +236,8 @@ public abstract class Container { this.a(); } - public void a(int i, ItemStack itemstack) { - this.b(i).c(itemstack); + public void setItem(int i, ItemStack itemstack) { + this.getSlot(i).set(itemstack); } public boolean c(EntityHuman entityhuman) { @@ -303,7 +304,7 @@ public abstract class Container { slot = (Slot) this.e.get(k); itemstack1 = slot.getItem(); if (itemstack1 == null) { - slot.c(itemstack.cloneItemStack()); + slot.set(itemstack.cloneItemStack()); slot.d(); itemstack.count = 0; flag1 = true; |