Wiki 9Minecraft Wiki 9Minecraft

Wait for Asynchronous Conditions with Await

Java EditionModGuides 4FAQ 10Related mods 48
DownloadSwift Adventure Lab Mod

Get the files on 9Minecraft

Contents (4)
  1. Understanding Await
  2. Await a Specific Condition
  3. Await with a Time Delay
  4. Combine with Assertions

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.

More guides for this mod