If Else List Action - apace100/origins-fabric GitHub Wiki
Usable as any action. Currently only available as an entity action. Checks a list of actions associated with conditions, and executes the first one in the list for which the condition holds. Basically a less indentation-heavy way to represent a deeply nested If Else Action.
Type ID: origins:if_else_list
Fields:
actions
, array of objects containing:
-
action
, Actions: The action which is executed when the condition evaluates to true. -
condition
, Conditions: The condition to fulfill.
Example:
"entity_action": {
"type": "origins:if_else_list",
"actions": [
{
"condition": {
"type": "origins:health",
"comparison": "<=",
"compare_to": 6
},
"action": {
"type": "origins:apply_effect",
"effect": {
"effect": "minecraft:speed",
"amplifier": 2,
"duration": 80
}
}
},
{
"condition": {
"type": "origins:health",
"comparison": "<=",
"compare_to": 12
},
"action": {
"type": "origins:apply_effect",
"effect": {
"effect": "minecraft:speed",
"amplifier": 1,
"duration": 80
}
}
},
{
"condition": {
"type": "origins:health",
"comparison": "<=",
"compare_to": 18
},
"action": {
"type": "origins:apply_effect",
"effect": {
"effect": "minecraft:speed",
"amplifier": 0,
"duration": 80
}
}
}
]
}
This action will apply a stronger speed effect the lower the entity's health is, in three stages (<= 3 hearts, <= 6 hearts or <= 9 hearts).
Notes:
Depending on the action type, a different condition type is expected: