From 2cd033c808169e55998c8e400aca5434c16a7b2d Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Mon, 3 Sep 2018 11:44:20 -0500 Subject: [PATCH] Alter fully generated prediction to match 1.13.x worldgen behavior --- .gitignore | 5 +++- .../com/wimbli/WorldBorder/WorldFileData.java | 26 +++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index bdcf9f4..8a8538b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ target/ - +bin/ .idea/ *.iml +.classpath +.project +.settings/ diff --git a/src/main/java/com/wimbli/WorldBorder/WorldFileData.java b/src/main/java/com/wimbli/WorldBorder/WorldFileData.java index 73e46a8..e61082c 100644 --- a/src/main/java/com/wimbli/WorldBorder/WorldFileData.java +++ b/src/main/java/com/wimbli/WorldBorder/WorldFileData.java @@ -134,14 +134,15 @@ public class WorldFileData // Minecraft only fully generates a chunk when adjacent chunks are also loaded. public boolean isChunkFullyGenerated(int x, int z) { // if all adjacent chunks exist, it should be a safe enough bet that this one is fully generated - return - ! ( - ! doesChunkExist(x, z) - || ! doesChunkExist(x+1, z) - || ! doesChunkExist(x-1, z) - || ! doesChunkExist(x, z+1) - || ! doesChunkExist(x, z-1) - ); + // For 1.13+, due to world gen changes, this is now effectively a 3 chunk radius requirement vs a 1 chunk radius + for (int xx = x-3; xx <= x+3; xx++) { + for (int zz = z-3; zz <= z+3; zz++) { + if (!doesChunkExist(xx, zz)) { + return false; + } + } + } + return true; } // Method to let us know a chunk has been generated, to update our region map. @@ -200,6 +201,15 @@ public class WorldFileData data.set(j, true); counter++; } + // Read timestamps + for (int j = 0; j < 1024; j++) + { + // if timestamp is zero, it is protochunk (ignore it) + if ((regionData.readInt() == 0) && data.get(j)) { + data.set(j, false); + } + counter++; + } regionData.close(); } catch (FileNotFoundException ex)