Wiki 9Minecraft Wiki 9Minecraft
Swift Adventure Lab Wiki › Guides › Wait for Asynchronous Conditions with Await

Wait for Asynchronous Conditions with Await

Understanding Await

The /await command pauses your test and repeatedly checks a condition every game tick until it becomes true or times out. This is essential for testing mechanics that take multiple ticks to complete.

Await a Specific Condition

`

/await entity @e[type=armor_stand]

`

This waits until an armor stand exists in the world.

Await with a Time Delay

For simple waiting without a condition, use:

`

/await delay 40

`

This pauses the test for 40 ticks (2 seconds).

Combine with Assertions

Use /await before checking results from slow operations:

`

/dummy Worker mine 5 64 5

/await delay 30

/assert block 5 64 5 air

/succeed

`

If the condition never becomes true before the test timeout, the test automatically fails. Adjust your timeout using the @timeout directive at the top of your test file.