Last active
April 18, 2018 16:05
-
-
Save JCThePants/a614dddfb82bb1f51b60 to your computer and use it in GitHub Desktop.
Minecraft 1.8.1 chunk packet data format notes from looking at Minecraft 1.8 source. (net.minecraft.server.PacketPlayOutMapChunk)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 chunk sections in a chunk. A chunk is 16x256x16 (x y z) blocks. A chunk section is 16x16x16 blocks. | |
-------------------------------------------------- | |
Chunk: | |
Section: | |
Block Data: 2 bytes per block. 8192 bytes. format: blockId << 4 | meta | |
Emitted Light: 4 bits per block (1/2 byte). 2048 bytes | |
Skylight: 4 bits per block (1/2 byte). 2048 bytes (only included in overworld) | |
Biome: 1 byte per block column. 256 bytes. (only included if all sections are in chunk) | |
-------------------------------------------------- | |
A section mask is used to determine which sections are included in the data. Sections of the chunk that have no blocks (all air blocks) do not get sent with the packet. | |
-------------------------------------------------- | |
Illustration of data layout with only 3 chunk sections included: | |
------- | |
- Block Data section 1 (8192 bytes) | |
- Block Data section 2 (8192 bytes) | |
- Block Data section 3 (8192 bytes) | |
------- | |
- Emitted Light section 1 (2048 bytes) | |
- Emitted Light section 2 (2048 bytes) | |
- Emitted Light section 3 (2048 bytes) | |
------- | |
- Skylight Light section 1 (2048 bytes) (Excluded from nether chunks) | |
- Skylight Light section 2 (2048 bytes) (Excluded from nether chunks) | |
- Skylight Light section 3 (2048 bytes) (Excluded from nether chunks) | |
------- | |
- Biome (256 bytes) (Included for illustration, would not be in data unless all 16 sections are in data) | |
------- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is confusing. Shouldn't the data layout be:
?
EDIT: Nvm, you are right.