Conditional Composite
Invokes and returns the value provided by an entry whose condition is fulfilled, or the specified default if no entries matched.
Type ID: kaya:conditional/composite
Note
This meta type can only provide the same kind of value of the field where it was used. (e.g: if the field is a boolean provider, the value providers to specify must be a boolean provider, etc.)
Format
| Field | Type | Default | Description |
|---|---|---|---|
entries |
Array of Entries | The entries to check, invoke, and return the value of. | |
default |
Value Provider | The value to provide if none of the entries matched. |
Entry
An object that contains the condition to check and the value to provide.
Format
| Field | Type | Default | Description |
|---|---|---|---|
condition |
Condition | The condition to check. | |
value |
Value Provider | The value to provide if the condition is fulfilled. |
Example
{
"type": "kaya:conditional/composite",
"entries": [
{
"condition": {
"type": "kaya:is_entity_on_fire",
"entity": "actor"
},
"value": {
"type": "kaya:world",
"position": {
"type": "kaya:entity/position",
"entity": "actor"
}
}
},
{
"condition": {
"type": "kaya:is_entity_sneaking",
"entity": "target"
},
"value": {
"type": "kaya:world",
"position": {
"type": "kaya:offset",
"vector": {
"type": "kaya:entity/position",
"entity": "this"
},
"offset": [
0.0,
-1.0,
0.0
]
}
}
}
],
"default": "example:fallback_block"
}
This example is a block provider which has two entries:
- the first one provides the block at the feet of the entity provided by the
kaya:actor_entitycontext parameter if they're on fire - the second one provides the block below the entity provided by the
kaya:target_entitycontext parameter if they're sneaking.
If none of these entries fulfilled their condition, the block provided by the example:fallback_block context parameter will be provided instead.
History
| Minecraft | Mod | Changelog |
| 1.21.5 | 0.1.0 | Added the type. |