User Tools

Site Tools


actions:sequence_handlers:first_to_pass_requirements

minecraft:first_to_pass_requirements

The minecraft:first_to_pass_requirements sequence handler runs the first action in the sequence that passes its requirements and returns its result. The sequence handler is unsuccessful if no actions were executed. If no requirements are present, the action is always executed and returned.

Fields

Name Description Type Default Value
entries The entries of the sequence. An action, list of actions or hash-prefixed action tag

Example

{
  "type": "minecraft:sequence",
  "handler": "minecraft:first_to_pass_requirements",
  "entries": [
    {
      "action": [
        {
          "action": {
            "type": "minecraft:take_honey",
            "position": "target"
          }
        },
        {
          "action": {
            "type": "minecraft:exchange_item",
            "item": "minecraft:honey_bottle"
          }
        }
      ],
      "requirements": {
        "conditions": {
          "condition": "minecraft:location_check",
          "predicate": {
            "block": {
              "state": {
                "honey_level": "5"
              }
            }
          }
        },
        "context": {
          "entity": "this",
          "position": "target"
        }
      }
    },
    {
      "action": {
        "type": "minecraft:invoke_item_event",
        "event": "minecraft:use_on_block"
      }
    }
  ]
}
actions/sequence_handlers/first_to_pass_requirements.txt · Last modified: 2024/05/02 15:11 by errorcraft