Files
Iris/src/main/java/com/volmit/host/ChunkRunner.java
T
piexel 1ce0a19abb Give stages WorldRandom, a SplitMix64 generator whose every method IrisApi defines
java.util.Random fixes only some of its methods; the ranged RandomGenerator
defaults module authors reach for are left to the JDK, so an update could
change existing worlds. WorldRandom does not implement RandomGenerator and
exposes a curated set (ints, longs, ranges, booleans, floats, doubles,
gaussian, chance) with Lemire bounds and the polar gaussian on StrictMath.
StageContext, ObjectGenerationContext and BlockPalette now use it.

StageRandom becomes StageStreams; the seed derivation is unchanged. Every
method is pinned to values from an independent Python reference in
src/test/reference.
2026-10-06 11:36:13 +02:00

31 lines
1.2 KiB
Java

package com.volmit.host;
import com.volmit.generation.GenerationContext;
import com.volmit.stage.Pipeline;
import java.util.Objects;
/** Reference executor of a resolved chunk graph: active stages run once, in resolved order.
* It does not schedule neighbors or roll back hunks; a failed invocation must prevent the host
* from publishing the chunk.
*/
public final class ChunkRunner {
private final ResolvedGraph graph;
public ChunkRunner(ResolvedGraph graph) {
this.graph = Objects.requireNonNull(graph, "graph");
if (graph.pipeline() != Pipeline.CHUNK) {
throw new IllegalArgumentException("Expected a chunk graph, got " + graph.pipeline());
}
}
/** Runs one chunk. The host derives {@code invocationSeed} from the world seed and the chunk
* position; each stage draws from its own stream of that seed ({@link StageStreams}).
*/
public void generate(GenerationContext inputs, long invocationSeed, ConfiguredSettings settings) {
var chunk = new ChunkInvocation(new StageInvocation(graph, invocationSeed, settings), inputs);
for (int position = 0; position < graph.size(); position++) {
chunk.stages().runInvocationStage(position, chunk);
}
}
}