Conditional
Executes the respective action if the specified condition is fulfilled or not.
Type ID: kaya:conditional
Format
| Field | Type | Default | Description |
|---|---|---|---|
condition |
Condition | The condition to check. | |
on_true |
Action | optional | If specified, this action will be executed if the condition returns true. |
on_false |
Action | optional | If specified, this action will be executed if the condition returns false. |
Example
{
"type": "kaya:conditional",
"condition": {
"type": "kaya:check_entity_type",
"key": "minecraft:creeper",
"entity": "target"
},
"on_true": {
"type": "kaya:execute_command",
"source": {
"type": "kaya:entity",
"entity": "target"
},
"command": "summon lightning_bolt"
}
}
This example will summon a lightning bolt at the entity referenced by the kaya:target_entity context parameter if it's a creeper.
History
| Minecraft | Mod | Changelog |
| 1.21.5 | 0.1.0 | Added the type. |