Skip to content

Sub‐Biome Matcher

gniftygnome edited this page Jun 24, 2024 · 12 revisions

Using Sub-Biome Matchers

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

The purpose of sub-biome matchers 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. A sub-biome matcher accepts a list of criteria to check, and if there are more than one criterion in the list, all must match in order for the matcher to match.

The primary distinction between criteria is the criterion type. Depending on the type, different targets can be selected.

Criterion Types

type target description
all_of criteria Evaluates whether all of the provided criteria return true.
any_of criteria Evaluates whether any of the provided criteria return true.
biome alternate Evaluates whether replacement noise of specified target biome would select specified replacement biome.
biome neighbor Checks whether the specified biome is the closest by noise (after the selected biome).
biome original Checks whether the specified biome was the original biome before replacement.
distance continentalness
depth
erosion
humidity
peaks_valleys
temperature
weirdness
Checks whether distance from parameter point center to selected noise is within provided min and max parameters. Varies immensely from biome to biome.
ratio center Checks how close the center of the biome's noise is, expressed in quasi-noise distance from the center.
ratio edge Checks how close the edge of the biome is, with the center of the biome's noise at 0.0 and the edge at roughly 1.0.
value continentalness
depth
erosion
humidity
peaks_valleys
temperature
weirdness
Checks whether selected noise value is within provided min and max parameters. Most noise values are roughly from -2.0 to 2.0.

in code

  • Criterion factories by type:
type factories
all_of ofCriteria
any_of ofCriteria
biome ofBiome, ofAlternate
distance ofRange, ofMin, ofMax
ratio ofRange, ofMin, ofMax
value ofRange, ofMin, ofMax
// A matcher to place a sub-biome near the noise center of a biome.
SubBiomeMatcher.of(Criterion.ofMax(
        CriterionTargets.CENTER,
        CriterionTypes.RATIO,
        0.2f));

// A matcher for lining up a modded midlands biome with its associated modded highlands biome.
SubBiomeMatcher.of(SubBiomeMatcher.Criterion.ofAlternate(
        SubBiomeMatcher.CriterionTargets.ALTERNATE,
        ModBiomeKeys.MOD_HIGHLANDS,
        BiomeKeys.END_HIGHLANDS,
        false));

// A matcher for using the peaks and valleys noise to add clearings to a forest.
SubBiomeMatcher.of(SubBiomeMatcher.Criterion.ofMin(
        SubBiomeMatcher.CriterionTargets.PEAKS_VALLEYS,
        SubBiomeMatcher.CriterionTypes.DISTANCE,
        0.05d));

as data

The datapack interface to sub-biome matchers is less restrictive about type combinations. Take care to follow the tables above, or there can be unexpected results.

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