summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java27
-rw-r--r--src/main/java/net/minecraft/server/ItemStep.java7
2 files changed, 13 insertions, 21 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;
diff --git a/src/main/java/net/minecraft/server/ItemStep.java b/src/main/java/net/minecraft/server/ItemStep.java
index 97b6c27b..e59b67ec 100644
--- a/src/main/java/net/minecraft/server/ItemStep.java
+++ b/src/main/java/net/minecraft/server/ItemStep.java
@@ -36,12 +36,15 @@ public class ItemStep extends ItemBlock {
int j1 = world.getData(i, j, k);
if (l == 1 && i1 == Block.STEP.id && j1 == itemstack.getData()) {
+ // CraftBukkit start - handle this in super
+ /*
if (world.setTypeIdAndData(i, j, k, Block.DOUBLE_STEP.id, j1)) {
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), Block.DOUBLE_STEP.stepSound.getName(), (Block.DOUBLE_STEP.stepSound.getVolume1() + 1.0F) / 2.0F, Block.DOUBLE_STEP.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
-
- return true;
+ */
+ return super.a(itemstack, entityhuman, world, i, j, k, -1);
+ // CraftBukkit end
} else {
return super.a(itemstack, entityhuman, world, i, j, k, l);
}