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

View File

@ -51,7 +51,6 @@ import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChunkGenerator { public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChunkGenerator {
private static final BlockData ERROR_BLOCK = Material.RED_GLAZED_TERRACOTTA.createBlockData();
private final EngineProvider provider; private final EngineProvider provider;
private final IrisWorld world; private final IrisWorld world;
private final File dataLocation; private final File dataLocation;
@ -150,7 +149,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) { 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() public Engine getEngine()
{ {
try { try {
return engine.get().get(); Engine e = engine.get().get();
} catch (InterruptedException e) {
e.printStackTrace(); if(e == null)
} catch (ExecutionException e) { {
e.printStackTrace(); throw new RuntimeException("NULL");
} }
return null; return e;
} catch (InterruptedException e) {
e.printStackTrace();
throw new RuntimeException("INTERRUPTED");
} catch (ExecutionException e) {
e.printStackTrace();
throw new RuntimeException("EXECUTION ERROR");
}
} }
public void close() { public void close() {