Clocks

Clocks are another way of defining a function that runs every so often.

clock <name> <time> {
    <...>
}

The time argument is identical to the schedule command's delay argument. It takes a number, and a unit of time.

MC-Build adds the clock function to the minecraft:load tag, and the function schedules itself again each time it runs. So the clock starts when the Data Pack loads.

Examples

Basic 20 Second Clock

This will run the say Hello, world! command every 20 seconds.

clock my_clock 20s {
    say Hello, world!
}

Basic 1 Tick Clock

This will run the say Hello, world! command every tick.

clock my_clock 1t {
    say Hello, world!
}