Fixed NMS block set to copy tile entity data even if the original block did not change its id or data

This commit is contained in:
zml2008 2012-10-18 19:38:56 -07:00
parent 2221eae36a
commit 877f14f242

View File

@ -216,7 +216,7 @@ class NmsBlock extends BaseBlock implements TileEntityBlock {
* @param position position to set the block at * @param position position to set the block at
* @param block the block to set * @param block the block to set
* @param notifyAdjacent true to notify physics and what not * @param notifyAdjacent true to notify physics and what not
* @return true if set * @return true if block id or data was changed
*/ */
public static boolean setSafely(BukkitWorld world, Vector position, public static boolean setSafely(BukkitWorld world, Vector position,
Block block, boolean notifyAdjacent) { Block block, boolean notifyAdjacent) {
@ -227,14 +227,14 @@ class NmsBlock extends BaseBlock implements TileEntityBlock {
CraftWorld craftWorld = ((CraftWorld) world.getWorld()); CraftWorld craftWorld = ((CraftWorld) world.getWorld());
boolean successful = craftWorld.getHandle().setRawTypeIdAndData( boolean changed = craftWorld.getHandle().setRawTypeIdAndData(
x, y, z, block.getId(), block.getData()); x, y, z, block.getId(), block.getData());
if (successful) { if (block instanceof BaseBlock) {
if (block instanceof BaseBlock) { world.copyToWorld(position, (BaseBlock) block);
world.copyToWorld(position, (BaseBlock) block); }
}
if (changed) {
if (notifyAdjacent) { if (notifyAdjacent) {
craftWorld.getHandle().update(x, y, z, block.getId()); craftWorld.getHandle().update(x, y, z, block.getId());
} else { } else {
@ -242,7 +242,7 @@ class NmsBlock extends BaseBlock implements TileEntityBlock {
} }
} }
return successful; return changed;
} }
/** /**