summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictorD <victor.danell@gmail.com>2011-02-03 22:34:22 +0100
committerVictorD <victor.danell@gmail.com>2011-02-03 22:34:22 +0100
commit059d23b4c9453acde8e6bf0ca7d08a9dd4779b50 (patch)
tree17a4312d4cdf524a76938125c581bc01c86944d5
parent3a19f9e42917377c739857c1ca32c88ac7873557 (diff)
downloadcraftbukkit-059d23b4c9453acde8e6bf0ca7d08a9dd4779b50.tar
craftbukkit-059d23b4c9453acde8e6bf0ca7d08a9dd4779b50.tar.gz
craftbukkit-059d23b4c9453acde8e6bf0ca7d08a9dd4779b50.tar.lz
craftbukkit-059d23b4c9453acde8e6bf0ca7d08a9dd4779b50.tar.xz
craftbukkit-059d23b4c9453acde8e6bf0ca7d08a9dd4779b50.zip
Half-step placement bug fix, all credits to Brettflan
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 81e804fe..7819be2e 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -66,9 +66,14 @@ public class ItemBlock extends Item {
} else {
// CraftBukkit start
/* We store the old data so we can undo it. Snow(78) and half-steps(44) are special in that they replace the block itself,
- * rather than the block touching the face we clicked on.
- */
- org.bukkit.block.Block replacedBlock = ( blockClicked.getTypeId() == Block.SNOW.id || (blockClicked.getTypeId() == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP) ) ? blockClicked : blockClicked.getFace(faceClicked);
+ * rather than the block touching the face we clicked on.
+ */
+ int typeId = blockClicked.getTypeId();
+ org.bukkit.block.Block replacedBlock = blockClicked.getFace(faceClicked);
+
+ if (typeId == Block.SNOW.id || (typeId == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP))
+ replacedBlock = blockClicked;
+
final BlockState replacedBlockState = new CraftBlockState(replacedBlock);
// CraftBukkit end
@@ -77,13 +82,13 @@ public class ItemBlock extends Item {
// CraftBukkit start - This executes the placement of the block
/*
- * This replaces world.b(IIIII), we're doing this because we need to
- * hook between the 'placement' and the informing to 'world' so we can
- * sanely undo this.
- *
- * Whenever the call to 'world.b' changes we need to figure out again what to
- * replace this with.
- */
+ * This replaces world.b(IIIII), we're doing this because we need to
+ * hook between the 'placement' and the informing to 'world' so we can
+ * sanely undo this.
+ *
+ * Whenever the call to 'world.b' changes we need to figure out again what to
+ * replace this with.
+ */
if (world.setTypeIdAndData(i, j, k, a, a(itemstack.h()))) { // <-- world.b does this to place the block
org.bukkit.Server server = ((WorldServer) world).getServer();
Type eventType = Type.BLOCK_PLACED;