Skip to content

Filled out (0x33) Chunk Information #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions networking/packets/051-chunk.md
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
# Chunk
| Packet ID | Direction |
| --- | --- |
| `0x33` | Clientbound |

The packets is sent from the server to the client to update the blocks in the specified area.
The origin coordinate (x,y,z) doesn't need to be chunk aligned.
The to-be-updated volume is given by the width, height and length bytes which the server subtracts 1 from to allow for updating up to a 256x256 area.

## Zlib
Minecraft seems to use the standard zlib implementation Java provides, meaning that, with some hackery, it can even take uncompressed chunk data which may be easier for embedded systems to handle.
For more info, check out the specs of [zlib](https://www.rfc-editor.org/rfc/rfc1950) and [deflate](https://www.rfc-editor.org/rfc/rfc1951).

## Clientbound
| Field | Type | Description |
| --------------- | -------- | ------------------------------------------------ |
| x | Integer | The x-coordinate from which the area starts. |
| y | Short | The y-coordinate from which the area starts. |
| z | Integer | The z-coordinate from which the area starts. |
| width | Byte | The width of the updated area, `-1`. |
| height | Byte | The height of the updated area, `-1`. |
| length | Byte | The length of the updated area, `-1`. |
| compressed size | Integer | The size, in bytes, of the zlib compressed data. |
| compressed data | Byte\[\] | The zlib compressed data. |

<details>
<summary>Example Packet</summary>

| Field | Value |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| x | 0 |
| y | 0 |
| z | 0 |
| width | 15 |
| height | 127 |
| length | 15 |
| compressed size | 256 |
| compressed data | 120,218,237,205,161,13,0,32,16,4,65,2,226,37,253,119,73,7,208,1,136,51,136,25,191,217,26,153,222,50,229,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,255,193,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,219,119,75,175,215,235,245,122,189,94,175,215,235,245,122,189,94,175,215,235,245,122,189,94,175,215,235,245,122,189,94,175,215,235,245,122,189,94,175,215,235,245,122,189,94,175,215,235,245,122,189,94,175,215,235,245,122,125,220,207,3,138,218,152,0 |

</details>