This commit is contained in:
Daniel Mills 2021-08-10 06:07:08 -04:00
parent 8928b35f30
commit 4442d9a706
3 changed files with 23 additions and 15 deletions

View File

@ -122,7 +122,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
lastGPS = new AtomicLong(M.ms());
generated = new AtomicInteger(0);
execution = new IrisExecutionEnvironment(this);
mantle = new IrisEngineMantle(this);
// TODO: HEIGHT ------------------------------------------------------------------------------------------------------>
Iris.info("Initializing Engine: " + target.getWorld().name() + "/" + target.getDimension().getLoadKey() + " (" + 256+ " height)");
metrics = new EngineMetrics(32);
@ -151,7 +150,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
cleaning = new AtomicBoolean(false);
cleanLatch = new ChronoLatch(Math.max(10000, Math.min(IrisSettings.get().getParallax()
.getParallaxChunkEvictionMS(), IrisSettings.get().getParallax().getParallaxRegionEvictionMS())));
mantle = new IrisEngineMantle(this);
}
@Override
@ -329,14 +328,16 @@ public class IrisEngine extends BlockPopulator implements Engine {
cleaning.set(true);
try {
getMantle().trim();
getData().getObjectLoader().clean();
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Cleanup failed!");
e.printStackTrace();
}
J.a(() -> {
try {
getMantle().trim();
getData().getObjectLoader().clean();
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Cleanup failed!");
e.printStackTrace();
}
});
cleaning.lazySet(false);
}
@ -388,6 +389,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
getMetrics().getTotal().put(p.getMilliseconds());
generated.incrementAndGet();
recycle();
} catch (Throwable e) {
Iris.reportError(e);
fail("Failed to generate " + x + ", " + z, e);

View File

@ -51,7 +51,6 @@ import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean;
public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChunkGenerator {
private static final BlockData ERROR_BLOCK = Material.RED_GLAZED_TERRACOTTA.createBlockData();
private final EngineProvider provider;
private final IrisWorld world;
private final File dataLocation;
@ -150,7 +149,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
d.setBlock(i, 0, j, ERROR_BLOCK);
d.setBlock(i, 0, j, Material.RED_GLAZED_TERRACOTTA.createBlockData());
}
}

View File

@ -54,14 +54,21 @@ public class EngineProvider {
public Engine getEngine()
{
try {
return engine.get().get();
Engine e = engine.get().get();
if(e == null)
{
throw new RuntimeException("NULL");
}
return e;
} catch (InterruptedException e) {
e.printStackTrace();
throw new RuntimeException("INTERRUPTED");
} catch (ExecutionException e) {
e.printStackTrace();
throw new RuntimeException("EXECUTION ERROR");
}
return null;
}
public void close() {