Fix generation stopping one chunk too early

pull/55/head
trivernis 5 years ago
parent 0347730580
commit 2b121b67fd

@ -48,13 +48,13 @@ class GenerationTaskPaper(
if (!world.isChunkGenerated(chunk.x, chunk.z)) { if (!world.isChunkGenerated(chunk.x, chunk.z)) {
for (i in 0 until chunksPerStep) { for (i in 0 until chunksPerStep) {
if (borderReachedCheck()) break if (borderReached()) break
if (!world.isChunkGenerated(chunk.x, chunk.z)) { if (!world.isChunkGenerated(chunk.x, chunk.z)) {
pendingChunks.add(world.getChunkAtAsync(chunk.x, chunk.z, true)) pendingChunks.add(world.getChunkAtAsync(chunk.x, chunk.z, true))
} }
chunk = nextChunkCoordinates chunk = nextChunkCoordinates
} }
if (!borderReachedCheck() && !world.isChunkGenerated(chunk.x, chunk.z)) { if (!world.isChunkGenerated(chunk.x, chunk.z)) {
pendingChunks.add(world.getChunkAtAsync(chunk.x, chunk.z, true)) pendingChunks.add(world.getChunkAtAsync(chunk.x, chunk.z, true))
} }
} }

@ -36,17 +36,16 @@ class GenerationTaskSpigot(
if (!world.isChunkGenerated(chunk.x, chunk.z)) { if (!world.isChunkGenerated(chunk.x, chunk.z)) {
for (i in 0 until minOf(chunksPerStep, radius - shape.currentRadius())) { for (i in 0 until minOf(chunksPerStep, radius - shape.currentRadius())) {
if (borderReachedCheck()) break if (borderReached()) break
val chunkInstance = world.getChunkAt(chunk.x, chunk.z) val chunkInstance = world.getChunkAt(chunk.x, chunk.z)
chunkInstance.load(true) chunkInstance.load(true)
loadedChunks.add(chunkInstance) loadedChunks.add(chunkInstance)
chunk = nextChunkCoordinates chunk = nextChunkCoordinates
} }
if (!borderReachedCheck()) {
val chunkInstance = world.getChunkAt(chunk.x, chunk.z) val chunkInstance = world.getChunkAt(chunk.x, chunk.z)
chunkInstance.load(true) chunkInstance.load(true)
loadedChunks.add(chunkInstance) loadedChunks.add(chunkInstance)
}
} }
lastChunkCoords = chunk lastChunkCoords = chunk
count = shape.count // set the count to the more accurate spiral count count = shape.count // set the count to the more accurate spiral count

Loading…
Cancel
Save