improve initial generation logging

This commit is contained in:
Holly Stubbs 2023-11-08 15:44:46 +00:00
parent 228602a54d
commit 875318db04

View file

@ -136,16 +136,20 @@ export class MinecraftServer {
let timer = Date.now(); let timer = Date.now();
await this.worlds.forEach(async world => { await this.worlds.forEach(async world => {
timer = Date.now();
let chunksGenerated = 0; let chunksGenerated = 0;
let chunksPerSecond = 0;
Console.printInfo(`Generating spawn area for DIM${world.dimension}...`); Console.printInfo(`Generating spawn area for DIM${world.dimension}...`);
for (let x = chunkFrom; x < chunkTo; x++) { for (let x = chunkFrom; x < chunkTo; x++) {
for (let z = chunkFrom; z < chunkTo; z++) { for (let z = chunkFrom; z < chunkTo; z++) {
const chunk = await world.getChunkSafe(x, z); const chunk = await world.getChunkSafe(x, z);
chunk.forceLoaded = true; chunk.forceLoaded = true;
chunksGenerated++; chunksGenerated++;
chunksPerSecond++;
if (Date.now() - timer >= 1000) { if (Date.now() - timer >= 1000) {
Console.printInfo(`DIM${world.dimension} Progress [${chunksGenerated}/${chunkCount}] ${((chunksGenerated / chunkCount) * 100).toFixed(2)}%`); Console.printInfo(`DIM${world.dimension} Progress [${chunksGenerated}/${chunkCount}] (${chunksPerSecond} chunks/s) ${((chunksGenerated / chunkCount) * 100).toFixed(2)}%`);
timer = Date.now(); timer = Date.now();
chunksPerSecond = 0;
} }
} }
} }