Revert optimizations on spigot

Revert the optimizations which check if the chunk is already generated because
the function doesn't report the right value.
https://hub.spigotmc.org/jira/browse/SPIGOT-5541?attachmentOrder=desc
pull/55/head
trivernis 5 years ago
parent be130adc6f
commit c090977021

@ -59,7 +59,7 @@ class GenerationTaskPaper(
} }
} }
lastChunkCoords = chunk lastChunkCoords = chunk
count = shape.count // set the count to the more accurate spiral count count = shape.count
} }
} }
checkChunksLoaded() checkChunksLoaded()

@ -34,26 +34,17 @@ class GenerationTaskSpigot(
if (borderReachedCheck()) return if (borderReachedCheck()) return
var chunk = nextChunkCoordinates var chunk = nextChunkCoordinates
for (i in 0 until chunkSkips) { for (i in 0 until chunksPerStep) {
if (world.isChunkGenerated(chunk.x, chunk.z)) { if (borderReached()) break
chunk = nextChunkCoordinates
} else {
break
}
}
if (!world.isChunkGenerated(chunk.x, chunk.z)) {
for (i in 0 until chunksPerStep) {
if (borderReached()) break
val chunkInstance = world.getChunkAt(chunk.x, chunk.z)
chunkInstance.load(true)
loadedChunks.add(chunkInstance)
chunk = nextChunkCoordinates
}
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
} }
val chunkInstance = world.getChunkAt(chunk.x, chunk.z)
chunkInstance.load(true)
loadedChunks.add(chunkInstance)
lastChunkCoords = chunk lastChunkCoords = chunk
count = shape.count count = shape.count
} }

@ -35,6 +35,9 @@ class Circle(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int): Shape(
} }
override fun next(): Pair<Int, Int> { override fun next(): Pair<Int, Int> {
if (endReached()) {
return currentPos
}
if (count == 0 && currentPos != center) { if (count == 0 && currentPos != center) {
val tmpCircle = Circle(center, center, radius) val tmpCircle = Circle(center, center, radius)
while (tmpCircle.next() != currentPos); while (tmpCircle.next() != currentPos);

Loading…
Cancel
Save