summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ItemBlock.java
diff options
context:
space:
mode:
authorfeildmaster <admin@feildmaster.com>2013-01-18 23:07:28 -0600
committerfeildmaster <admin@feildmaster.com>2013-01-19 08:14:17 -0600
commit9ba0ddc29269093e78a02058e836991dc7ad9480 (patch)
treefd8b2073b62807b9b199d3bfb1375ae881945489 /src/main/java/net/minecraft/server/ItemBlock.java
parent6a499c8589abd6f44e49d02339aa2fa503a377b1 (diff)
downloadcraftbukkit-9ba0ddc29269093e78a02058e836991dc7ad9480.tar
craftbukkit-9ba0ddc29269093e78a02058e836991dc7ad9480.tar.gz
craftbukkit-9ba0ddc29269093e78a02058e836991dc7ad9480.tar.lz
craftbukkit-9ba0ddc29269093e78a02058e836991dc7ad9480.tar.xz
craftbukkit-9ba0ddc29269093e78a02058e836991dc7ad9480.zip
Refactor processBlockPlace logic. Fixes BUKKIT-3406 and BUKKIT-3454
The previous logic was faulty since it lost the logic of "placing" the block. It was also taking into account data that could have been changed outside of the processing of this event, which is irrelevant to the processing of this event.
Diffstat (limited to 'src/main/java/net/minecraft/server/ItemBlock.java')
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 05a1567f..85bdbed4 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -80,7 +80,7 @@ public class ItemBlock extends Item {
org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z);
world.suppressPhysics = true;
- world.setTypeIdAndData(x, y, z, id, data);
+ world.setRawTypeIdAndData(x, y, z, id, data);
org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockstate, x, y, z);
if (event.isCancelled() || !event.canBuild()) {
@@ -90,12 +90,20 @@ public class ItemBlock extends Item {
}
world.suppressPhysics = false;
- world.applyPhysics(x, y, z, world.getTypeId(x, y, z));
- Block block = Block.byId[world.getTypeId(x, y, z)];
+ int newId = world.getTypeId(x, y, z);
+ int newData = world.getData(x, y, z);
+
+ Block block = Block.byId[newId];
+ if (block != null) {
+ block.onPlace(world, x, y, z);
+ }
+
+ world.update(x, y, z, newId);
+
if (block != null) {
block.postPlace(world, x, y, z, entityhuman);
- block.postPlace(world, x, y, z, world.getData(x, y, z));
+ block.postPlace(world, x, y, z, newData);
world.makeSound((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
}