9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-24 01:29:16 +00:00

bug fix + better eta

This commit is contained in:
RePixelatedMC
2024-08-03 10:07:03 +02:00
parent bad3cd27e1
commit f00e037e26

View File

@@ -140,12 +140,18 @@ public class IrisPregenerator {
} }
private long computeETA() { private long computeETA() {
return (long) (totalChunks.get() > 1024 ? // Generated chunks exceed 1/8th of total? long currentTime = M.ms();
// If yes, use smooth function (which gets more accurate over time since its less sensitive to outliers) long elapsedTime = currentTime - startTime.get();
((totalChunks.get() - generated.get()) * ((double) (M.ms() - startTime.get()) / (double) generated.get())) : int generatedChunks = generated.get();
// If no, use quick function (which is less accurate over time but responds better to the initial delay) int remainingChunks = totalChunks.get() - generatedChunks;
((totalChunks.get() - generated.get()) / chunksPerSecond.getAverage()) * 1000
); if (generatedChunks <= 12_000) {
// quick
return (long) (remainingChunks * ((double) elapsedTime / generatedChunks));
} else {
//smooth
return (long) (remainingChunks / chunksPerSecond.getAverage() * 1000);
}
} }
@@ -243,8 +249,10 @@ public class IrisPregenerator {
Position2 pos = new Position2(x, z); Position2 pos = new Position2(x, z);
if (generatedRegions.contains(pos)) { if (generatedRegions.contains(pos)) {
listener.onRegionGenerated(x,z); if(regions) {
if(regions) generated.addAndGet(1024); listener.onRegionGenerated(x, z);
generated.addAndGet(1024);
}
return; return;
} }