mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
PackBiome.vanillaBiome: the biome vanilla's own rules see a pack biome as
This commit is contained in:
1 parent
f3d1ff8d13
commit
6eac1a87ca
2 files changed
+15
-3
No files matched your search
@@ -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<ResourceId> children) {
|
||||
public record PackBiome(ResourceId id, String name, ResourceId platformBiome, ResourceId vanillaBiome, int rarity,
|
||||
List<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);
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
Reference in new issue
Block a user