Skip to content

Weighted Entry

fnar edited this page Dec 29, 2021 · 4 revisions

A Weighted Entry wraps another item and adds a weight to it.

The shape of the data depends on what the item being weighted is, for example Loot Rules contain weighted Loot Items.

Weighted Entry Structure

  • {object}
    • "weight": optional integer (defaults to 1) representing the relative weight this choice will be selected in a roll.
    • "data": Represents the contents of this entry. Can be either an object or an array of objects.
      • {object}: The properties of this weighted element; usually depends on the context. In the context of loot, this often means which item
        • "type": The type of loot contained in this entry.
      • [array] (of Weighted Entries): A list of objects like the parent object.

Example Weighted Entry

{"weight": 1, "data": {"name": "minecraft:wheat"}}

Recursive Structure

Weighted entries can contain further elements of like type if their "data" element is an array.

Example Weighted Entry with Recursive Structure

{
  "weight": 1,
  "data": [
    {"weight": 1, "data": {"name": "minecraft:carrot"}}
    {"weight": 1, "data": {"name": "minecraft:bread"}}
  ]
}