Engine fixes

This commit is contained in:
cyberpwn
2021-08-21 06:21:15 -04:00
parent d3998dd03b
commit 203a42c043
5 changed files with 5 additions and 12 deletions
@@ -20,6 +20,7 @@ package com.volmit.iris.engine;
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap; import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.mantle.EngineMantle; import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.mantle.MantleComponent; import com.volmit.iris.engine.mantle.MantleComponent;
@@ -53,8 +54,6 @@ import org.bukkit.util.BlockVector;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@Data @Data
@@ -62,14 +61,15 @@ public class IrisEngineMantle implements EngineMantle {
private final Engine engine; private final Engine engine;
private final Mantle mantle; private final Mantle mantle;
private final KList<MantleComponent> components; private final KList<MantleComponent> components;
private final Future<Integer> radius; private final int radius;
private final AtomicCache<Integer> radCache = new AtomicCache<>();
private ProceduralStream<KList<IrisFeaturePositional>> featureChunkStream; private ProceduralStream<KList<IrisFeaturePositional>> featureChunkStream;
private ProceduralStream<KList<IrisFeaturePositional>> featureStream; private ProceduralStream<KList<IrisFeaturePositional>> featureStream;
public IrisEngineMantle(Engine engine) { public IrisEngineMantle(Engine engine) {
this.engine = engine; this.engine = engine;
this.mantle = new Mantle(new File(engine.getWorld().worldFolder(), "mantle"), engine.getTarget().getHeight()); this.mantle = new Mantle(new File(engine.getWorld().worldFolder(), "mantle"), engine.getTarget().getHeight());
radius = burst().completeValue(this::computeParallaxSize); radius = radCache.aquire(this::computeParallaxSize);
components = new KList<>(); components = new KList<>();
registerComponent(new MantleFeatureComponent(this)); registerComponent(new MantleFeatureComponent(this));
registerComponent(new MantleJigsawComponent(this)); registerComponent(new MantleJigsawComponent(this));
@@ -32,7 +32,6 @@ public abstract class EngineAssignedActuator<T> extends EngineAssignedComponent
@BlockCoordinates @BlockCoordinates
@Override @Override
public void actuate(int x, int z, Hunk<T> output, boolean multicore) { public void actuate(int x, int z, Hunk<T> output, boolean multicore) {
Iris.debug("Engine Actuator[" + getName() + "] " + x + " " + z);
onActuate(x, z, output, multicore); onActuate(x, z, output, multicore);
} }
} }
@@ -33,7 +33,6 @@ public abstract class EngineAssignedModifier<T> extends EngineAssignedComponent
@BlockCoordinates @BlockCoordinates
@Override @Override
public void modify(int x, int z, Hunk<T> output, boolean multicore) { public void modify(int x, int z, Hunk<T> output, boolean multicore) {
Iris.debug("Engine Modifier[" + getName() + "] " + x + " " + z);
onModify(x, z, output, multicore); onModify(x, z, output, multicore);
} }
} }
@@ -51,7 +51,7 @@ public interface EngineMantle extends IObjectPlacer {
Engine getEngine(); Engine getEngine();
Future<Integer> getRadius(); Integer getRadius();
KList<MantleComponent> getComponents(); KList<MantleComponent> getComponents();
@@ -224,7 +224,6 @@ public interface EngineMantle extends IObjectPlacer {
return; return;
} }
Iris.debug("Engine Matter Insert " + x + " " + z);
getMantle().iterateChunk(x, z, t, blocks::set); getMantle().iterateChunk(x, z, t, blocks::set);
} }
@@ -177,7 +177,6 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@Override @Override
public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) { public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) {
Iris.debug("Generate Request " + world.getName() + " at: " + x + ", " + z);
try { try {
if(lastSeed != world.getSeed()) if(lastSeed != world.getSeed())
{ {
@@ -188,14 +187,11 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
Iris.success("Updated Engine seed to " + lastSeed); Iris.success("Updated Engine seed to " + lastSeed);
} }
Iris.debug("Generate Request [LOCKING] at: " + x + ", " + z);
loadLock.acquire(); loadLock.acquire();
Iris.debug("Generate Request [LOCKED] at: " + x + ", " + z);
TerrainChunk tc = TerrainChunk.create(world, biome); TerrainChunk tc = TerrainChunk.create(world, biome);
Hunk<BlockData> blocks = Hunk.view((ChunkData) tc); Hunk<BlockData> blocks = Hunk.view((ChunkData) tc);
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc); Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc);
this.world.bind(world); this.world.bind(world);
Iris.debug("Generate Request [ENGINE] at: " + x + ", " + z);
getEngine().generate(x * 16, z * 16, blocks, biomes, true); getEngine().generate(x * 16, z * 16, blocks, biomes, true);
ChunkData c = tc.getRaw(); ChunkData c = tc.getRaw();
Iris.debug("Generated " + x + " " + z); Iris.debug("Generated " + x + " " + z);