diff --git a/src/main/java/com/volmit/iris/core/gui/PregeneratorJob.java b/src/main/java/com/volmit/iris/core/gui/PregeneratorJob.java index fedfe0eab..4a8a43c3a 100644 --- a/src/main/java/com/volmit/iris/core/gui/PregeneratorJob.java +++ b/src/main/java/com/volmit/iris/core/gui/PregeneratorJob.java @@ -43,6 +43,8 @@ public class PregeneratorJob implements PregenListener { public static PregeneratorJob instance; private static final Color COLOR_EXISTS = parseColor("#4d7d5b"); private static final Color COLOR_GENERATING = parseColor("#0062ff"); + private static final Color COLOR_NETWORK = parseColor("#a863c2"); + private static final Color COLOR_NETWORK_GENERATING = parseColor("#836b8c"); private static final Color COLOR_GENERATED = parseColor("#34eb93"); private JFrame frame; private final PregenTask task; @@ -127,6 +129,16 @@ public class PregeneratorJob implements PregenListener { return instance.paused(); } + public void drawRegion(int x, int z, Color color) + { + J.a(() -> { + PregenTask.iterateRegion(x, z, (xx,zz)->{ + draw(xx,zz,color); + J.sleep(3); + }); + }); + } + public void draw(int x, int z, Color color) { try @@ -237,6 +249,31 @@ public class PregeneratorJob implements PregenListener { } + @Override + public void onNetworkStarted(int x, int z) { + drawRegion(x, z, COLOR_NETWORK); + } + + @Override + public void onNetworkFailed(int x, int z) { + + } + + @Override + public void onNetworkReclaim(int revert) { + + } + + @Override + public void onNetworkGeneratedChunk(int x, int z) { + draw(x, z, COLOR_NETWORK_GENERATING); + } + + @Override + public void onNetworkDownloaded(int x, int z) { + drawRegion(x, z, COLOR_NETWORK); + } + @Override public void onClose() { close(); diff --git a/src/main/java/com/volmit/iris/core/pregenerator/IrisPregenerator.java b/src/main/java/com/volmit/iris/core/pregenerator/IrisPregenerator.java index e63cade5e..b483e7dce 100644 --- a/src/main/java/com/volmit/iris/core/pregenerator/IrisPregenerator.java +++ b/src/main/java/com/volmit/iris/core/pregenerator/IrisPregenerator.java @@ -50,6 +50,8 @@ public class IrisPregenerator { private final ChronoLatch minuteLatch; private final AtomicReference currentGeneratorMethod; private final KSet generatedRegions; + private final KSet retry; + private final KSet net; public IrisPregenerator(PregenTask task, PregeneratorMethod generator, PregenListener listener) { @@ -59,6 +61,8 @@ public class IrisPregenerator { this.paused = new AtomicBoolean(false); this.task = task; this.generator = generator; + retry = new KSet<>(); + net = new KSet<>(); currentGeneratorMethod = new AtomicReference<>("Void"); minuteLatch = new ChronoLatch(60000, false); chunksPerSecond = new RollingSequence(10); @@ -230,6 +234,31 @@ public class IrisPregenerator { listener.onRegionSkipped(x, z); } + @Override + public void onNetworkStarted(int x, int z) { + net.add(new Position2(x, z)); + } + + @Override + public void onNetworkFailed(int x, int z) { + retry.add(new Position2(x, z)); + } + + @Override + public void onNetworkReclaim(int revert) { + generated.addAndGet(-revert); + } + + @Override + public void onNetworkGeneratedChunk(int x, int z) { + generated.addAndGet(1); + } + + @Override + public void onNetworkDownloaded(int x, int z) { + net.remove(new Position2(x, z)); + } + @Override public void onClose() { listener.onClose();