diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_12/BukkitChunk_1_12.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_12/BukkitChunk_1_12.java index c5917066..a8cf4d1c 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_12/BukkitChunk_1_12.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_12/BukkitChunk_1_12.java @@ -329,45 +329,6 @@ public class BukkitChunk_1_12 extends CharFaweChunk { } } } - // Trim tiles - HashMap toRemove = null; - 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; - } - 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()); - } - } - 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(); - } - } - } - } // Set blocks for (int j = 0; j < sections.length; j++) { int count = this.getCount(j); @@ -449,6 +410,47 @@ public class BukkitChunk_1_12 extends CharFaweChunk { } getParent().setCount(0, getParent().getNonEmptyBlockCount(section) + nonEmptyBlockCount, section); } + + // Trim tiles + HashMap toRemove = null; + 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; + } + 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()); + } + } + 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(); + } + } + } + } + // Set biomes if (this.biomes != null) { if (copy != null) {