mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-25 20:15:55 +01:00
Fix issues with ungenerated chunks and generated option
This commit is contained in:
parent
4e845408e3
commit
617bc1bad8
@ -389,11 +389,13 @@ public class RandomSearcher {
|
|||||||
randChunkX = (random.nextBoolean() ? 1 : -1) * random.nextInt(maxChunk + 1);
|
randChunkX = (random.nextBoolean() ? 1 : -1) * random.nextInt(maxChunk + 1);
|
||||||
randChunkZ = (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.setX(((center.getBlockX() >> 4) + randChunkX) * 16);
|
||||||
randomLoc.setZ(((center.getBlockZ() >> 4) + randChunkZ) * 16);
|
randomLoc.setZ(((center.getBlockZ() >> 4) + randChunkZ) * 16);
|
||||||
PaperLib.getChunkAtAsync(randomLoc, generatedOnly).thenApply(c -> {
|
PaperLib.getChunkAtAsync(randomLoc).thenApply(c -> {
|
||||||
checks++;
|
checks++;
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
// Chunk not generated, test another one
|
// Chunk not generated, test another one
|
||||||
|
Loading…
Reference in New Issue
Block a user