Conditional Composite
Executes the action of an entry whose condition is fulfilled, or executes the specified default action if no entries matched.
Type ID: kaya:conditional/composite
Format
| Field | Type | Default | Description |
|---|---|---|---|
entries |
Array of Entries | The pairs of action and condition to check and execute. | |
default |
Action | optional | If specified, this action will be executed if none of the specified entries were executed. |
Entry
An object that contains the condition to check and the action to execute.
Format
| Field | Type | Default | Description |
|---|---|---|---|
condition |
Condition | The condition to check. | |
action |
Action | The action to execute if the condition is fulfilled. |
Example
{
"type": "kaya:conditional/composite",
"entries": [
{
"condition": {
"type": "kaya:is_entity_sneaking",
"entity": "this"
},
"action": {
"type": "kaya:set_entity_on_fire",
"entity": "this",
"ticks": 200
}
},
{
"condition": {
"type": "kaya:is_entity_climbing",
"entity": "this"
},
"action": {
"type": "kaya:explode",
"block_interaction": "destroy",
"power": 8.0,
"position": {
"type": "kaya:entity/position",
"entity": "this"
}
}
}
],
"default": {
"type": "kaya:execute_command",
"source": "server",
"command": "tellraw @a {\"text\": \"None of the entries matched!\", \"color\": \"gray\", \"italic\": true}"
}
}
This example has two entries: the entity will be set on fire for 5 seconds if they're sneaking, and the entity will explode (with an explosion that has a power of 8 and destroys blocks) if they're climbing.
History
| Minecraft | Mod | Changelog |
| 1.21.5 | 0.1.0 | Added the type. |