Skip to content

Criterion

gniftygnome edited this page Jun 24, 2024 · 4 revisions

Using Criteria

ℹ️ This documentation is for Biolith version 3. For Biolith version 2, go here.

The purpose of criteria is to specify the conditions under which a biome should be replaced by a sub-biome. There are several different kinds of criteria, and several different targets for the criteria to match against. Some criteria are containers for other criteria. All criteria except the not criterion return true when they match.

Container Criteria

  • not: Contains one Criterion and inverts its match
  • all_of: Contains a list of type Criterion, all of which must match
  • any_of: Contains a list of type Criterion, at least one of which must match

Biome Criteria

  • original: Matches the specified biome or tag against the originally selected noise biome before replacement by Biolith
  • neighbor: Matches the specified biome or tag against next-closest biome found during noise selection
  • alternate: Matches the specified biome or tag against the replacement biome that would have been selected, if the noise biome selected had been different

Numerical Criteria

All numerical criteria can be specified with only their lower or upper boundary; the other boundary will be effectively ignored.

  • value: Matches when the specified raw noise value being evaluated is within the provided range
  • deviation: Matches when the distance from the center of the selected biome's parameter range to to a selected noise value is within the provided range
  • ratio: Checks whether a computed ratio of the distance to the target's center or edge is within the provided range

in code

  • CriterionBuilder criterion factories by type:
type factories target specifiers
biolith:all_of allOf(Criterion... criteria)
allOf(List<Criterion> criteria)
biolith:any_of anyOf(Criterion... criteria)
anyOf(List<Criterion> criteria)
biolith:not not(Criterion criterion)
biolith:alternate alternate(RegistryKey<Biome> biome, RegistryKey<Biome> alternate)
alternate(TagKey<Biome> tag, RegistryKey<Biome> alternate)
biolith:original original(RegistryKey<Biome> biome)
original(TagKey<Biome> tag)
biolith:neighbor neighbor(RegistryKey<Biome> biome)
neighbor(TagKey<Biome> tag)
biolith:deviation deviation(BiomeParameterTargets parameter, float min, float max)
deviationMin(BiomeParameterTargets parameter, float min)
deviationMax(BiomeParameterTargets parameter, float max)
BiomeParameterTargets:
CONTINENTALNESS
DEPTH
EROSION
HUMIDITY
PEAKS_VALLEYS
TEMPERATURE
WEIRDNESS
biolith:ratio ratio(RatioTargets target, float min, float max), ratioMin(RatioTargets target, float min)
ratioMax(RatioTargets target, float max)
RatioTargets:
CENTER
EDGE
biolith:value value(BiomeParameterTargets parameter, float min, float max)
valueMin(BiomeParameterTargets parameter, float min)
valueMax(BiomeParameterTargets parameter, float max)
BiomeParameterTargets:
CONTINENTALNESS
DEPTH
EROSION
HUMIDITY
PEAKS_VALLEYS
TEMPERATURE
WEIRDNESS
// A criterion to place a sub-biome near the noise center of a biome.
CriterionBuilder.ratioMax(
        RatioTargets.CENTER,
        0.2f);

// A criterion for lining up a modded midlands biome with its associated modded highlands biome.
CriterionBuilder.alternate(
        ModBiomeKeys.MOD_HIGHLANDS,
        BiomeKeys.END_HIGHLANDS);

// A criterion for using the peaks and valleys noise to add clearings to a forest.
CriterionBuilder.deviationMin(
        BiomeParameterTargets.PEAKS_VALLEYS,
        0.05d);

as data

All criteria must specify the full type identifier. Biome criteria may provide either the biome key or a biome tag key in the biome arg. The equivalent of min and max factories is just to omit one of the two args.

  • A criterion to place a sub-biome near the noise center of a biome.
"criterion": {
  "type": "biolith:ratio",
  "target": "center",
  "max": 0.2
}
  • A criterion for lining up a modded midlands biome with its associated modded highlands biome.
"criterion": {
  "type": "biolith:alternate",
  "biome": "mymod:my_highlands",
  "secondary": "minecraft:end_highlands"
}
  • A criterion for using the peaks and valleys noise to add clearings to a forest.
"criterion": {
  "type": "biolith:deviation",
  "target": "peaks_valleys",
  "min": 0.05
}