OverviewPacketsLevelChunk
ID 0x3A · 58Server → ClientWorld
LevelChunk
Sends a full chunk column: serialized sub-chunks, biome palettes, border blocks and block entity NBT in one payload blob.
level-chunk.bin
struct LevelChunk {
ChunkPos Pos;
DimensionType DimensionId;
varuint32 SubChunksCount;
optional byte + varint32 ClientRequestSubChunkLimit;
bool CacheEnabled;
varuint32 [] · SubChunkMetadata[] CacheMetadata;
string SerializedChunk;
}Structure
| Field | Type | Description |
|---|---|---|
| Pos | ChunkPos | |
| Dimension Id | DimensionType | |
| Sub Chunks Count | varuint32 | |
| Client Request Sub Chunk Limit | optional byte + varint32 | Presence flag on the wire; value omitted when absent. |
| Cache Enabled | bool | |
| Cache Metadata | varuint32 count + SubChunkMetadata[] | Length-prefixed sequence. |
| Serialized Chunk | string |
Structure of Serialized Chunk Payload
The uint32-length-prefixed chunk blob, as assembled by PowerNukkitX 3.0.5 for protocol 2193 (LevelDBProvider.requestChunkData).
| Field | Type | Description |
|---|---|---|
| Sub-chunk Sections | Sub-chunk Section × SubChunksCount | Sections bottom→top starting at the dimension's minimum section Y; only up to the highest non-empty section. |
| Biome Palettes | Paletted Storage × SubChunksCount | One 16³ biome storage per sent sub-chunk, in the same order. Heightmaps are not sent — the client derives them. |
| Border Blocks | uint8 count + uint8[] | Education-edition border block column Z-indexes, capped at 255. Vanilla servers write just the 0 count. |
| Block Entities | network NBT tags | Little-endian network NBT compounds of spawnable block entities. An empty list is a single 0x00 byte (TAG_End). |
Structure of Sub-chunk Section
Each serialized sub-chunk starts with its format version and layer count.
| Field | Type | Description |
|---|---|---|
| Version | uint8 | Sub-chunk format version — 9. |
| Layer Count | uint8 | Block storage layers — 2 (second layer is waterlogging). |
| Y | int8 | Sub-chunk Y index relative to the dimension's minimum section. |
| Block Layer 0 | Paletted Storage | Block states; palette entries are network block state hashes when StartGame set Block Network Ids Are Hashes. |
| Block Layer 1 | Paletted Storage | Liquid layer (waterlogged blocks). |
Structure of Paletted Storage (network)
Shared encoding for block and biome data: a bit-packed word array plus a palette of runtime values.
| Field | Type | Description |
|---|---|---|
| Header | uint8 | (bits << 1) | 1 for network format. bits ∈ {1,2,3,4,5,6,8,16}; 0 = uniform storage. A header of 0xFF means "same palette as the previous storage" and nothing else follows. |
| Words | int32 (LE) × ⌈4096·bits/32⌉ | Bit-packed palette indices for the 16³ cells; absent for uniform storage. |
| Palette Size | varint32 | Number of palette entries; omitted for uniform storage. |
| Palette | varint32 × size | Runtime values — block state hashes (blocks) or biome ids (biomes). |
Notes
- The payload is a uint32-length-prefixed blob — the full layout is in the tables below.
- The limited sub-chunk request system: when Sub Chunks Count is 0xFFFFFFFE/0xFFFFFFFF the client pulls missing sub-chunks via SubChunkRequest instead of receiving full columns.
- Cache Enabled pairs with ClientCacheBlobStatus/ClientCacheMissResponse to dedupe unchanged chunks by blob hash.
- Sub Chunks Count counts only up to the highest non-empty section; biome palettes are sent for exactly those sections.
