diff options
author | Celtic Minstrel <celtic.minstrel.ca@some.place> | 2012-03-05 14:21:43 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-21 12:42:51 -0400 |
commit | 5ba892804158ba81b655826469363eefa8f0baaa (patch) | |
tree | 75daade710326db6487550877a21a8557951bc52 /src/main/java/net/minecraft/server/BlockPistonExtension.java | |
parent | 8d62de7055a8c901240412ac41f3cb5091ea41a9 (diff) | |
download | craftbukkit-5ba892804158ba81b655826469363eefa8f0baaa.tar craftbukkit-5ba892804158ba81b655826469363eefa8f0baaa.tar.gz craftbukkit-5ba892804158ba81b655826469363eefa8f0baaa.tar.lz craftbukkit-5ba892804158ba81b655826469363eefa8f0baaa.tar.xz craftbukkit-5ba892804158ba81b655826469363eefa8f0baaa.zip |
[Bleeding] Added getting and setting drops to all appropriate events. Fixes BUKKIT-397 and fixes BUKKIT-1252
- Allows drops in creative mode by adding items to the getDrops() list
- Contents of containers are not reported
- Contents of storage minecarts are not reported
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockPistonExtension.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockPistonExtension.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPistonExtension.java b/src/main/java/net/minecraft/server/BlockPistonExtension.java index e6a7b186..28adc7f3 100644 --- a/src/main/java/net/minecraft/server/BlockPistonExtension.java +++ b/src/main/java/net/minecraft/server/BlockPistonExtension.java @@ -13,9 +13,28 @@ public class BlockPistonExtension extends Block { this.c(0.5F); } + // CraftBukkit start - Support getDrops() in BlockBreakEvent + public ArrayList<ItemStack> calculateDrops(World world, EntityHuman entityhuman, int i, int j, int k, int d) { + super.calculateDrops(world, entityhuman, i, j, k, d); + int l = world.getData(i, j, k) & 0x7; + if (l > 5 || l < 0) return super.dropList; + int i1 = Facing.OPPOSITE_FACING[b(l)]; + + i += Facing.b[i1]; + j += Facing.c[i1]; + k += Facing.d[i1]; + int j1 = world.getTypeId(i, j, k); + + if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) { + super.dropList.add(new ItemStack(Block.byId[j1], 1)); + } + return super.dropList; + } + // CraftBukkit end + public void remove(World world, int i, int j, int k) { super.remove(world, i, j, k); - int l = world.getData(i, j, k); + int l = world.getData(i, j, k) & 0x7; if (l > 5 || l < 0) return; // CraftBukkit - fixed a piston AIOOBE issue. int i1 = Facing.OPPOSITE_FACING[b(l)]; @@ -27,7 +46,7 @@ public class BlockPistonExtension extends Block { if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) { l = world.getData(i, j, k); if (BlockPiston.e(l)) { - Block.byId[j1].b(world, i, j, k, l, 0); + //Block.byId[j1].b(world, i, j, k, l, 0); // CraftBukkit - drop moved into drop list world.setTypeId(i, j, k, 0); } } |