Random Selector/Config/Example definitions

📌 Mirrored from Minecraft Wiki

This article is reproduced from Random Selector/Config/Example definitions on the Minecraft Wiki. Mirrored from revision 3642479. It is licensed CC BY-NC-SA 3.0 by the Minecraft Wiki contributors — not under the Codex’s CC BY-SA 4.0, and it may not be used commercially. Edits belong upstream, not here.

The 'random_selector' feature placement type has two ways of selecting a feature. The first way is by directly referencing a placed feature (e.g. "feature": "diamond_ore_placed"), and the second way is by nesting another 'feature' node within the first one, which allows a configured feature to be referenced along with some placement predicates.

An example of a 'random_selector' feature with both methods of specifying a feature is given below.

{
  "type": "random_selector",
  "config": {
    "default": "placed_diamond_ore", // direct reference to a placed feature
    "features": [
      {
        "chance": 0.25,
        "feature": "placed_iron_ore" // direct reference to a placed feature
      },
      {
        "chance": 0.25,
        "feature": {
          "feature": "configured_gold_ore", // reference to a configured feature with a placement predicate
          "placement": [] // can be empty but cannot be omitted
        }
      }
    ]
  }
}

The use of organized file titles is recommended to avoid confusion of which features are 'placed' and which are 'configured'.

Note that circular references can cause the datapack to fail to load or crash upon trying to generate the feature.

Sources