diff options
author | Celtic Minstrel <celtic.minstrel.ca@some.place> | 2012-02-25 23:56:31 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-02-29 15:13:08 -0500 |
commit | 10e593649c224db2f0a4227bdf6eef44bfa16865 (patch) | |
tree | c8e04910be128eb9d98c475808c265a36adb4715 /src/main/java/net/minecraft/server/ContainerDispenser.java | |
parent | d20091e64c3582f792e90959266e855fe0829475 (diff) | |
download | craftbukkit-10e593649c224db2f0a4227bdf6eef44bfa16865.tar craftbukkit-10e593649c224db2f0a4227bdf6eef44bfa16865.tar.gz craftbukkit-10e593649c224db2f0a4227bdf6eef44bfa16865.tar.lz craftbukkit-10e593649c224db2f0a4227bdf6eef44bfa16865.tar.xz craftbukkit-10e593649c224db2f0a4227bdf6eef44bfa16865.zip |
Imported from mc-dev:
- TileEntity
- Container
- ContainerFurnace
- ContainerDispenser
- ContainerChest
- ContainerEnchantTableSubcontainer
- ContainerEnchantTableInventory
- ContainerBrewingStand
Diffstat (limited to 'src/main/java/net/minecraft/server/ContainerDispenser.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ContainerDispenser.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ContainerDispenser.java b/src/main/java/net/minecraft/server/ContainerDispenser.java new file mode 100644 index 00000000..463a83ae --- /dev/null +++ b/src/main/java/net/minecraft/server/ContainerDispenser.java @@ -0,0 +1,65 @@ +package net.minecraft.server; + +public class ContainerDispenser extends Container { + + private TileEntityDispenser a; + + public ContainerDispenser(IInventory iinventory, TileEntityDispenser tileentitydispenser) { + this.a = tileentitydispenser; + + int i; + int j; + + for (i = 0; i < 3; ++i) { + for (j = 0; j < 3; ++j) { + this.a(new Slot(tileentitydispenser, j + i * 3, 62 + j * 18, 17 + i * 18)); + } + } + + for (i = 0; i < 3; ++i) { + for (j = 0; j < 9; ++j) { + this.a(new Slot(iinventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (i = 0; i < 9; ++i) { + this.a(new Slot(iinventory, i, 8 + i * 18, 142)); + } + } + + public boolean b(EntityHuman entityhuman) { + return this.a.a(entityhuman); + } + + public ItemStack a(int i) { + ItemStack itemstack = null; + Slot slot = (Slot) this.e.get(i); + + if (slot != null && slot.c()) { + ItemStack itemstack1 = slot.getItem(); + + itemstack = itemstack1.cloneItemStack(); + if (i < 9) { + if (!this.a(itemstack1, 9, 45, true)) { + return null; + } + } else if (!this.a(itemstack1, 0, 9, false)) { + return null; + } + + if (itemstack1.count == 0) { + slot.c((ItemStack) null); + } else { + slot.d(); + } + + if (itemstack1.count == itemstack.count) { + return null; + } + + slot.b(itemstack1); + } + + return itemstack; + } +} |