Ensure regen step not running on the main thread (#2185)

This commit is contained in:
Hannes Greule 2023-04-23 22:15:37 +02:00 committed by GitHub
parent 488a2e5de4
commit c86dfe45df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,10 +253,13 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
e.printStackTrace(); e.printStackTrace();
} }
} else { // Concurrency.NONE or generateConcurrent == false } else { // Concurrency.NONE or generateConcurrent == false
// run sequential // run sequential but submit to different thread
for (long xz : coords) { // running regen on the main thread otherwise triggers async-only events on the main thread
chunkStatus.processChunkSave(xz, worldlimits.get(radius).get(xz)); executor.submit(() -> {
} for (long xz : coords) {
chunkStatus.processChunkSave(xz, worldlimits.get(radius).get(xz));
}
}).get(); // wait until finished this step
} }
} }