diff --git a/src/main/java/com/volmit/world/PackBiome.java b/src/main/java/com/volmit/world/PackBiome.java index d9fbe59ed..4299cf8dd 100644 --- a/src/main/java/com/volmit/world/PackBiome.java +++ b/src/main/java/com/volmit/world/PackBiome.java @@ -5,15 +5,23 @@ import java.util.List; 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. children are the pack biomes that can - * generate inside it. Rarity is relative to the biome's siblings: higher is rarer. + * 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. */ -public record PackBiome(ResourceId id, String name, ResourceId platformBiome, int rarity, List children) { +public record PackBiome(ResourceId id, String name, ResourceId platformBiome, ResourceId vanillaBiome, int rarity, + List 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 children) { + this(id, name, platformBiome, platformBiome, rarity, children); + } } diff --git a/src/test/java/com/volmit/ApiValuesTest.java b/src/test/java/com/volmit/ApiValuesTest.java index b9f0cab4b..41668d765 100644 --- a/src/test/java/com/volmit/ApiValuesTest.java +++ b/src/test/java/com/volmit/ApiValuesTest.java @@ -163,6 +163,10 @@ class ApiValuesTest { assertThrows(UnsupportedOperationException.class, () -> desert.children().clear()); assertThrows(IllegalArgumentException.class, () -> new PackBiome(desert.id(), "Desert", desert.platformBiome(), 0, List.of())); + assertEquals(desert.platformBiome(), desert.vanillaBiome(), "vanilla sees the platform biome unless a pack says otherwise"); + var mesa = new PackBiome(ResourceId.parse("pack:mesa"), "Mesa", ResourceId.parse("minecraft:desert"), + ResourceId.parse("minecraft:badlands"), 1, List.of()); + assertEquals(ResourceId.parse("minecraft:badlands"), mesa.vanillaBiome()); var land = List.of(desert.id()); var arid = new PackRegion(ResourceId.parse("pack:arid"), "Arid", 1, land, List.of(), List.of(), List.of());