mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Pregenerator tracking nets
This commit is contained in:
parent
35220e1c4d
commit
d3fe0b48d8
@ -43,6 +43,8 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
public static PregeneratorJob instance;
|
public static PregeneratorJob instance;
|
||||||
private static final Color COLOR_EXISTS = parseColor("#4d7d5b");
|
private static final Color COLOR_EXISTS = parseColor("#4d7d5b");
|
||||||
private static final Color COLOR_GENERATING = parseColor("#0062ff");
|
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 static final Color COLOR_GENERATED = parseColor("#34eb93");
|
||||||
private JFrame frame;
|
private JFrame frame;
|
||||||
private final PregenTask task;
|
private final PregenTask task;
|
||||||
@ -127,6 +129,16 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
return instance.paused();
|
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)
|
public void draw(int x, int z, Color color)
|
||||||
{
|
{
|
||||||
try
|
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
|
@Override
|
||||||
public void onClose() {
|
public void onClose() {
|
||||||
close();
|
close();
|
||||||
|
@ -50,6 +50,8 @@ public class IrisPregenerator {
|
|||||||
private final ChronoLatch minuteLatch;
|
private final ChronoLatch minuteLatch;
|
||||||
private final AtomicReference<String> currentGeneratorMethod;
|
private final AtomicReference<String> currentGeneratorMethod;
|
||||||
private final KSet<Position2> generatedRegions;
|
private final KSet<Position2> generatedRegions;
|
||||||
|
private final KSet<Position2> retry;
|
||||||
|
private final KSet<Position2> net;
|
||||||
|
|
||||||
public IrisPregenerator(PregenTask task, PregeneratorMethod generator, PregenListener listener)
|
public IrisPregenerator(PregenTask task, PregeneratorMethod generator, PregenListener listener)
|
||||||
{
|
{
|
||||||
@ -59,6 +61,8 @@ public class IrisPregenerator {
|
|||||||
this.paused = new AtomicBoolean(false);
|
this.paused = new AtomicBoolean(false);
|
||||||
this.task = task;
|
this.task = task;
|
||||||
this.generator = generator;
|
this.generator = generator;
|
||||||
|
retry = new KSet<>();
|
||||||
|
net = new KSet<>();
|
||||||
currentGeneratorMethod = new AtomicReference<>("Void");
|
currentGeneratorMethod = new AtomicReference<>("Void");
|
||||||
minuteLatch = new ChronoLatch(60000, false);
|
minuteLatch = new ChronoLatch(60000, false);
|
||||||
chunksPerSecond = new RollingSequence(10);
|
chunksPerSecond = new RollingSequence(10);
|
||||||
@ -230,6 +234,31 @@ public class IrisPregenerator {
|
|||||||
listener.onRegionSkipped(x, z);
|
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
|
@Override
|
||||||
public void onClose() {
|
public void onClose() {
|
||||||
listener.onClose();
|
listener.onClose();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user