Fix issue with WorldScanner where no chunks match exact dist squared
This commit is contained in:
parent
454bc9c628
commit
d0fd370d53
@ -50,12 +50,14 @@ public enum WorldScanner implements Helper {
|
|||||||
boolean foundWithinY = false;
|
boolean foundWithinY = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
boolean allUnloaded = true;
|
boolean allUnloaded = true;
|
||||||
|
boolean foundChunks = false;
|
||||||
for (int xoff = -searchRadiusSq; xoff <= searchRadiusSq; xoff++) {
|
for (int xoff = -searchRadiusSq; xoff <= searchRadiusSq; xoff++) {
|
||||||
for (int zoff = -searchRadiusSq; zoff <= searchRadiusSq; zoff++) {
|
for (int zoff = -searchRadiusSq; zoff <= searchRadiusSq; zoff++) {
|
||||||
int distance = xoff * xoff + zoff * zoff;
|
int distance = xoff * xoff + zoff * zoff;
|
||||||
if (distance != searchRadiusSq) {
|
if (distance != searchRadiusSq) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
foundChunks = true;
|
||||||
int chunkX = xoff + playerChunkX;
|
int chunkX = xoff + playerChunkX;
|
||||||
int chunkZ = zoff + playerChunkZ;
|
int chunkZ = zoff + playerChunkZ;
|
||||||
Chunk chunk = chunkProvider.getLoadedChunk(chunkX, chunkZ);
|
Chunk chunk = chunkProvider.getLoadedChunk(chunkX, chunkZ);
|
||||||
@ -92,7 +94,7 @@ public enum WorldScanner implements Helper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allUnloaded) {
|
if (allUnloaded && foundChunks) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (res.size() >= max && (searchRadiusSq > 26 || (searchRadiusSq > 1 && foundWithinY))) {
|
if (res.size() >= max && (searchRadiusSq > 26 || (searchRadiusSq > 1 && foundWithinY))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user