Read settings per column with every level as its own entry, add the mantle pipeline, host types and the one-option shorthand

Settings no longer resolve to one value per type. FeatureSettings.at(type, x, z) returns one entry per
level that declares the type at that column (dimension, region, surface biome, placement), each with
its level, source and value; levels stack and a module decides what several mean. Conditional stage
bodies receive every configured entry. Chunk and mantle runners collect a chunk's settings themselves,
so a stage runs when any column of the chunk configures it.

Work that writes the mantle or reaches beyond its chunk moves to a new MANTLE pipeline (Stage.mantle,
MantleRunner) that the host runs around a chunk before it generates. Chunk stages may no longer declare
a reach or mantle writes and see the mantle read-only.

Built-in settings may hold host types the host describes itself (ModuleHost.describingHostTypesIn,
ValueKind.HostKind); pack modules cannot. FeatureSchema.shorthand() names the only option of settings
packs may write as a bare value.
This commit is contained in:
piexel committed 2026-10-08 11:31:03 +02:00
1 parent 09df1af88e
commit 97ac2a2982
61 files changed
+1316 -184

No files matched your search

@@ -13,12 +13,14 @@ import java.util.Set;
* settings types stages are conditioned on), its description for studio and one resolved graph per
* pipeline.
*/
public record LoadedModules(FeatureCatalog catalog, PackSchema schema, ResolvedGraph placement, ResolvedGraph chunk) {
public record LoadedModules(
FeatureCatalog catalog, PackSchema schema, ResolvedGraph placement, ResolvedGraph chunk, ResolvedGraph mantle) {
public LoadedModules {
Objects.requireNonNull(catalog, "catalog");
Objects.requireNonNull(schema, "schema");
Objects.requireNonNull(placement, "placement");
Objects.requireNonNull(chunk, "chunk");
Objects.requireNonNull(mantle, "mantle");
}
/** Pass the built-in modules together with {@link PackModules#modules()} of the pack.
@@ -26,11 +28,14 @@ public record LoadedModules(FeatureCatalog catalog, PackSchema schema, ResolvedG
* @param reservedHostFields JSON fields the host itself uses, per attachment target
* @param reservedNamespaces namespaces only built-in modules may use, such as {@code iris}; a
* pack module whose id uses one fails the load
* @param hostTypePackages packages whose classes the host describes itself, each with its
* subpackages; only built-in modules' settings may use them (see {@link ModuleHost#describingHostTypesIn})
*/
public static LoadedModules load(
List<DiscoveredModule> modules,
Map<FeatureAttachment.Target, Set<String>> reservedHostFields,
Collection<String> reservedNamespaces) {
Collection<String> reservedNamespaces,
Collection<String> hostTypePackages) {
var reserved = ReservedNamespaces.of(reservedNamespaces);
modules.forEach(reserved::requireAllowed);
var registry = new ModuleRegistry(reservedHostFields);
@@ -40,12 +45,13 @@ public record LoadedModules(FeatureCatalog catalog, PackSchema schema, ResolvedG
}
stages.settingsTypes(registry::registeredByOwner).forEach(registry::registerStageSettings);
var catalog = registry.freeze();
var schema = PackSchemaBuilder.describe(catalog, modules);
var schema = PackSchemaBuilder.describe(catalog, modules, HostTypes.of(hostTypePackages));
var placement = stages.resolve(Pipeline.PLACEMENT);
var chunk = stages.resolve(Pipeline.CHUNK);
var mantle = stages.resolve(Pipeline.MANTLE);
requireRegisteredMantleLayers(catalog, placement);
requireRegisteredMantleLayers(catalog, chunk);
return new LoadedModules(catalog, schema, placement, chunk);
requireRegisteredMantleLayers(catalog, mantle);
return new LoadedModules(catalog, schema, placement, chunk, mantle);
}
/** A stage's reach names the layers it writes; a layer nobody registered has no codec or lifetime. */