Undo previous calculation change. Move elapsed to start after drawing task for more accuracy.

This commit is contained in:
CocoTheOwner 2021-06-11 09:53:10 +02:00
parent 2290627c5f
commit 98fe47d085

View File

@ -78,7 +78,6 @@ public class Pregenerator implements Listener
public Pregenerator(World world, int blockSize) throws HeadlessException public Pregenerator(World world, int blockSize) throws HeadlessException
{ {
instance(); instance();
elapsed = M.ms();
latch = new ChronoLatch(5000); latch = new ChronoLatch(5000);
memoryMetric = new AtomicReference<>("..."); memoryMetric = new AtomicReference<>("...");
method = new AtomicReference<>("STARTUP"); method = new AtomicReference<>("STARTUP");
@ -135,6 +134,8 @@ public class Pregenerator implements Listener
} }
}); });
elapsed = M.ms();
new Thread(() -> { new Thread(() -> {
flushWorld(); flushWorld();
J.sleep(2000); J.sleep(2000);
@ -473,7 +474,7 @@ public class Pregenerator implements Listener
} }
public String[] getProgress() { public String[] getProgress() {
long eta = (long) ((totalChunks.get() - generated.get()) / perSecond.getAverage()); long eta = (long) ((totalChunks.get() - generated.get()) * ((double)(M.ms() - elapsed) / (double) generated.get()));
return new String[]{ return new String[]{
"Progress: " + Form.f(generated.get()) + " of " + Form.f(totalChunks.get()) + " (" + Form.pc((double)generated.get() / (double)totalChunks.get(), 0) + ")", "Progress: " + Form.f(generated.get()) + " of " + Form.f(totalChunks.get()) + " (" + Form.pc((double)generated.get() / (double)totalChunks.get(), 0) + ")",