Fix seed drift

This commit is contained in:
cyberpwn
2021-09-07 00:27:48 -04:00
parent 405073cca9
commit 80aa87935d
24 changed files with 197 additions and 185 deletions

View File

@@ -100,10 +100,14 @@ public class IrisEngine implements Engine {
private final AtomicCache<IrisEngineData> engineData = new AtomicCache<>();
private final AtomicBoolean cleaning;
private final ChronoLatch cleanLatch;
private final SeedManager seedManager;
public IrisEngine(EngineTarget target, boolean studio) {
this.studio = studio;
this.target = target;
getEngineData();
verifySeed();
this.seedManager = new SeedManager(target.getWorld().getRawWorldSeed());
bud = new AtomicInteger(0);
buds = new AtomicInteger(0);
metrics = new EngineMetrics(32);
@@ -120,9 +124,8 @@ public class IrisEngine implements Engine {
context = new IrisContext(this);
cleaning = new AtomicBoolean(false);
context.touch();
Iris.info("Initializing Engine: " + target.getWorld().name() + "/" + target.getDimension().getLoadKey() + " (" + 256 + " height)");
Iris.info("Initializing Engine: " + target.getWorld().name() + "/" + target.getDimension().getLoadKey() + " (" + 256 + " height) Seed: " + getSeedManager().toString());
getData().setEngine(this);
getEngineData();
minHeight = 0;
failing = false;
closed = false;
@@ -131,6 +134,13 @@ public class IrisEngine implements Engine {
Iris.debug("Engine Initialized " + getCacheID());
}
private void verifySeed() {
if(getEngineData().getSeed() != null && getEngineData().getSeed() != target.getWorld().getRawWorldSeed())
{
target.getWorld().setRawWorldSeed(getEngineData().getSeed());
}
}
private void tickRandomPlayer() {
if (perSecondBudLatch.flip()) {
buds.set(bud.get());