Batch 6 part 3: host side of structure locating and the decoding contract

Structure locating goes through StructureLocator. Ownership records hold
one memo text and no placement identity (schema 3; older records fail
closed). NativeStructureStartsTest drops the identity column of its golden;
the other columns are unchanged.

ModuleSettingsDecoder applies the decoding contract (DecodingContract: null
members are left out, unknown enum names are errors). NoiseStyle no longer
carries cacheSize, a cache knob only. PlacementRequest has no id. Dimension
settings reach LinkedBiomes as PackSettings.
This commit is contained in:
piexel committed 2026-10-24 09:24:18 +02:00
1 parent dc0d61ce63
commit 711fdd078a
31 files changed
+367 -280

No files matched your search

@@ -0,0 +1,107 @@
package art.arcane.iris.core.modules;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
/**
* IrisApi's decoding contract (IrisApi DESIGN.md, "Decoding contract") for the module settings Gson: a member written as
* {@code null} counts as left out, so the field keeps its initialiser, and an enum name the enum does not know is an
* error naming the known ones. Together the host never writes {@code null} into a field it reads.
*/
final class DecodingContract {
private static final List<String> LIBRARY_PACKAGES = List.of("java.", "javax.", "com.google.gson.");
private DecodingContract() {
}
/** {@code builder} with the contract; register it before any factory that should see the JSON as written. */
static GsonBuilder appliedTo(GsonBuilder builder) {
return builder.registerTypeAdapterFactory(new NullMembersLeftOut())
.registerTypeAdapterFactory(new KnownEnumNames());
}
private static boolean readsFields(Class<?> type) {
if (type.isPrimitive() || type.isArray() || type.isEnum() || type.isInterface()) {
return false;
}
String name = type.getName();
return LIBRARY_PACKAGES.stream().noneMatch(name::startsWith);
}
private static final class NullMembersLeftOut implements TypeAdapterFactory {
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!readsFields(type.getRawType())) {
return null;
}
TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);
TypeAdapter<JsonElement> trees = gson.getAdapter(JsonElement.class);
return new TypeAdapter<T>() {
@Override
public void write(JsonWriter out, T value) throws IOException {
delegate.write(out, value);
}
@Override
public T read(JsonReader in) throws IOException {
JsonElement json = trees.read(in);
if (json.isJsonObject()) {
json.getAsJsonObject().entrySet().removeIf(member -> member.getValue().isJsonNull());
}
return delegate.fromJsonTree(json);
}
};
}
}
private static final class KnownEnumNames implements TypeAdapterFactory {
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
Class<? super T> raw = type.getRawType();
if (!raw.isEnum()) {
return null;
}
TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);
return new TypeAdapter<T>() {
@Override
public void write(JsonWriter out, T value) throws IOException {
delegate.write(out, value);
}
@Override
public T read(JsonReader in) throws IOException {
if (in.peek() == JsonToken.NULL) {
in.nextNull();
return null;
}
String name = in.nextString();
T value = delegate.fromJsonTree(new JsonPrimitive(name));
if (value == null) {
throw new JsonParseException("\"" + name + "\" is not one of " + knownNames(raw, delegate));
}
return value;
}
};
}
@SuppressWarnings("unchecked")
private static <T> List<String> knownNames(Class<? super T> type, TypeAdapter<T> delegate) {
return Arrays.stream(type.getEnumConstants())
.map(constant -> delegate.toJsonTree((T) constant).getAsString())
.toList();
}
}
}
@@ -110,7 +110,6 @@ public final class IrisValues {
iris.setMultiplier(style.multiplier());
iris.setFracture(style.fracture().map(fracture -> generatorStyle(fracture, resources)).orElse(null));
iris.setExponent(style.exponent());
iris.setCacheSize(style.cacheSize());
return iris;
}
@@ -83,8 +83,7 @@ public final class ModuleObjectPlacement {
Engine engine = placer.getEngine();
long worldSeed = engine != null ? engine.getSeedManager().getSeed() : rng.nextLong();
ResourceId source = ids.of("object", objectKey);
PlacementRequest request = new PlacementRequest(ids.of("placement/" + objectKey + "/" + x + "/" + requestedY + "/" + z),
geometry, new BlockPosition(x, requestedY, z));
PlacementRequest request = new PlacementRequest(geometry, new BlockPosition(x, requestedY, z));
long seed = ModuleSeeds.placement(worldSeed, objectKey, x, requestedY, z);
StageMetrics metrics = new StageMetrics(engine != null ? engine.getMetrics() : null);
try (ToolWorld toolWorld = engine == null ? new ToolWorld(worldSeed, data.getPackResources(), new PackDeclaredSettings(data)) : null) {
@@ -36,7 +36,6 @@ import com.volmit.service.ObjectsAt;
import com.volmit.service.SaplingGrowth;
import com.volmit.service.StructureLocator;
import com.volmit.service.VanillaFeatures;
import com.volmit.service.VanillaStructures;
import com.volmit.geometry.BlockPosition;
import com.volmit.world.PackWorld;
import java.util.ArrayList;
@@ -283,7 +282,7 @@ public final class ModuleServices {
/** The platform structures the world's modules start themselves, as lower-case registry keys. */
public static Set<String> startedStructures(Engine engine) {
return platformStructures(engine, VanillaStructures::startedStructures);
return platformStructures(engine, StructureLocator::startedStructures);
}
/** Whether a module of the world starts the platform structure {@code key} itself. */
@@ -293,7 +292,7 @@ public final class ModuleServices {
/** Whether a module of the world can find the starts it makes of the platform structure {@code key}. */
public static boolean canLocateStart(Engine engine, String key) {
return key != null && platformStructures(engine, VanillaStructures::locatableStarts).contains(normalized(key));
return key != null && platformStructures(engine, StructureLocator::locatableStarts).contains(normalized(key));
}
/**
@@ -308,7 +307,7 @@ public final class ModuleServices {
if (structure.isEmpty()) {
return StructureSearch.NOT_FOUND;
}
for (Provider<VanillaStructures> provider : providers(engine, VanillaStructures.class)) {
for (Provider<StructureLocator> provider : providers(engine, StructureLocator.class)) {
if (!provider.service().locatableStarts(provider.world()).contains(structure.get())) {
continue;
}
@@ -386,9 +385,9 @@ public final class ModuleServices {
}
/** The platform structures every provider lists with {@code structures}, as lower-case registry keys. */
private static Set<String> platformStructures(Engine engine, BiFunction<VanillaStructures, PackWorld, Set<ResourceId>> structures) {
private static Set<String> platformStructures(Engine engine, BiFunction<StructureLocator, PackWorld, Set<ResourceId>> structures) {
Set<String> keys = new LinkedHashSet<>();
for (Provider<VanillaStructures> provider : providers(engine, VanillaStructures.class)) {
for (Provider<StructureLocator> provider : providers(engine, StructureLocator.class)) {
structures.apply(provider.service(), provider.world()).forEach(id -> keys.add(id.toString()));
}
return keys;
@@ -19,18 +19,24 @@
package art.arcane.iris.core.modules;
import com.volmit.IrisFeature;
import com.volmit.config.LinkedBiomes;
import com.volmit.config.FeatureSettings;
import com.volmit.config.Level;
import com.volmit.config.PackSettings;
import com.volmit.config.SettingsStack;
import com.volmit.host.ConfiguredSettings;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import com.volmit.world.LinkedBiomes;
import java.util.Collection;
import java.util.Comparator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* Module settings one dimension, region, biome or object placement declares, at most one value per settings
@@ -72,10 +78,24 @@ public final class ModuleSettings {
/**
* The keys of the biomes these settings use besides ({@link LinkedBiomes#usedBiomes}), in a fixed order.
*
* @param dimension the settings of the dimension the owner is part of
* @param dimension the settings of the dimension the owner is part of
* @param dimensionKey that dimension's key
*/
public Set<String> usedBiomes(IrisPackResources resources, ModuleSettings dimension) {
return linkedBiomes(resources, linked -> linked.usedBiomes(resources, dimension.values()));
public Set<String> usedBiomes(IrisPackResources resources, ModuleSettings dimension, String dimensionKey) {
PackSettings declared = dimension.declaredByDimension(() -> resources.idOf(IrisPackSettings.DIMENSION + "/" + dimensionKey));
return linkedBiomes(resources, linked -> linked.usedBiomes(resources, declared));
}
/** These settings as what a dimension declares itself: each type a stack of at most its dimension entry. */
private PackSettings declaredByDimension(Supplier<ResourceId> dimension) {
return new PackSettings() {
@Override
public <F extends IrisFeature> SettingsStack<F> declared(Class<F> featureType) {
return find(featureType)
.map(value -> SettingsStack.of(List.of(new FeatureSettings.Entry<>(Level.DIMENSION, dimension.get(), value))))
.orElse(SettingsStack.empty());
}
};
}
private Set<String> linkedBiomes(IrisPackResources resources, Function<LinkedBiomes, Set<ResourceId>> pick) {
@@ -59,7 +59,8 @@ import java.util.stream.Stream;
/**
* Reads the module settings a dimension, region or biome declares: each settings feature of the pack at
* that target, under the key the feature declares. Settings are created with their no-argument
* constructor and the JSON is read into them, so an omitted option keeps its default. A {@link Snippet}
* constructor and the JSON is read into them under IrisApi's {@link DecodingContract}, so an omitted or null option
* keeps its default. A {@link Snippet}
* type may be written as {@code "snippet/<name>"} or, as Iris's own snippets are, {@code "snippet/<snippet folder>/<name>"},
* both read from {@code snippet/<snippet folder>/<name>.json}. IrisApi's value types ({@code BlockSpec},
* {@code NoiseStyle} and the rest) are read like settings, and an {@code Object} as Gson reads any JSON value.
@@ -84,7 +85,7 @@ public final class ModuleSettingsDecoder {
this.packFolder = packFolder;
this.irisGson = irisGson;
PackResourceIds packIds = new PackResourceIds(packFolder.toFile());
this.gson = new GsonBuilder()
this.gson = DecodingContract.appliedTo(new GsonBuilder())
.registerTypeAdapter(BlockState.class, textAdapter(BlockState::parse, BlockState::key))
.registerTypeAdapter(ResourceId.class, textAdapter(text -> resourceIdOf(packIds, text), ResourceId::toString))
.registerTypeAdapterFactory(new HostTypes())
@@ -356,7 +356,7 @@ public final class ModuleStructureFitting implements NativeStructureFitting {
@Override
public Optional<StartMemo> memo() {
NativeStartMemo memo = start.memo();
return memo == null ? Optional.empty() : Optional.of(new StartMemo(memo.terrain(), memo.foundation()));
return memo == null ? Optional.empty() : Optional.of(new StartMemo(memo.text()));
}
@Override
@@ -127,7 +127,7 @@ public final class ModuleVanillaStructures {
if (structure.isEmpty()) {
return List.of(NativeStructureReach.PLATFORM);
}
Optional<StartMemo> startMemo = Optional.ofNullable(memo).map(note -> new StartMemo(note.terrain(), note.foundation()));
Optional<StartMemo> startMemo = Optional.ofNullable(memo).map(note -> new StartMemo(note.text()));
List<NativeStructureReach> reaches = new ArrayList<>(structures.providers.size());
for (ServiceRegistration registration : structures.providers) {
StartReach reach = ask(registration, "reaching around vanilla structure " + structure.get(),
@@ -218,9 +218,8 @@ public final class ModuleVanillaStructures {
start.y() + minHeight,
start.isUnderground(),
start.replacesPlatformStart(),
start.identity(),
start.jigsaw().map(ModuleVanillaStructures::jigsaw).orElse(null),
start.memo().map(memo -> new NativeStartMemo(memo.terrain(), memo.foundation())).orElse(null));
start.memo().map(memo -> new NativeStartMemo(memo.text())).orElse(null));
}
private static NativeJigsawOverrides jigsaw(JigsawOverrides overrides) {
@@ -2,13 +2,12 @@ package art.arcane.iris.engine.framework;
import java.util.Objects;
/**
* What a module noted about a start it placed, as the host keeps it: two texts in the module's own format, one about
* the start's terrain and one about its foundation. The host never reads them.
*/
public record NativeStartMemo(String terrain, String foundation) {
/** The memo a module gave a start it placed, as the host keeps it: one text the host never reads, not empty. */
public record NativeStartMemo(String text) {
public NativeStartMemo {
Objects.requireNonNull(terrain, "terrain");
Objects.requireNonNull(foundation, "foundation");
Objects.requireNonNull(text, "text");
if (text.isEmpty()) {
throw new IllegalArgumentException("A start memo's text must not be empty");
}
}
}
@@ -13,7 +13,6 @@ public record NativeStructureOwnershipRecord(
String structureKey,
int originChunkX,
int originChunkZ,
long placementIdentity,
int baseY,
int contentMinX,
int contentMinY,
@@ -29,7 +28,7 @@ public record NativeStructureOwnershipRecord(
String contentFingerprint,
MemoSnapshot memo
) {
public static final int CURRENT_SCHEMA = 2;
public static final int CURRENT_SCHEMA = 3;
public static final int MAX_REFERENCE_DISTANCE_CHUNKS = 8;
private static final int MAX_KEY_BYTES = 512;
private static final int MAX_FINGERPRINT_BYTES = 128;
@@ -70,7 +69,6 @@ public record NativeStructureOwnershipRecord(
public static NativeStructureOwnershipRecord create(String structureKey,
int originChunkX,
int originChunkZ,
long placementIdentity,
int baseY,
int contentMinX,
int contentMinY,
@@ -90,7 +88,6 @@ public record NativeStructureOwnershipRecord(
structureKey,
originChunkX,
originChunkZ,
placementIdentity,
baseY,
contentMinX,
contentMinY,
@@ -121,7 +118,6 @@ public record NativeStructureOwnershipRecord(
structureKey,
originChunkX,
originChunkZ,
placementIdentity,
baseY,
contentMinX,
contentMinY,
@@ -153,7 +149,6 @@ public record NativeStructureOwnershipRecord(
writeString(output, structureKey, MAX_KEY_BYTES, "structure key");
output.writeInt(originChunkX);
output.writeInt(originChunkZ);
output.writeLong(placementIdentity);
output.writeInt(baseY);
output.writeInt(contentMinX);
output.writeInt(contentMinY);
@@ -181,7 +176,6 @@ public record NativeStructureOwnershipRecord(
readString(input, MAX_KEY_BYTES, "structure key"),
input.readInt(),
input.readInt(),
input.readLong(),
input.readInt(),
input.readInt(),
input.readInt(),
@@ -247,40 +241,30 @@ public record NativeStructureOwnershipRecord(
}
}
/**
* The start's memo as the record stores it: the foundation text, then the terrain text. Records written before
* memos existed hold the JSON of the start's stilts and terrain fit in these two places, which is what the module
* writes as its memo, so they read the same. A start without a memo stores two empty texts.
*/
public record MemoSnapshot(String foundation, String terrain) {
private static final int MAX_MEMO_BYTES = 65_536;
private static final MemoSnapshot NONE = new MemoSnapshot("", "");
/** The start's memo as the record stores it: the module's text, empty for a start without a memo. */
public record MemoSnapshot(String text) {
private static final int MAX_MEMO_BYTES = 131_072;
private static final MemoSnapshot NONE = new MemoSnapshot("");
public MemoSnapshot {
foundation = Objects.requireNonNull(foundation, "Native structure foundation memo must not be null");
terrain = Objects.requireNonNull(terrain, "Native structure terrain memo must not be null");
requireUtf8Limit(foundation, MAX_MEMO_BYTES, "foundation memo");
requireUtf8Limit(terrain, MAX_MEMO_BYTES, "terrain memo");
text = Objects.requireNonNull(text, "Native structure memo must not be null");
requireUtf8Limit(text, MAX_MEMO_BYTES, "memo");
}
public static MemoSnapshot of(NativeStartMemo memo) {
return memo == null ? NONE : new MemoSnapshot(memo.foundation(), memo.terrain());
return memo == null ? NONE : new MemoSnapshot(memo.text());
}
public NativeStartMemo restore() {
return equals(NONE) ? null : new NativeStartMemo(terrain, foundation);
return equals(NONE) ? null : new NativeStartMemo(text);
}
void write(DataOutputStream output) throws IOException {
writeString(output, foundation, MAX_MEMO_BYTES, "foundation memo");
writeString(output, terrain, MAX_MEMO_BYTES, "terrain memo");
writeString(output, text, MAX_MEMO_BYTES, "memo");
}
static MemoSnapshot read(DataInputStream input) throws IOException {
return new MemoSnapshot(
readString(input, MAX_MEMO_BYTES, "foundation memo"),
readString(input, MAX_MEMO_BYTES, "terrain memo")
);
return new MemoSnapshot(readString(input, MAX_MEMO_BYTES, "memo"));
}
}
}
@@ -5,7 +5,7 @@ import java.util.Objects;
/**
* One start of a platform structure a module places, as the platform code builds it: the structure key, the start
* chunk, the world base Y (the structure's lowest block when underground, the planned surface otherwise), whether it
* takes the chunk from a platform start of the same structure, the identity of what placed it, the changes to the
* takes the chunk from a platform start of the same structure, the changes to the
* jigsaw definition it is assembled with (null for none), and the memo the module gave it (null for none), which the
* ownership record keeps for every later chunk of the start.
*/
@@ -16,7 +16,6 @@ public record NativeStructureStartPlan(
int baseY,
boolean underground,
boolean replacesPlatformStart,
long placementIdentity,
NativeJigsawOverrides jigsaw,
NativeStartMemo memo
) {
@@ -37,7 +37,7 @@ import java.util.Set;
* the ones the world's placements assemble from jigsaw pools, and their nearest start, searched with
* {@link IrisStructureLocator}. The keys it places also name the platform structures its native placements start and
* the ones its structures stand in for; it locates those too. The platform's own locate of a natively started
* structure goes through {@link StructureVanillaStructures#locateStart} instead.
* structure goes through {@link #locateStart}, which searches the native placements' rings.
* <p>
* Iris's locator names structures by key: a pack structure by its pack key, a platform structure by its
* {@code namespace:path}. A key with a namespace is that id; any other is the pack's.
@@ -64,7 +64,29 @@ public final class StructureLocating implements StructureLocator {
public LocateResult locate(PackWorld world, ResourceId structure, int fromX, int fromZ, int maxRadiusChunks) {
Engine engine = engine(world);
String key = keyOf(world.resources(), IrisStructureLocator.placedKeysAndAliases(engine), structure);
IrisStructureLocator.LocateResult result = IrisStructureLocator.locate(engine, key, fromX, fromZ, maxRadiusChunks);
return apiResult(engine, IrisStructureLocator.locate(engine, key, fromX, fromZ, maxRadiusChunks));
}
@Override
public Set<ResourceId> startedStructures(PackWorld world) {
return platformIds(IrisStructureLocator.nativeKeys(engine(world)));
}
@Override
public Set<ResourceId> locatableStarts(PackWorld world) {
return platformIds(IrisStructureLocator.locatableNativeKeys(engine(world)));
}
/** Searches the rings of the placements that start {@code structure} natively, as the platform's own locate does. */
@Override
public LocateResult locateStart(PackWorld world, ResourceId structure, int fromX, int fromZ, int maxRings,
ChunkFilter accepts) {
Engine engine = engine(world);
return apiResult(engine, IrisStructureLocator.locateInPlacementRings(
engine, structure.toString(), fromX, fromZ, maxRings, accepts::accepts));
}
private static LocateResult apiResult(Engine engine, IrisStructureLocator.LocateResult result) {
return switch (result.status()) {
case FOUND -> LocateResult.found(new BlockPosition(result.originX(), result.baseY() - engine.getMinHeight(), result.originZ()));
case NOT_FOUND -> LocateResult.NOT_FOUND;
@@ -72,6 +94,14 @@ public final class StructureLocating implements StructureLocator {
};
}
private static Set<ResourceId> platformIds(Set<String> keys) {
Set<ResourceId> ids = new LinkedHashSet<>();
for (String key : keys) {
ids.add(ResourceId.parse(key.toLowerCase(Locale.ROOT)));
}
return ids;
}
private static Engine engine(PackWorld world) {
return world.extension(Engine.class).orElseThrow();
}
@@ -20,13 +20,11 @@ package art.arcane.iris.engine.framework.structure;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.framework.IrisStructureLocator;
import art.arcane.iris.engine.framework.StructurePlacementGrid;
import art.arcane.iris.engine.framework.structure.fit.StartLayouts;
import art.arcane.iris.engine.framework.structure.fit.StructureFitting;
import art.arcane.iris.builtin.structure.StructurePlacement;
import art.arcane.iris.builtin.structure.NativeStructureSuppression;
import com.volmit.resource.ResourceId;
import com.volmit.service.LocateResult;
import com.volmit.service.VanillaStructures;
import com.volmit.vanilla.PlatformStart;
import com.volmit.vanilla.StartMemo;
@@ -37,22 +35,18 @@ import com.volmit.vanilla.VanillaStructureRule;
import com.volmit.vanilla.VanillaStructureSetup;
import com.volmit.vanilla.VanillaStructureStart;
import com.volmit.vanilla.VanillaStructureStartContext;
import com.volmit.geometry.BlockPosition;
import com.volmit.world.PackWorld;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
/**
* What {@code iris:structure} says about the platform's own structures. The dimension's {@code importedStructures}
* settings ({@link ImportedStructures}) disable, move, fit and set them up; the pack's structure placements replace
* them ({@code vanillaSource} with native suppression), place them alongside ({@link IrisStructureLocator#isPlaced}),
* start them where their {@code nativeStructures} grids say ({@link NativeStartPlanner}) and fit those starts the way
* the placement says, which their memo carries to every chunk they reach ({@link StructureFitting}). It names the
* structures its native placements start and finds their starts for the platform's own locate.
* the placement says, which their memo carries to every chunk they reach ({@link StructureFitting}). Finding those
* starts is {@link StructureLocating}'s.
*/
public final class StructureVanillaStructures implements VanillaStructures {
/**
@@ -108,49 +102,16 @@ public final class StructureVanillaStructures implements VanillaStructures {
return ImportedStructures.of(context.settings()).setup();
}
@Override
public Set<ResourceId> startedStructures(PackWorld world) {
return structureIds(IrisStructureLocator.nativeKeys(engine(world)));
}
@Override
public Set<ResourceId> locatableStarts(PackWorld world) {
return structureIds(IrisStructureLocator.locatableNativeKeys(engine(world)));
}
/** Searches the rings of the placements that start {@code structure} natively, as the platform's own locate does. */
@Override
public LocateResult locateStart(PackWorld world, ResourceId structure, int fromX, int fromZ, int maxRings,
ChunkFilter accepts) {
Engine engine = engine(world);
IrisStructureLocator.LocateResult result = IrisStructureLocator.locateInPlacementRings(
engine, structure.toString(), fromX, fromZ, maxRings, accepts::accepts);
return switch (result.status()) {
case FOUND -> LocateResult.found(new BlockPosition(result.originX(), result.baseY() - engine.getMinHeight(), result.originZ()));
case NOT_FOUND -> LocateResult.NOT_FOUND;
case SEARCH_LIMIT_REACHED -> LocateResult.SEARCH_LIMIT_REACHED;
};
}
private static Engine engine(PackWorld world) {
return world.extension(Engine.class).orElseThrow();
}
private static Set<ResourceId> structureIds(Set<String> keys) {
Set<ResourceId> ids = new LinkedHashSet<>();
for (String key : keys) {
ids.add(ResourceId.parse(key.toLowerCase(Locale.ROOT)));
}
return ids;
}
/** {@code plan} as the start the platform generates: heights above the bottom, the placement's identity and fit. */
/** {@code plan} as the start the platform generates: heights above the bottom and the placement's fit. */
static VanillaStructureStart start(NativeStartPlanner.Plan plan, int minHeight) {
StructurePlacement placement = plan.placement();
NativeStructureFit fit = new NativeStructureFit(0, null, false, placement.stilt().orElse(null), placement.resolvedTerrain());
VanillaStructureStart start = VanillaStructureStart.at(ResourceId.parse(plan.source().structure()),
plan.chunkX(), plan.chunkZ(), plan.baseY() - minHeight)
.withIdentity(StructurePlacementGrid.placementIdentity(placement))
.withMemo(fit.memo());
if (placement.underground()) {
start = start.underground();
@@ -347,7 +347,7 @@ public class IrisDimension extends IrisRegistrant {
}
}
addReachableBiomeKeys(pending, getModuleSettings().usedBiomes(data.getPackResources(), getModuleSettings()));
addReachableBiomeKeys(pending, getModuleSettings().usedBiomes(data.getPackResources(), getModuleSettings(), getLoadKey()));
Set<String> visited = new HashSet<>();
while (!pending.isEmpty()) {
@@ -370,7 +370,7 @@ public class IrisDimension extends IrisRegistrant {
biomes.put(loadKey, biome);
addReachableBiomeKeys(pending, biome.getChildren());
addReachableBiomeKeys(pending, biome.getModuleSettings().treeBiomes(data.getPackResources()));
addReachableBiomeKeys(pending, biome.getModuleSettings().usedBiomes(data.getPackResources(), getModuleSettings()));
addReachableBiomeKeys(pending, biome.getModuleSettings().usedBiomes(data.getPackResources(), getModuleSettings(), getLoadKey()));
}
return biomes.v();