diff options
author | Xephi <xephirot59@gmail.com> | 2013-03-21 13:40:48 +0100 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-03-21 21:42:47 -0600 |
commit | 978de7e9da9218c736b20612356db7da4c9daef7 (patch) | |
tree | 2e5d0198595884b584d542493435ec7c6e4f0e6b /src/main | |
parent | 6f9e4f8541898aa1ebba2840a0e8c6f6aac7a875 (diff) | |
download | craftbukkit-978de7e9da9218c736b20612356db7da4c9daef7.tar craftbukkit-978de7e9da9218c736b20612356db7da4c9daef7.tar.gz craftbukkit-978de7e9da9218c736b20612356db7da4c9daef7.tar.lz craftbukkit-978de7e9da9218c736b20612356db7da4c9daef7.tar.xz craftbukkit-978de7e9da9218c736b20612356db7da4c9daef7.zip |
Add BlockDropper for diff visibility
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockDropper.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockDropper.java b/src/main/java/net/minecraft/server/BlockDropper.java new file mode 100644 index 00000000..afcc8a84 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockDropper.java @@ -0,0 +1,55 @@ +package net.minecraft.server; + +public class BlockDropper extends BlockDispenser { + + private final IDispenseBehavior cR = new DispenseBehaviorItem(); + + protected BlockDropper(int i) { + super(i); + } + + protected IDispenseBehavior a(ItemStack itemstack) { + return this.cR; + } + + public TileEntity b(World world) { + return new TileEntityDropper(); + } + + protected void dispense(World world, int i, int j, int k) { + SourceBlock sourceblock = new SourceBlock(world, i, j, k); + TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity(); + + if (tileentitydispenser != null) { + int l = tileentitydispenser.j(); + + if (l < 0) { + world.triggerEffect(1001, i, j, k, 0); + } else { + ItemStack itemstack = tileentitydispenser.getItem(l); + int i1 = world.getData(i, j, k) & 7; + IInventory iinventory = TileEntityHopper.getInventoryAt(world, (double) (i + Facing.b[i1]), (double) (j + Facing.c[i1]), (double) (k + Facing.d[i1])); + ItemStack itemstack1; + + if (iinventory != null) { + itemstack1 = TileEntityHopper.addItem(iinventory, itemstack.cloneItemStack().a(1), Facing.OPPOSITE_FACING[i1]); + if (itemstack1 == null) { + itemstack1 = itemstack.cloneItemStack(); + if (--itemstack1.count == 0) { + itemstack1 = null; + } + } else { + itemstack1 = itemstack.cloneItemStack(); + } + } else { + itemstack1 = this.cR.a(sourceblock, itemstack); + if (itemstack1 != null && itemstack1.count == 0) { + itemstack1 = null; + } + } + + tileentitydispenser.setItem(l, itemstack1); + } + } + } +} |