summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ItemBlock.java
diff options
context:
space:
mode:
authorTahg <tahgtahv@gmail.com>2012-02-08 21:26:49 -0500
committerEvilSeph <evilseph@gmail.com>2012-02-09 11:25:53 -0500
commit10ab7b96edb85c90dd480aa718a59d82682e091c (patch)
tree8a5bad4268bf7fd89cce76ac70c951ac198f6eaa /src/main/java/net/minecraft/server/ItemBlock.java
parent6abd178ea7c8908d5b5d74643c8759b9538a283a (diff)
downloadcraftbukkit-10ab7b96edb85c90dd480aa718a59d82682e091c.tar
craftbukkit-10ab7b96edb85c90dd480aa718a59d82682e091c.tar.gz
craftbukkit-10ab7b96edb85c90dd480aa718a59d82682e091c.tar.lz
craftbukkit-10ab7b96edb85c90dd480aa718a59d82682e091c.tar.xz
craftbukkit-10ab7b96edb85c90dd480aa718a59d82682e091c.zip
Made steps fire a BlockPlace event. Fixes BUKKIT-394
Diffstat (limited to 'src/main/java/net/minecraft/server/ItemBlock.java')
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index f910bee7..1f65bf73 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -58,29 +58,18 @@ public class ItemBlock extends Item {
return false;
} else if (j == world.height - 1 && Block.byId[this.id].material.isBuildable()) {
return false;
- } else if (world.mayPlace(this.id, i, j, k, false, l)) {
- Block block = Block.byId[this.id];
+ }
+ // CraftBukkit start
+ int id = (l == -1 && itemstack.getItem() instanceof ItemStep) ? Block.DOUBLE_STEP.id : this.id;
+ if (id != this.id || world.mayPlace(this.id, i, j, k, false, l)) {
+ Block block = Block.byId[id];
- // CraftBukkit start - This executes the placement of the block
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, 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
- 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;
- }
-
world.suppressPhysics = true;
- world.setTypeIdAndData(i, j, k, this.id, this.filterData(itemstack.getData()));
- BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, eventUseBlockBelow ? blockStateBelow : replacedBlockState, clickedX, clickedY, clickedZ, block);
- int id = world.getTypeId(i, j, k);
+ world.setTypeIdAndData(i, j, k, id, this.filterData(itemstack.getData()));
+ BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block);
+ id = world.getTypeId(i, j, k);
int data = world.getData(i, j, k);
replacedBlockState.update(true);
world.suppressPhysics = false;