diff options
author | EvilSeph <evilseph@gmail.com> | 2011-07-28 01:05:07 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2011-07-28 01:05:07 -0400 |
commit | 57e0a106fed3877827f8f7b7a7a61108d2645ff8 (patch) | |
tree | 4f3513c5e55ac76ff0df99ed997e42691b10f565 /src | |
parent | a8df829a8bc2e71664c6f6d631e3a0229a2d24b6 (diff) | |
download | craftbukkit-57e0a106fed3877827f8f7b7a7a61108d2645ff8.tar craftbukkit-57e0a106fed3877827f8f7b7a7a61108d2645ff8.tar.gz craftbukkit-57e0a106fed3877827f8f7b7a7a61108d2645ff8.tar.lz craftbukkit-57e0a106fed3877827f8f7b7a7a61108d2645ff8.tar.xz craftbukkit-57e0a106fed3877827f8f7b7a7a61108d2645ff8.zip |
Fixed BlockPlace event for doublesteps. Thanks DiddiZ!
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemBlock.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java index 3c1ee76e..34253666 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -62,9 +62,13 @@ public class ItemBlock extends Item { // would happen if you place x step onto another y step, so let's just keep // track of the entire state CraftBlockState blockStateBelow = null; + // Toggles whether the normal or the block below is used for the place event + boolean eventUseBlockBelow = false; if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id) && (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) { blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k); + // Step is placed on step, forms a doublestep replacing the original step, so we need the lower block + eventUseBlockBelow = itemstack.id == Block.STEP.id && blockStateBelow.getTypeId() == Block.STEP.id; } /** @@ -78,7 +82,7 @@ public class ItemBlock extends Item { * replace this with. */ if (world.setRawTypeIdAndData(i, j, k, this.id, this.filterData(itemstack.getData()))) { // <-- world.setTypeIdAndData does this to place the block - BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block); + BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, eventUseBlockBelow ? blockStateBelow : replacedBlockState, clickedX, clickedY, clickedZ, block); if (event.isCancelled() || !event.canBuild()) { if (blockStateBelow != null) { // Used for steps |