Support weighted region and biome references

- Accept {region|biome, weight} objects as well as plain strings in regions, land/sea/shore/caveBiomes and children
- Pick from lists with an object entry by weight slots in list order, keep the rarity pick for string-only lists
- Leave the parent out of weighted child picks unless it is listed
- Describe both forms in the schema and update its digest
- Read weighted references in mod ingest
This commit is contained in:
piexel committed 2026-11-18 12:05:23 +01:00
1 parent ed037ea40b
commit d41cbeb6db
63 files changed
+1624 -317

No files matched your search

@@ -28,9 +28,9 @@ public final class BiomeTypes {
public static SortedMap<String, String> of(List<IrisRegion> regions, Function<String, IrisBiome> biomes) {
SortedMap<String, SortedSet<String>> types = new TreeMap<>();
for (IrisRegion region : regions) {
visit(region.getLandBiomes(), LAND, biomes, types);
visit(region.getSeaBiomes(), SEA, biomes, types);
visit(region.getShoreBiomes(), SHORE, biomes, types);
visit(region.getLandBiomeKeys(), LAND, biomes, types);
visit(region.getSeaBiomeKeys(), SEA, biomes, types);
visit(region.getShoreBiomeKeys(), SHORE, biomes, types);
}
SortedMap<String, String> joined = new TreeMap<>();
for (Map.Entry<String, SortedSet<String>> entry : types.entrySet()) {
@@ -50,7 +50,7 @@ public final class BiomeTypes {
types.computeIfAbsent(key, ignored -> new TreeSet<>()).add(type);
IrisBiome biome = biomes.apply(key);
if (biome != null) {
pending.addAll(biome.getChildren());
pending.addAll(biome.getChildKeys());
}
}
}
@@ -1,6 +1,7 @@
package art.arcane.iris.probe.fidelity;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.biome.IrisBiomeEntry;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.volmlib.util.collection.KList;
import org.junit.Test;
@@ -37,10 +38,14 @@ public class BiomeTypesTest {
}
private static IrisRegion region(List<String> land, List<String> sea, List<String> shore) {
return new IrisRegion().setLandBiomes(new KList<>(land)).setSeaBiomes(new KList<>(sea)).setShoreBiomes(new KList<>(shore));
return new IrisRegion().setLandBiomes(entries(land)).setSeaBiomes(entries(sea)).setShoreBiomes(entries(shore));
}
private static IrisBiome biome(String... children) {
return new IrisBiome().setChildren(new KList<>(List.of(children)));
return new IrisBiome().setChildren(entries(List.of(children)));
}
private static KList<IrisBiomeEntry> entries(List<String> keys) {
return IrisBiomeEntry.plainList(keys.toArray(String[]::new));
}
}