If Else (Meta Action Type)
Runs an action when a condition holds, and optionally another action when it doesn't.
Type ID: apoli:if_else
note
The kind of action depends on the kind of condition:
| Action type | Condition type |
|---|---|
| Bi-entity Action Type | Bi-entity Condition Type |
| Entity Action Type | Entity Condition Type |
| Block Action Type | Block Condition Type |
| Item Action Type | Item Condition Type |
Fields
| Field | Type | Default | Description |
|---|---|---|---|
condition | Condition type | required | A condition of the kind that matches the action. |
if_action | Action type | required | The action that runs when the condition is true. |
else_action | Action type | optional | The action that runs when the condition is false. |
Examples
"entity_action": {
"type": "apoli:if_else",
"condition": {
"type": "apoli:sneaking"
},
"if_action": {
"type": "apoli:set_on_fire",
"duration": 5
},
"else_action": {
"type": "apoli:heal",
"amount": 6
}
}This sets the entity on fire for 5 seconds if it is sneaking, and otherwise restores 3 hearts of health.