summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/minecraft/server/Chunk.java9
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java5
-rw-r--r--src/main/java/net/minecraft/server/World.java6
3 files changed, 9 insertions, 11 deletions
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 941a4c22..93c343e1 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -428,12 +428,9 @@ public class Chunk {
TileEntity tileentity;
if (l != 0) {
- if (!this.world.isStatic) {
- // CraftBukkit start - Don't "place" if we're processing the event
- if (!this.world.suppressPhysics) {
- Block.byId[l].onPlace(this.world, j2, j, k2);
- }
- // CraftBukkit end
+ // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer
+ if (!this.world.isStatic && (!this.world.callingPlaceEvent || (Block.byId[l] instanceof BlockContainer))) {
+ Block.byId[l].onPlace(this.world, j2, j, k2);
}
if (Block.byId[l] instanceof BlockContainer) {
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 85bdbed4..e6d54bb1 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -80,22 +80,25 @@ public class ItemBlock extends Item {
org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z);
world.suppressPhysics = true;
+ world.callingPlaceEvent = true;
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()) {
blockstate.update(true);
world.suppressPhysics = false;
+ world.callingPlaceEvent = false;
return false;
}
world.suppressPhysics = false;
+ world.callingPlaceEvent = false;
int newId = world.getTypeId(x, y, z);
int newData = world.getData(x, y, z);
Block block = Block.byId[newId];
- if (block != null) {
+ if (block != null && !(block instanceof BlockContainer)) { // Containers get placed automatically
block.onPlace(world, x, y, z);
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index e2fd0dfd..c3dc4a4e 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -45,6 +45,7 @@ public abstract class World implements IBlockAccess {
protected float p;
public int q = 0;
public boolean suppressPhysics = false;
+ public boolean callingPlaceEvent = false; // CraftBukkit
public int difficulty;
public Random random = new Random();
public WorldProvider worldProvider; // CraftBukkit - remove final
@@ -394,11 +395,8 @@ public abstract class World implements IBlockAccess {
}
public boolean setTypeId(int i, int j, int k, int l) {
- // CraftBukkit start
- int old = this.getTypeId(i, j, k);
if (this.setRawTypeId(i, j, k, l)) {
- this.update(i, j, k, l == 0 ? old : l);
- // CraftBukkit end
+ this.update(i, j, k, l);
return true;
} else {
return false;