Skip to content

Subchunk (/) Data Format

Byte Order

Subchunk data is stored in Little Endian byte order.

Parsing The Subchunk

NOTE: Bedrock subchunks are only saved to disk if they have changed since world generation.

NameSize (in bytes)Description
Version1The version of this subchunk.

If Version is 8 and 9

NameSize (in bytes)Description
Block Layer Count1The number of block layers this subchunk has.
Y-Index1The Subchunk Y Position (ranges from -4 to 19). (Only exists if Version is 9)

Now loop the next section Block Layer Count times until you have parsed all block layers.

NameSize (in bits)Description
Palette Type1The type of this palette (0 = Persistence, 1 = Runtime)
Bits Per Word7How many bits are used for each word.

If Palette Type is 0

NameSize (in bytes)Description
Layer Indicesceil(4096[1] ÷ Blocks Per Word[2]) × 4Stored as Blocks Per Word indices, with each unsigned 32-bit integer containing multiple indices, each occupying Bits Per Word bits. The indices are packed and stored in YZX order (Y increments first).
NBT Palette Compound Count4The number of NBT compounds to parse
NBT Palette CompoundsVariableMultiple NBT compounds of individual blocks of the palette used in this subchunk

If Palette Type is 1 (Might not be used in practice)

NameSize (in bytes)Description
Layer Indicesceil(4096[1] ÷ Blocks Per Word[2]) × 4Stored as Blocks Per Word indices, with each unsigned 32-bit integer containing multiple indices, each occupying Bits Per Word bits. The indices are packed and stored in YZX order (Y increments first).
NBT Palette Compound Count1 Signed VarInt (ZigZag)The number of NBT compounds to parse
NBT Palette CompoundsVariableMultiple NBT compounds of individual blocks of the palette used in this subchunk

If Version is 0 or between 2 and 7

NOTE: Second block layer for this version uses LegacyBlockExtraData (4) key instead, rather then being stored with the subchunk like in newer versions of the format.

NameSize (in bytes)Description
Block IDs40968 bits per block. All the block ids for this chunk stored in YZX order (Y increments first)
Block Data20484 bits per block. All the data values for the blocks in this chunk stored in YZX order (Y increments first)
Skylight20484 bits per block. May be omitted. All the skylight data for this chunk stored in YZX order (Y increments first)
Blocklight20484 bits per block. May be omitted. All the blocklight data for this chunk stored in YZX order (Y increments first)

Notes

  1. In some languages you may need to write this as 4096.0 instead of just 4096 for the correct output.
  2. Blocks Per Word = floor(32 ÷ Bits Per Word)

Contributors

The avatar of contributor named as BJTMastermind BJTMastermind

Changelog

Contributors



Documentation page was setup by DexrnZacAttack.