Datapack Codex

Random Selector

Minecraft Wiki article. Categories: Java_Edition, Generated_features

📌 Mirrored from Minecraft Wiki

This article is reproduced from Random Selector on the Minecraft Wiki. Mirrored from revision 3642477. 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.

This feature is exclusive to Java Edition.
 

Random selector is a technical feature that randomly chooses a feature from a list with chances.

Data values

ID

Feature typeIdentifier
[No displayed name]random_selector

Config

  • [NBT Compound / JSON Object] config
    • [String][NBT Compound / JSON Object] default: One placed feature (an [String] ID, or a new [NBT Compound / JSON Object] placed feature definition) — Used if none of the below features are chosen.
    • [NBT List / JSON Array] features: (Required, but can be empty) A list of placed features from which to randomly choose.
      • [NBT Compound / JSON Object]: A feature and its corresponding chance.
        • [String][NBT Compound / JSON Object] feature: One placed feature (an [String] ID, or a new [NBT Compound / JSON Object] placed feature definition)
        • [Float] chance: The chance of this feature being chosen. Value between 0.0 and 1.0 (inclusive).

The defined features can either reference a placed feature directly, or can reference a configured feature by nesting another "feature" node within. For more information, see this page on the two allowed types of feature definitions.

Sources