diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitChunk_1_10.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitChunk_1_10.java index fd3022a0..c6e68ff9 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitChunk_1_10.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitChunk_1_10.java @@ -365,8 +365,8 @@ public class BukkitChunk_1_10 extends CharFaweChunk { net.minecraft.server.v1_10_R1.BlockPosition bp = entry.getKey(); net.minecraft.server.v1_10_R1.TileEntity tile = entry.getValue(); tiles.remove(bp); - tile.y(); nmsWorld.s(bp); + tile.y(); tile.invalidateBlockCache(); } diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_11/BukkitChunk_1_11.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_11/BukkitChunk_1_11.java index f94f9a19..deec71b0 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_11/BukkitChunk_1_11.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_11/BukkitChunk_1_11.java @@ -375,8 +375,8 @@ public class BukkitChunk_1_11 extends CharFaweChunk { if (!(currentPalette instanceof DataPaletteGlobal)) { current.a(128, null); } + DataPaletteBlock paletteBlock = newDataPaletteBlock(); currentPalette = (DataPalette) BukkitQueue_1_12.fieldPalette.get(current); if (!(currentPalette instanceof DataPaletteGlobal)) { @@ -354,39 +330,41 @@ public class BukkitChunk_1_12 extends CharFaweChunk { } } // Trim tiles - Iterator> iterator = tiles.entrySet().iterator(); HashMap toRemove = null; - while (iterator.hasNext()) { - Map.Entry tile = iterator.next(); - BlockPosition pos = tile.getKey(); - int lx = pos.getX() & 15; - int ly = pos.getY(); - int lz = pos.getZ() & 15; - int j = FaweCache.CACHE_I[ly][lz][lx]; - char[] array = this.getIdArray(j); - if (array == null) { - continue; - } - int k = FaweCache.CACHE_J[ly][lz][lx]; - if (array[k] != 0) { - if (toRemove == null) { - toRemove = new HashMap<>(); + if (!tiles.isEmpty()) { + Iterator> iterator = tiles.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry tile = iterator.next(); + BlockPosition pos = tile.getKey(); + int lx = pos.getX() & 15; + int ly = pos.getY(); + int lz = pos.getZ() & 15; + int j = FaweCache.CACHE_I[ly][lz][lx]; + char[] array = this.getIdArray(j); + if (array == null) { + continue; } - if (copy != null) { - copy.storeTile(tile.getValue(), tile.getKey()); + int k = FaweCache.CACHE_J[ly][lz][lx]; + if (array[k] != 0) { + if (toRemove == null) { + toRemove = new HashMap<>(); + } + if (copy != null) { + copy.storeTile(tile.getValue(), tile.getKey()); + } + toRemove.put(tile.getKey(), tile.getValue()); } - toRemove.put(tile.getKey(), tile.getValue()); } - } - if (toRemove != null) { - synchronized (BukkitQueue_0.class) { - for (Map.Entry entry : toRemove.entrySet()) { - BlockPosition bp = entry.getKey(); - TileEntity tile = entry.getValue(); - tiles.remove(bp); - tile.z(); - nmsWorld.s(bp); - tile.invalidateBlockCache(); + if (toRemove != null) { + synchronized (BukkitQueue_0.class) { + for (Map.Entry entry : toRemove.entrySet()) { + BlockPosition bp = entry.getKey(); + TileEntity tile = entry.getValue(); + nmsWorld.s(bp); + tiles.remove(bp); + tile.z(); + tile.invalidateBlockCache(); + } } } } @@ -485,24 +463,28 @@ public class BukkitChunk_1_12 extends CharFaweChunk { } // Set tiles Map tilesToSpawn = this.getTiles(); - for (Map.Entry entry : tilesToSpawn.entrySet()) { - CompoundTag nativeTag = entry.getValue(); - short blockHash = entry.getKey(); - int x = (blockHash >> 12 & 0xF) + bx; - int y = (blockHash & 0xFF); - int z = (blockHash >> 8 & 0xF) + bz; - BlockPosition pos = new BlockPosition(x, y, z); // Set pos - synchronized (BukkitQueue_0.class) { - TileEntity tileEntity = nmsWorld.getTileEntity(pos); - if (tileEntity != null) { - NBTTagCompound tag = (NBTTagCompound) BukkitQueue_1_12.fromNative(nativeTag); - tag.set("x", new NBTTagInt(x)); - tag.set("y", new NBTTagInt(y)); - tag.set("z", new NBTTagInt(z)); - if (BukkitQueue_1_12.methodTileEntityLoad != null) { - BukkitQueue_1_12.methodTileEntityLoad.invoke(tileEntity, tag); // ReadTagIntoTile - } else { - tileEntity.load(tag); + if (!tilesToSpawn.isEmpty()) { + for (Map.Entry entry : tilesToSpawn.entrySet()) { + CompoundTag nativeTag = entry.getValue(); + short blockHash = entry.getKey(); + int x = (blockHash >> 12 & 0xF) + bx; + int y = (blockHash & 0xFF); + int z = (blockHash >> 8 & 0xF) + bz; + BlockPosition pos = new BlockPosition(x, y, z); // Set pos + synchronized (BukkitQueue_0.class) { + TileEntity tileEntity = nmsWorld.getTileEntity(pos); + if (tileEntity != null) { + NBTTagCompound tag = (NBTTagCompound) BukkitQueue_1_12.fromNative(nativeTag); + tag.set("x", new NBTTagInt(x)); + tag.set("y", new NBTTagInt(y)); + tag.set("z", new NBTTagInt(z)); + + + if (BukkitQueue_1_12.methodTileEntityLoad != null) { + BukkitQueue_1_12.methodTileEntityLoad.invoke(tileEntity, tag); // ReadTagIntoTile + } else { + tileEntity.load(tag); + } } } } diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitChunk_1_7.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitChunk_1_7.java index 574a7848..4d5bd9f9 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitChunk_1_7.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitChunk_1_7.java @@ -283,8 +283,8 @@ public class BukkitChunk_1_7 extends CharFaweChunk { ChunkPosition bp = entry.getKey(); TileEntity tile = entry.getValue(); tiles.remove(bp); - tile.s(); nmsWorld.p(bp.x, bp.y, bp.z); + tile.s(); tile.u(); } diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitChunk_1_8.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitChunk_1_8.java index 28f17e09..aa9878f8 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitChunk_1_8.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitChunk_1_8.java @@ -213,8 +213,8 @@ public class BukkitChunk_1_8 extends CharFaweChunk { BlockPosition bp = entry.getKey(); TileEntity tile = entry.getValue(); tiles.remove(bp); - tile.y(); nmsWorld.t(bp); + tile.y(); tile.E(); } diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_9/BukkitChunk_1_9.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_9/BukkitChunk_1_9.java index b5bba4f4..37b4b5e5 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_9/BukkitChunk_1_9.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_9/BukkitChunk_1_9.java @@ -316,8 +316,8 @@ public class BukkitChunk_1_9 extends CharFaweChunk { BlockPosition bp = entry.getKey(); TileEntity tile = entry.getValue(); tiles.remove(bp); - tile.y(); nmsWorld.s(bp); + tile.y(); tile.invalidateBlockCache(); }