Pick regions, biomes and children by weight

Rarity gave every list entry a share of 1 / rarity and children rounded slots; a weight on the list entry says what a pack author means. Dimension regions, region biome lists, biome children and carving children are now entries with a weight (1 to 1000), picked along the list in the order written, region and biome lists giving the edge to the earlier entry and children to the later. A biome keeps itself among its children only where it lists itself. PackBiome and PackRegion carry the weighted lists, and the carving module picks with the API's Weighted.pick. Rarity is gone from biomes and regions, and the three fixture packs are rewritten to the entry format.

No pin or golden moved: the changed generator seed only touches biomes of rarity other than 1, and no pinned world reads one. The fixture packs now have weights where their regions had rarities: pack-before-the-port forests 15, magnetics 1; pack-before-loot-and-spawn hot 10, terralost 6, mushroom 2, swamp 15, the rest 1.

v3: 0fbce6ba2 a598b4323 96beb86e0
This commit is contained in:
piexel committed 2026-11-10 11:46:19 +01:00
1 parent d705dee379
commit 3d55236f97
90 files changed
+1022 -1183

No files matched your search

@@ -7,21 +7,21 @@ import java.util.Objects;
/** A biome of the loaded pack, found through {@code PackResources} by the ids a {@link BiomeSample} gives.
* platformBiome is the platform biome the host writes for it. vanillaBiome is the biome vanilla's own rules see it as,
* such as which structures may start in it: the platform biome unless the pack says otherwise. children are the pack
* biomes that can generate inside it. Rarity is relative to the biome's siblings: higher is rarer.
* biomes that can generate inside it, in the order the child noise walks them; the biome itself is listed among them
* where it stays itself.
*/
public record PackBiome(ResourceId id, String name, ResourceId platformBiome, ResourceId vanillaBiome, int rarity,
List<ResourceId> children) {
public record PackBiome(ResourceId id, String name, ResourceId platformBiome, ResourceId vanillaBiome,
List<Weighted<ResourceId>> children) {
public PackBiome {
Objects.requireNonNull(id, "id");
Objects.requireNonNull(name, "name");
Objects.requireNonNull(platformBiome, "platformBiome");
Objects.requireNonNull(vanillaBiome, "vanillaBiome");
if (rarity < 1) throw new IllegalArgumentException("Biome rarity must be at least 1: " + rarity);
children = List.copyOf(children);
}
/** A biome that vanilla's rules see as its platform biome. */
public PackBiome(ResourceId id, String name, ResourceId platformBiome, int rarity, List<ResourceId> children) {
this(id, name, platformBiome, platformBiome, rarity, children);
public PackBiome(ResourceId id, String name, ResourceId platformBiome, List<Weighted<ResourceId>> children) {
this(id, name, platformBiome, platformBiome, children);
}
}
@@ -5,15 +5,15 @@ import java.util.List;
import java.util.Objects;
/** A region of the loaded pack, found through {@code PackResources} by the id a {@link BiomeSample} gives.
* The biome lists name the pack biomes the region generates on land, at sea, on shores and in caves.
* Rarity is relative to the other regions: higher is rarer.
* The biome lists name the pack biomes the region generates on land, at sea, on shores and in caves, in the order
* the biome noise walks them.
*/
public record PackRegion(ResourceId id, String name, int rarity, List<ResourceId> landBiomes,
List<ResourceId> seaBiomes, List<ResourceId> shoreBiomes, List<ResourceId> caveBiomes) {
public record PackRegion(ResourceId id, String name, List<Weighted<ResourceId>> landBiomes,
List<Weighted<ResourceId>> seaBiomes, List<Weighted<ResourceId>> shoreBiomes,
List<Weighted<ResourceId>> caveBiomes) {
public PackRegion {
Objects.requireNonNull(id, "id");
Objects.requireNonNull(name, "name");
if (rarity < 1) throw new IllegalArgumentException("Region rarity must be at least 1: " + rarity);
landBiomes = List.copyOf(landBiomes);
seaBiomes = List.copyOf(seaBiomes);
shoreBiomes = List.copyOf(shoreBiomes);