summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ItemBlock.java
diff options
context:
space:
mode:
authorsk89q <the.sk89q@gmail.com>2011-06-11 01:49:31 -0700
committersk89q <the.sk89q@gmail.com>2011-06-11 01:50:08 -0700
commit938db4de2d86d8cc05c258eeae2c43ef428588f3 (patch)
tree25a2175327b4ac20933c93592c8d652e23703774 /src/main/java/net/minecraft/server/ItemBlock.java
parent73e34c2fe33fe4eeafe8acdf74b7cf2410d5c1ee (diff)
downloadcraftbukkit-938db4de2d86d8cc05c258eeae2c43ef428588f3.tar
craftbukkit-938db4de2d86d8cc05c258eeae2c43ef428588f3.tar.gz
craftbukkit-938db4de2d86d8cc05c258eeae2c43ef428588f3.tar.lz
craftbukkit-938db4de2d86d8cc05c258eeae2c43ef428588f3.tar.xz
craftbukkit-938db4de2d86d8cc05c258eeae2c43ef428588f3.zip
Updated the block place cancellation code for steps to handle many more cases. There's still one edge case left however.
Diffstat (limited to 'src/main/java/net/minecraft/server/ItemBlock.java')
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index b123fdf2..5274da54 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -57,11 +57,17 @@ public class ItemBlock extends Item {
// CraftBukkit start - This executes the placement of the block
BlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
-
- // Special case the silly stepstone :'(
- if (l == 1 && world.getTypeId(i, j - 1, k) == Block.STEP.id && itemstack.id == Block.STEP.id) {
- replacedBlockState = CraftBlockState.getBlockState(world, i, j - 1, k);
+
+ // There are like 30 combinations you can mix and match steps and double steps
+ // of different materials, so there are a lot of different cases of what
+ // would happen if you place x step onto another y step, so let's just keep
+ // track of the entire state
+ BlockState blockStateBelow = null;
+ 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);
}
+
/**
* @see net.minecraft.server.World#setTypeIdAndData(int i, int j, int k, int l, int i1)
*
@@ -76,9 +82,9 @@ public class ItemBlock extends Item {
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block);
if (event.isCancelled() || !event.canBuild()) {
- if ((this.id == Block.STEP.id) && (world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id) && (world.getTypeId(i, j, k) == 0)) {
- // Half steps automatically set the block below to a double
- world.setTypeId(i, j - 1, k, 44);
+ if (blockStateBelow != null) { // Used for steps
+ world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
+ world.setTypeIdAndData(i, j - 1, k, blockStateBelow.getTypeId(), blockStateBelow.getRawData());
} else {