World chunk API

Chunk

A Chunk represents a 16×256×16 (or 16×384×16 in 1.18+) column of blocks in a world. Use it to force-load or release terrain.


Constructor

Chunk(world=None, x=None, z=None)

Reference a chunk by world and chunk coordinates.

Note: Chunk coordinates are block coordinates divided by 16. A block at X=100 is in chunk X=6.

chunk = Chunk("world", 5, 10)

You can also get a chunk from a world:

chunk = await world.chunk_at(5, 10)

Attributes

x

Chunk X coordinate.

z

Chunk Z coordinate.

world

The world this chunk is in.

is_loaded

Whether this chunk is currently loaded in memory.


Methods

load

result = await chunk.load()

Force-load this chunk into memory. If the chunk is already loaded, this is a no-op.

chunk = await world.chunk_at(0, 0)
await chunk.load()

unload

result = await chunk.unload()

Allow this chunk to be unloaded from memory. The server will unload it when no players are nearby.

Warning: Unloading a chunk with players in it may cause issues. Only unload chunks you know are safe to release.