mirror of
https://github.com/Brettflan/WorldBorder.git
synced 2025-01-08 00:47:38 +01:00
Merge pull request #103 from mikeprimm/fix_1_13_border_chunks
Alter fully generated prediction to match 1.13.x worldgen behavior
This commit is contained in:
commit
e5feeb1b75
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,4 +1,7 @@
|
|||||||
target/
|
target/
|
||||||
|
bin/
|
||||||
.idea/
|
.idea/
|
||||||
*.iml
|
*.iml
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
@ -134,14 +134,15 @@ public class WorldFileData
|
|||||||
// Minecraft only fully generates a chunk when adjacent chunks are also loaded.
|
// Minecraft only fully generates a chunk when adjacent chunks are also loaded.
|
||||||
public boolean isChunkFullyGenerated(int x, int z)
|
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
|
{ // if all adjacent chunks exist, it should be a safe enough bet that this one is fully generated
|
||||||
return
|
// 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++) {
|
||||||
! doesChunkExist(x, z)
|
for (int zz = z-3; zz <= z+3; zz++) {
|
||||||
|| ! doesChunkExist(x+1, z)
|
if (!doesChunkExist(xx, zz)) {
|
||||||
|| ! doesChunkExist(x-1, z)
|
return false;
|
||||||
|| ! doesChunkExist(x, z+1)
|
}
|
||||||
|| ! doesChunkExist(x, z-1)
|
}
|
||||||
);
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method to let us know a chunk has been generated, to update our region map.
|
// 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);
|
data.set(j, true);
|
||||||
counter++;
|
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();
|
regionData.close();
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException ex)
|
catch (FileNotFoundException ex)
|
||||||
|
Loading…
Reference in New Issue
Block a user