diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-11-14 19:52:40 -0600 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-11-14 20:14:47 -0600 |
commit | df69ea8814a446502a0d096f542cbbb6879c80cd (patch) | |
tree | 24580b1924e964b2f40703bac0d0a867a92f09d2 /src/main/java/org | |
parent | 092800af2690a46fb36783f75b7575a3ece2745c (diff) | |
download | craftbukkit-df69ea8814a446502a0d096f542cbbb6879c80cd.tar craftbukkit-df69ea8814a446502a0d096f542cbbb6879c80cd.tar.gz craftbukkit-df69ea8814a446502a0d096f542cbbb6879c80cd.tar.lz craftbukkit-df69ea8814a446502a0d096f542cbbb6879c80cd.tar.xz craftbukkit-df69ea8814a446502a0d096f542cbbb6879c80cd.zip |
Rework skull dropping. Fixes BUKKIT-2930 and BUKKIT-2820
Skulls need their tile entity in order to create an item correctly when
broken unlike every other block. Instead of sprinkling special cases all
over the code just override dropNaturally for skulls to read from their
tile entity and make sure everything that wants to drop them calls this
method before removing the block. There is only one case where this wasn't
already true so we end up with much less special casing.
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 6 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java | 4 |
2 files changed, 1 insertions, 9 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 88245a15..79ae6d1b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1084,11 +1084,7 @@ public class CraftWorld implements World { int blockY = block.getY(); int blockZ = block.getZ(); // following code is lifted from Explosion.a(boolean), and modified - int data = block.getData(); - if (blockId == net.minecraft.server.Block.SKULL.id) { - data = net.minecraft.server.Block.SKULL.getDropData(this.world, blockX, blockY, blockZ); - } - net.minecraft.server.Block.byId[blockId].dropNaturally(this.world, blockX, blockY, blockZ, data, yield, 0); + net.minecraft.server.Block.byId[blockId].dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), yield, 0); block.setType(org.bukkit.Material.AIR); // not sure what this does, seems to have something to do with the 'base' material of a block. // For example, WOODEN_STAIRS does something with WOOD in this method diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index b1eb4fc6..7f7a7fc5 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -348,10 +348,6 @@ public class CraftBlock implements Block { boolean result = false; if (block != null) { - if (block.id == net.minecraft.server.Block.SKULL.id) { - data = (byte) block.getDropData(chunk.getHandle().world, x, y, z); - } - block.dropNaturally(chunk.getHandle().world, x, y, z, data, 1.0F, 0); result = true; } |