Skip to content

Instantly share code, notes, and snippets.

@dktapps
Last active September 29, 2019 11:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dktapps/7fc73369db44ad2f8d7692132656e27b to your computer and use it in GitHub Desktop.
Save dktapps/7fc73369db44ad2f8d7692132656e27b to your computer and use it in GitHub Desktop.
Network chunk specification as of MCPE 1.0

MCPE 1.0 Network Chunk specification

Note: the accuracy of this specification may be flawed. This specification is believed to be correct as of beta 1.0.0.7, but its accuracy is by no means guaranteed.

Basic changes

Biome colour removal

The ability to set biome colours disappeared this update, which is a shame. The old method using biome IDs is back; colours and gradients are now handled automatically client side. While this is a bonus for PocketMine in the way that biome colours in Anvil worlds will now work correctly again, it's a shame to see that capability disappear.

Subchunks

Chunks are now sent in an Anvil-style format, as a series of Subchunks (16x16x16 cubes), however instead of free-floating chunks, the subchunks (as they are called) are always in a stack, i.e. if a subchunk is present, everything below it will also be present. More information on this can be found at https://www.reddit.com/r/MCPE/comments/5cw2tm/level_format_changes_in_mcpe_0171_100/d9zv9s8/

Subchunk 3D data order is always sent in order XZY ((X << 8) | (Z << 4) | Y). The capability to use YZX was unfortunately removed this update, so if you were using this to support Anvil worlds, you will need to re-order thr data to XZY before sending it.

2D data order is as yet unconfirmed.

Full Chunk Data Packet

1 signed varint: chunkX
1 signed varint: chunkZ
1 string: payload

Payload content

1 byte: count of subchunks in the packet
	Subchunks:
		1 byte: subchunk format version (always 0 currently, useless byte)
		4096 bytes of block IDs (1 byte per entry, order XZY)
		2048 bytes of block data (4 bits per entry, order XZY)
		2048 bytes of sky light (4 bits per entry, order XZY)
		2048 bytes of block light (4 bits per entry, order XZY)
512 bytes: heightmap data (1 short per entry, order unverified)
256 bytes: biome id data (1 byte per entry, order unverified)
1 byte: border block count
	Border blocks:
		1 byte containing chunk block XZ coordinates (unknown which way round, 4 bits for each
1 signed varint: block extra data count
	Block extra data:
		1 signed varint: chunk block coords (XZY, 4 bits for each)
		1 short: block extra data value
Here to the end of the buffer: tile NBT data (varint NBT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment