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