Loop
Executes an action at the specified amount of times in a single tick.
Type ID: kaya:loop
Format
| Field | Type | Default | Description |
|---|---|---|---|
before_action |
Action | optional | If specified, this action will be executed before the loop starts. |
after_action |
Action | optional | If specified, this action will be executed after the loop completes. |
iterations |
Int Provider | Determines the amount of times this action should be looped. | |
action |
Action | The action to execute for each iteration in the loop. |
Example
{
"type": "kaya:loop",
"iterations": {
"type": "kaya:random/uniform",
"min": 0,
"max": 10
},
"action": {
"type": "kaya:execute_command",
"source": {
"type": "kaya:entity",
"entity": "this"
},
"command": "say Hello!"
}
}
This example makes the entity say "Hello!" a random amount of times (0 to 10 times).
History
| Minecraft | Mod | Changelog |
| 1.21.5 | 0.1.0 | Added the type. |