Fix issues with ungenerated chunks and generated option

This commit is contained in:
Phoenix616 2020-07-03 22:12:05 +01:00
parent 4e845408e3
commit 617bc1bad8
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
1 changed files with 4 additions and 2 deletions

View File

@ -389,11 +389,13 @@ public class RandomSearcher {
randChunkX = (random.nextBoolean() ? 1 : -1) * random.nextInt(maxChunk + 1);
randChunkZ = (random.nextBoolean() ? 1 : -1) * random.nextInt(maxChunk + 1);
}
} while (!checked.put(randChunkX, randChunkZ) || !inRadius(Math.abs(randChunkX), Math.abs(randChunkZ), minChunk, maxChunk));
} while (!checked.put(randChunkX, randChunkZ)
|| !inRadius(Math.abs(randChunkX), Math.abs(randChunkZ), minChunk, maxChunk)
|| (generatedOnly && !PaperLib.isChunkGenerated(randomLoc.getWorld(), randChunkX, randChunkZ)));
randomLoc.setX(((center.getBlockX() >> 4) + randChunkX) * 16);
randomLoc.setZ(((center.getBlockZ() >> 4) + randChunkZ) * 16);
PaperLib.getChunkAtAsync(randomLoc, generatedOnly).thenApply(c -> {
PaperLib.getChunkAtAsync(randomLoc).thenApply(c -> {
checks++;
if (c == null) {
// Chunk not generated, test another one