From 80417bdc2bd9d3cfa78c52260b48c4ed484be63a Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 29 Dec 2016 10:22:46 +1100 Subject: [PATCH] *revert 1.11 optimizations for now --- .../fawe/bukkit/v1_11/BukkitQueue_1_11.java | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_11/BukkitQueue_1_11.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_11/BukkitQueue_1_11.java index 201aee3e..aebe5b32 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_11/BukkitQueue_1_11.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/v1_11/BukkitQueue_1_11.java @@ -523,17 +523,41 @@ public class BukkitQueue_1_11 extends BukkitQueue_0 tiles = (Map) tilesGeneric; Collection[] entities = (Collection[]) entitiesGeneric; // Copy blocks - BukkitChunk_1_11_Copy previous = new BukkitChunk_1_11_Copy(this, fs.getX(), fs.getZ()); +// BukkitChunk_1_11_Copy previous = new BukkitChunk_1_11_Copy(this, fs.getX(), fs.getZ()); + BukkitChunk_1_11 previous = getFaweChunk(fs.getX(), fs.getZ()); + char[][] idPrevious = previous.getCombinedIdArrays(); for (int layer = 0; layer < sections.length; layer++) { if (fs.getCount(layer) != 0 || all) { ChunkSection section = sections[layer]; if (section != null) { +// DataPaletteBlock blocks = section.getBlocks(); +// byte[] ids = ID_CACHE.get(); +// NibbleArray data = DATA_CACHE.get(); +// blocks.exportData(ids, data); +// previous.set(layer, ids, data.asBytes()); +// short solid = (short) fieldNonEmptyBlockCount.getInt(section); +// previous.count[layer] = solid; +// previous.air[layer] = (short) (4096 - solid); + short solid = 0; + char[] previousLayer = idPrevious[layer] = new char[4096]; DataPaletteBlock blocks = section.getBlocks(); - byte[] ids = ID_CACHE.get(); - NibbleArray data = DATA_CACHE.get(); - blocks.exportData(ids, data); - previous.set(layer, ids, data.asBytes()); - short solid = (short) fieldNonEmptyBlockCount.getInt(section); + for (int j = 0; j < 4096; j++) { + int x = FaweCache.CACHE_X[0][j]; + int y = FaweCache.CACHE_Y[0][j]; + int z = FaweCache.CACHE_Z[0][j]; + IBlockData ibd = blocks.a(x, y, z); + Block block = ibd.getBlock(); + int combined = Block.getId(block); + if (FaweCache.hasData(combined)) { + combined = (combined << 4) + block.toLegacyData(ibd); + } else { + combined = combined << 4; + } + if (combined > 1) { + solid++; + } + previousLayer[j] = (char) combined; + } previous.count[layer] = solid; previous.air[layer] = (short) (4096 - solid); }