Skip to main content
The Chunks surface provides methods for checking whether chunks are loaded and asserting on chunk state. Use ChunkTestAdapter to query chunk status and ChunkAssert to verify loading expectations. Chunk testing matters when your mod relies on chunks being loaded before performing operations - spawning entities, placing blocks, or running world queries. A test that assumes a chunk is loaded when it is not can produce false positives or cryptic failures. Chunk assertions make these dependencies explicit.

Complete Example Suite

Adapter Methods

Assertion Methods

Key Details

  • Chunk coordinates are block coordinates divided by chunk size, not raw block positions. Block (160, 64, 160) with a chunk size of 16 falls in chunk (10, 10).
  • Spawning an entity or placing a block may trigger chunk loading - wait a few ticks before asserting.
  • Use assertChunkNotLoaded to verify that chunks outside the active area are properly unloaded, which is important for memory testing.

Next Steps