Choice Action - apace100/origins-fabric GitHub Wiki

Usable as any action. Selects a random action from a list, while being more likely to pick those with higher weight values.

Type ID: origins:choice

Fields:

actions, array of weighted entries with Actions of the same type: One of these will be chosen randomly based on the weight.

Example:

"entity_action": {
  "type": "origins:choice",
  "actions": [
    {
      "element": {
        "type": "origins:exhaust",
        "amount": 0.5
      },
      "weight": 10
    },
    {
      "element": {    
        "type": "origins:apply_effect",
        "effect": {
          "effect": "minecraft:regeneration",
          "amplifier": 1,
          "duration": 100
        }
      },
      "weight": 10
    },
    {
      "element": {
        "type": "origins:set_on_fire",
        "duration": 8
      },
      "weight": 20
    }
  ]
}

With a chance of 25% (weight / sum of all weights), this action will exhaust the player. With a chance of 25%, it will apply a regeneration effect. With a chance of 50%, it will set the player on fire for 8 seconds.