mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-19 22:50:21 +00:00
Reset Region cache option.
This commit is contained in:
@@ -46,10 +46,11 @@ public class CommandPregen implements DecreeExecutor {
|
||||
World world,
|
||||
@Param(aliases = "middle", description = "The center location of the pregen. Use \"me\" for your current location", defaultValue = "0,0")
|
||||
Vector center,
|
||||
@Param(aliases = "optimizer", description = "If it should run the optimizer automatically after the pregen is finished", defaultValue = "false")
|
||||
boolean optimizer,
|
||||
@Param(aliases = "gui", description = "Enable or disable the Iris GUI.", defaultValue = "true")
|
||||
boolean gui
|
||||
boolean gui,
|
||||
@Param(aliases = "resetCache", description = "If it should reset the generated region cache", defaultValue = "false")
|
||||
boolean resetCache
|
||||
|
||||
) {
|
||||
try {
|
||||
if (sender().isPlayer() && access() == null) {
|
||||
@@ -60,7 +61,7 @@ public class CommandPregen implements DecreeExecutor {
|
||||
int w = (radius >> 9 + 1) * 2;
|
||||
IrisToolbelt.pregenerate(PregenTask
|
||||
.builder()
|
||||
.optimizer(optimizer)
|
||||
.resetCache(resetCache)
|
||||
.center(new Position2(center.getBlockX() >> 9, center.getBlockZ() >> 9))
|
||||
.gui(!GraphicsEnvironment.isHeadless() && gui)
|
||||
.width(w)
|
||||
|
||||
@@ -170,11 +170,12 @@ public class IrisPregenerator {
|
||||
shutdown();
|
||||
if (!IrisPackBenchmarking.benchmarkInProgress) {
|
||||
Iris.info(C.IRIS + "Pregen stopped.");
|
||||
if (totalChunks.get() == generated.get() && task.isOptimizer()) {
|
||||
Iris.info("Starting World Optimizer..");
|
||||
ChunkUpdater updater = new ChunkUpdater(generator.getWorld());
|
||||
updater.start();
|
||||
}
|
||||
// todo: optimizer just takes too long.
|
||||
// if (totalChunks.get() == generated.get() && task.isOptimizer()) {
|
||||
// Iris.info("Starting World Optimizer..");
|
||||
// ChunkUpdater updater = new ChunkUpdater(generator.getWorld());
|
||||
// updater.start();
|
||||
// }
|
||||
} else {
|
||||
IrisPackBenchmarking.instance.finishedBenchmark(chunksPerSecondHistory);
|
||||
}
|
||||
@@ -308,6 +309,12 @@ public class IrisPregenerator {
|
||||
}
|
||||
|
||||
public void loadCompletedRegions() {
|
||||
if(task.isResetCache()) {
|
||||
File test = new File(generator.getWorld().getWorldFolder().getPath() + "/" + saveFile);
|
||||
if(!test.delete()) {
|
||||
Iris.info(C.RED + "Failed to reset region cache ");
|
||||
}
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
try (Reader reader = new FileReader(generator.getWorld().getWorldFolder().getPath() + "/" + saveFile)) {
|
||||
Type setType = new TypeToken<HashSet<Position2>>(){}.getType();
|
||||
|
||||
@@ -35,11 +35,12 @@ public class PregenTask {
|
||||
private static final KList<Position2> ORDER_CENTER = computeChunkOrder();
|
||||
private static final KMap<Position2, KList<Position2>> ORDERS = new KMap<>();
|
||||
|
||||
|
||||
@Builder.Default
|
||||
private boolean resetCache = false;
|
||||
@Builder.Default
|
||||
private boolean gui = false;
|
||||
@Builder.Default
|
||||
private boolean optimizer = false;
|
||||
@Builder.Default
|
||||
private Position2 center = new Position2(0, 0);
|
||||
@Builder.Default
|
||||
private int width = 1;
|
||||
|
||||
Reference in New Issue
Block a user