mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-02 19:22:08 +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;
|
import java.util.Objects;
|
||||||
|
|
||||||
/** A biome of the loaded pack, found through {@code PackResources} by the ids a {@link BiomeSample} gives.
|
/** 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
|
* platformBiome is the platform biome the host writes for it. vanillaBiome is the biome vanilla's own rules see it as,
|
||||||
* generate inside it. Rarity is relative to the biome's siblings: higher is rarer.
|
* 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 {
|
public PackBiome {
|
||||||
Objects.requireNonNull(id, "id");
|
Objects.requireNonNull(id, "id");
|
||||||
Objects.requireNonNull(name, "name");
|
Objects.requireNonNull(name, "name");
|
||||||
Objects.requireNonNull(platformBiome, "platformBiome");
|
Objects.requireNonNull(platformBiome, "platformBiome");
|
||||||
|
Objects.requireNonNull(vanillaBiome, "vanillaBiome");
|
||||||
if (rarity < 1) throw new IllegalArgumentException("Biome rarity must be at least 1: " + rarity);
|
if (rarity < 1) throw new IllegalArgumentException("Biome rarity must be at least 1: " + rarity);
|
||||||
children = List.copyOf(children);
|
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(UnsupportedOperationException.class, () -> desert.children().clear());
|
||||||
assertThrows(IllegalArgumentException.class,
|
assertThrows(IllegalArgumentException.class,
|
||||||
() -> new PackBiome(desert.id(), "Desert", desert.platformBiome(), 0, List.of()));
|
() -> 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 land = List.of(desert.id());
|
||||||
var arid = new PackRegion(ResourceId.parse("pack:arid"), "Arid", 1, land, List.of(), List.of(), List.of());
|
var arid = new PackRegion(ResourceId.parse("pack:arid"), "Arid", 1, land, List.of(), List.of(), List.of());
|
||||||
|
|||||||
Reference in new issue
Block a user