Count pregen chunks from the bounds instead of walking them

Totalling by iterating every chunk delays the start of a large pregen. The bounds already give the count in constant time.

Upstream: 73d640943
This commit is contained in:
piexel committed 2026-11-10 01:30:07 +01:00
1 parent 19129c2eb8
commit f78600be70
3 files changed
+52 -1

No files matched your search

@@ -207,7 +207,7 @@ public class IrisPregenerator {
// fires — leaving a phantom job that suppresses spawns and blocks future pregens.
try {
init();
task.iterateAllChunks((_a, _b) -> totalChunks.incrementAndGet());
totalChunks.set(task.chunkCount());
long startedAt = M.ms();
startTime.set(startedAt);
rateTracker.reset(startedAt, generated.get());
@@ -174,6 +174,11 @@ public class PregenTask {
return new int[]{bound.minX(), bound.minZ(), bound.maxX(), bound.maxZ()};
}
public long chunkCount() {
Bound bound = bounds.chunk();
return (long) bound.sizeX() * bound.sizeZ();
}
@FunctionalInterface
public interface InterleavedChunkConsumer {
boolean on(int regionX, int regionZ, int chunkX, int chunkZ, boolean firstChunkInRegion, boolean lastChunkInRegion);