Skip to content

Commit

Permalink
world gen status
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonpro03 committed Nov 18, 2023
1 parent 6dae353 commit cd68c5e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Obsidian/WorldData/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Obsidian.Net.Packets.Play.Clientbound;
using Obsidian.Registries;
using Obsidian.Services;
using System.Diagnostics;
using System.IO;
using System.Threading;

Expand Down Expand Up @@ -857,12 +858,20 @@ await Parallel.ForEachAsync(Enumerable.Range(-regionPregenRange, regionPregenRan
}
}

float startChunks = ChunksToGenCount;
var stopwatch = new Stopwatch();
stopwatch.Start();
Logger.LogInformation("{startChunks} chunks to generate...", startChunks);
while (!ChunksToGen.IsEmpty)
{
await ManageChunksAsync();
//Server.UpdateStatusConsole();
var pctComplete = (int)((1.0 - ChunksToGenCount / startChunks) * 100);
var completedChunks = startChunks - ChunksToGenCount;
var cps = completedChunks / (stopwatch.ElapsedMilliseconds / 1000.0);
int remain = ChunksToGenCount / (int)cps;
Console.Write("\r{0} chunks/second - {1}% complete - {2} seconds remaining ", cps.ToString("###.00"), pctComplete, remain);
}

Console.WriteLine();
await FlushRegionsAsync();

if (setWorldSpawn)
Expand Down

0 comments on commit cd68c5e

Please sign in to comment.