Difference between revisions of "Pre-release protocol"
m (Updated latest pre-release to 21w44a) |
(Added changes for block entity data and chunk data & update light combined packet) |
||
Line 13: | Line 13: | ||
=== Packets === | === Packets === | ||
− | + | ||
+ | {| class="wikitable" | ||
+ | ! ID | ||
+ | ! Packet name | ||
+ | !colspan="2"| Documentation | ||
+ | |- | ||
+ | !colspan="4"| Play clientbound | ||
+ | {{PacketList|0x0A|Block Entity Data}} | ||
+ | {{PacketList|0x22|Chunk Data and Update Light}} | ||
+ | |} | ||
== New/modified data types == | == New/modified data types == | ||
Line 43: | Line 52: | ||
=== Clientbound === | === Clientbound === | ||
− | + | ==== Block Entity Data ==== | |
+ | |||
+ | Sets the block entity associated with the block at the given location. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | |rowspan="3"| 0x0A | ||
+ | |rowspan="3"| Play | ||
+ | |rowspan="3"| Client | ||
+ | | Location | ||
+ | | Position | ||
+ | | | ||
+ | |- {{removed}} | ||
+ | | Action | ||
+ | | Unsigned Byte | ||
+ | | The type of update to perform, see below. | ||
+ | |- {{added}} | ||
+ | | Type | ||
+ | | VarInt | ||
+ | | The type of block entity | ||
+ | |- | ||
+ | | NBT Data | ||
+ | | [[NBT|NBT Tag]] | ||
+ | | Data to set. May be a TAG_END (0), in which case the block entity at the given location is removed (though this is not required since the client will remove the block entity automatically on chunk unload or block removal). | ||
+ | |} | ||
+ | |||
+ | ==== Chunk Data and Update Light ==== | ||
+ | {{Main|Chunk Format}} | ||
+ | {{See also|#Unload Chunk}} | ||
+ | |||
+ | {{Need Info|How do biomes work now? The biome change happened at the same time as the seed change, but it's not clear how/if biomes could be computed given that it's not the actual seed... ([https://www.reddit.com/r/Mojira/comments/e5at6i/a_discussion_for_the_changes_to_how_biomes_are/ /r/mojira discussion] which notes that it seems to be some kind of interpolation, and 3D biomes are only used in the nether)}} | ||
+ | |||
+ | The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which dimension the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent. This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with [[#Update Block Entity|Update Block Entity]] later). | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | !colspan="2"| Field Name | ||
+ | !colspan="2"| Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | |rowspan="32"| {{change|0x20|0x22}} | ||
+ | |rowspan="32"| Play | ||
+ | |rowspan="32"| Client | ||
+ | |colspan="2"| Chunk X | ||
+ | |colspan="2"| Int | ||
+ | | Chunk coordinate (block coordinate divided by 16, rounded down) | ||
+ | |- | ||
+ | |colspan="2"| Chunk Z | ||
+ | |colspan="2"| Int | ||
+ | | Chunk coordinate (block coordinate divided by 16, rounded down) | ||
+ | |- {{removed}} | ||
+ | |colspan="2"| Bit Mask Length | ||
+ | |colspan="2"| VarInt | ||
+ | | Length of the following array | ||
+ | |- {{removed}} | ||
+ | |colspan="2"| Primary Bit Mask | ||
+ | |colspan="2"| Array of Long | ||
+ | | BitSet with bits (world height in blocks / 16) set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from the lowest y to 15 blocks above). | ||
+ | |- | ||
+ | |colspan="2"| Heightmaps | ||
+ | |colspan="2"| [[NBT]] | ||
+ | | Compound containing one long array named <code>MOTION_BLOCKING</code>, which is a heightmap for the highest solid block at each position in the chunk (as a compacted long array with 256 entries at 9 bits per entry totaling 36 longs). The Notchian server also adds a <code>WORLD_SURFACE</code> long array, the purpose of which is unknown, but it's not required for the chunk to be accepted. | ||
+ | |- {{removed}} | ||
+ | |colspan="2"| Biomes length | ||
+ | |colspan="2"| VarInt | ||
+ | | Size of the following array; should always be 1024. {{change|Not present if full chunk is false.|}} | ||
+ | |- {{removed}} | ||
+ | |colspan="2"| Biomes | ||
+ | |colspan="2"| Array of VarInt | ||
+ | | 1024 biome IDs, ordered by x then z then y, in 4×4×4 blocks. {{change|Not present if full chunk is false.|}} See [[Chunk Format#Biomes|Chunk Format § Biomes]]. | ||
+ | |- | ||
+ | |colspan="2"| Size | ||
+ | |colspan="2"| VarInt | ||
+ | | Size of Data in bytes | ||
+ | |- | ||
+ | |colspan="2"| Data | ||
+ | |colspan="2"| Byte array | ||
+ | | See [[Chunk Format#Data structure|data structure]] in Chunk Format | ||
+ | |- | ||
+ | |colspan="2"| Number of block entities | ||
+ | |colspan="2"| VarInt | ||
+ | | Number of elements in the following array | ||
+ | |- {{removed}} | ||
+ | |colspan="2"| Block entities | ||
+ | |colspan="2"| Array of [[NBT|NBT Tag]] | ||
+ | | All block entities in the chunk. Use the x, y, and z tags in the NBT to determine their positions. | ||
+ | |- {{added}} | ||
+ | |rowspan="4" | Block Entity | ||
+ | | Packed XZ | ||
+ | |rowspan="4" | Array | ||
+ | | Byte | ||
+ | | The packed section coordinates, calculated from ((blockX & 15) << 4) | (blockZ & 15) | ||
+ | |- {{added}} | ||
+ | | Y | ||
+ | | Short | ||
+ | | The height relative to the world | ||
+ | |- {{added}} | ||
+ | | Type | ||
+ | | VarInt | ||
+ | | The type of block entity | ||
+ | |- {{added}} | ||
+ | | Data | ||
+ | | [[NBT]] | ||
+ | | The block entity's data, without the X, Y, and Z values | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Trust Edges | ||
+ | |colspan="2"| Boolean | ||
+ | | If edges should be trusted for light updates. | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Length 1 | ||
+ | |colspan="2"| VarInt | ||
+ | | Length of the following array | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Sky Light Mask | ||
+ | |colspan="2"| Array of Long | ||
+ | | BitSet containing bits for each sections in the world + 2 (lowest bit 16-1 blocks below min world height, highest 1-16 above max world height) | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Length 2 | ||
+ | |colspan="2"| VarInt | ||
+ | | Length of the following array | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Block Light Mask | ||
+ | |colspan="2"| Array of Long | ||
+ | | BitSet containing bits for each sections in the world + 2, same order as sky light | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Length 3 | ||
+ | |colspan="2"| VarInt | ||
+ | | Length of the following array | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Empty Sky Light Mask | ||
+ | |colspan="2"| Array of Long | ||
+ | | BitSet containing a variable amount of bits (see sky/block light) which indicates sections that have 0 for all their sky light values | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Length 4 | ||
+ | |colspan="2"| VarInt | ||
+ | | Length of the following array | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Empty Block Light Mask | ||
+ | |colspan="2"| Array of Long | ||
+ | | BitSet containing a variable amount of bits (see sky/block light) which indicates sections that have 0 for all their block light values | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Sky Light array count | ||
+ | |colspan="2"| VarInt | ||
+ | | Number of entries in the following array | ||
+ | |- {{added}} | ||
+ | |rowspan="2"| Sky Light arrays | ||
+ | | Length | ||
+ | |rowspan="2"| Array | ||
+ | | VarInt | ||
+ | | Length of the following array in bytes (always 2048) | ||
+ | |- {{added}} | ||
+ | | Sky Light array | ||
+ | | Array of 2048 bytes | ||
+ | | There is 1 array for each bit set to true in the sky light mask, starting with the lowest value. Half a byte per light value. | ||
+ | |- {{added}} | ||
+ | |colspan="2"| Block Light array count | ||
+ | |colspan="2"| VarInt | ||
+ | | Number of entries in the following array | ||
+ | |- {{added}} | ||
+ | |rowspan="2"| Block Light arrays | ||
+ | | Length | ||
+ | |rowspan="2"| Array | ||
+ | | VarInt | ||
+ | | Length of the following array in bytes (always 2048) | ||
+ | |- {{added}} | ||
+ | | Block Light array | ||
+ | | Array of 2048 bytes | ||
+ | | There is 1 array for each bit set to true in the block light mask, starting with the lowest value. Half a byte per light value. | ||
+ | |} | ||
+ | |||
+ | Note that the Notchian client requires an [[#Update View Position|Update View Position]] packet when it crosses a chunk border, otherwise it'll only display render distance + 2 chunks around the chunk it spawned in. | ||
+ | |||
+ | The compacted array format has been adjusted so that individual entries no longer span across multiple longs, affecting the main data array and heightmaps. | ||
+ | |||
+ | New format, 5 bits per block, containing the following references to blocks in a palette (not shown): <span style="border: solid 2px hsl(0, 90%, 60%)">1</span><span style="border: solid 2px hsl(30, 90%, 60%)">2</span><span style="border: solid 2px hsl(60, 90%, 60%)">2</span><span style="border: solid 2px hsl(90, 90%, 60%)">3</span><span style="border: solid 2px hsl(120, 90%, 60%)">4</span><span style="border: solid 2px hsl(150, 90%, 60%)">4</span><span style="border: solid 2px hsl(180, 90%, 60%)">5</span><span style="border: solid 2px hsl(210, 90%, 60%)">6</span><span style="border: solid 2px hsl(240, 90%, 60%)">6</span><span style="border: solid 2px hsl(270, 90%, 60%)">4</span><span style="border: solid 2px hsl(300, 90%, 60%)">8</span><span style="border: solid 2px hsl(330, 90%, 60%)">0</span><span style="border: solid 2px hsl(0, 90%, 30%)">7</span><span style="border: solid 2px hsl(30, 90%, 30%)">4</span><span style="border: solid 2px hsl(60, 90%, 30%)">3</span><span style="border: solid 2px hsl(90, 90%, 30%)">13</span><span style="border: solid 2px hsl(120, 90%, 30%)">15</span><span style="border: solid 2px hsl(150, 90%, 30%)">16</span><span style="border: solid 2px hsl(180, 90%, 30%)">9</span><span style="border: solid 2px hsl(210, 90%, 30%)">14</span><span style="border: solid 2px hsl(240, 90%, 30%)">10</span><span style="border: solid 2px hsl(270, 90%, 30%)">12</span><span style="border: solid 2px hsl(300, 90%, 30%)">0</span><span style="border: solid 2px hsl(330, 90%, 30%)">2</span> | ||
+ | |||
+ | <code>0020863148418841</code> <code><span style="outline: dashed 2px black">0000</span><span style="outline: solid 2px hsl(330, 90%, 60%)">00000</span><span style="outline: solid 2px hsl(300, 90%, 60%)">01000</span><span style="outline: solid 2px hsl(270, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(240, 90%, 60%)">00110</span><span style="outline: solid 2px hsl(210, 90%, 60%)">00110</span><span style="outline: solid 2px hsl(180, 90%, 60%)">00101</span><span style="outline: solid 2px hsl(150, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(120, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(90, 90%, 60%)">00011</span><span style="outline: solid 2px hsl(60, 90%, 60%)">00010</span><span style="outline: solid 2px hsl(30, 90%, 60%)">00010</span><span style="outline: solid 2px hsl(0, 90%, 60%)">00001</span></code><br> | ||
+ | <code>01018A7260F68C87</code> <code><span style="outline: dashed 2px black">0000</span><span style="outline: solid 2px hsl(330, 90%, 30%)">00010</span><span style="outline: solid 2px hsl(300, 90%, 30%)">00000</span><span style="outline: solid 2px hsl(270, 90%, 30%)">01100</span><span style="outline: solid 2px hsl(240, 90%, 30%)">01010</span><span style="outline: solid 2px hsl(210, 90%, 30%)">01110</span><span style="outline: solid 2px hsl(180, 90%, 30%)">01001</span><span style="outline: solid 2px hsl(150, 90%, 30%)">10000</span><span style="outline: solid 2px hsl(120, 90%, 30%)">01111</span><span style="outline: solid 2px hsl(90, 90%, 30%)">01101</span><span style="outline: solid 2px hsl(60, 90%, 30%)">00011</span><span style="outline: solid 2px hsl(30, 90%, 30%)">00100</span><span style="outline: solid 2px hsl(0, 90%, 30%)">00111</span></code> | ||
=== Serverbound === | === Serverbound === |
Revision as of 15:15, 4 November 2021
This page documents the changes from the last stable Minecraft release (currently 1.17.1, protocol 756) to the current pre-release (currently 21w44a, protocol Snapshot 48). Note that this page contains bleeding-edge information that may not be completely or correctly documented.
One who wishes to commandeer the merging of this into Protocol when an update is made must be sure to respect any changes that may have occurred to the respective packets there.
Contents
Data types
No changes so far.
Packets
ID | Packet name | Documentation | |
---|---|---|---|
Play clientbound | |||
0x0A | Block Entity Data | Current | Pre |
0x22 | Chunk Data and Update Light | Current | Pre |
New/modified data types
No changes so far.
Entity Metadata
No changes so far.
Entity
No changes so far.
Block Actions
No changes so far.
Inventories
No changes so far.
Plugin Channels
No changes so far.
Play
Clientbound
Block Entity Data
Sets the block entity associated with the block at the given location.
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
0x0A | Play | Client | Location | Position | |
Action | Unsigned Byte | The type of update to perform, see below. | |||
Type | VarInt | The type of block entity | |||
NBT Data | NBT Tag | Data to set. May be a TAG_END (0), in which case the block entity at the given location is removed (though this is not required since the client will remove the block entity automatically on chunk unload or block removal). |
Chunk Data and Update Light
- Main article: Chunk Format
- See also: #Unload Chunk
The following information needs to be added to this page: | |
How do biomes work now? The biome change happened at the same time as the seed change, but it's not clear how/if biomes could be computed given that it's not the actual seed... (/r/mojira discussion which notes that it seems to be some kind of interpolation, and 3D biomes are only used in the nether) |
The server only sends skylight information for chunk pillars in the Overworld, it's up to the client to know in which dimension the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent. This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with Update Block Entity later).
Packet ID | State | Bound To | Field Name | Field Type | Notes | ||
---|---|---|---|---|---|---|---|
Play | Client | Chunk X | Int | Chunk coordinate (block coordinate divided by 16, rounded down) | |||
Chunk Z | Int | Chunk coordinate (block coordinate divided by 16, rounded down) | |||||
Bit Mask Length | VarInt | Length of the following array | |||||
Primary Bit Mask | Array of Long | BitSet with bits (world height in blocks / 16) set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from the lowest y to 15 blocks above). | |||||
Heightmaps | NBT | Compound containing one long array named MOTION_BLOCKING , which is a heightmap for the highest solid block at each position in the chunk (as a compacted long array with 256 entries at 9 bits per entry totaling 36 longs). The Notchian server also adds a WORLD_SURFACE long array, the purpose of which is unknown, but it's not required for the chunk to be accepted.
| |||||
Biomes length | VarInt | Size of the following array; should always be 1024. | |||||
Biomes | Array of VarInt | 1024 biome IDs, ordered by x then z then y, in 4×4×4 blocks. | |||||
Size | VarInt | Size of Data in bytes | |||||
Data | Byte array | See data structure in Chunk Format | |||||
Number of block entities | VarInt | Number of elements in the following array | |||||
Block entities | Array of NBT Tag | All block entities in the chunk. Use the x, y, and z tags in the NBT to determine their positions. | |||||
Block Entity | Packed XZ | Array | Byte | (blockZ & 15) | |||
Y | Short | The height relative to the world | |||||
Type | VarInt | The type of block entity | |||||
Data | NBT | The block entity's data, without the X, Y, and Z values | |||||
Trust Edges | Boolean | If edges should be trusted for light updates. | |||||
Length 1 | VarInt | Length of the following array | |||||
Sky Light Mask | Array of Long | BitSet containing bits for each sections in the world + 2 (lowest bit 16-1 blocks below min world height, highest 1-16 above max world height) | |||||
Length 2 | VarInt | Length of the following array | |||||
Block Light Mask | Array of Long | BitSet containing bits for each sections in the world + 2, same order as sky light | |||||
Length 3 | VarInt | Length of the following array | |||||
Empty Sky Light Mask | Array of Long | BitSet containing a variable amount of bits (see sky/block light) which indicates sections that have 0 for all their sky light values | |||||
Length 4 | VarInt | Length of the following array | |||||
Empty Block Light Mask | Array of Long | BitSet containing a variable amount of bits (see sky/block light) which indicates sections that have 0 for all their block light values | |||||
Sky Light array count | VarInt | Number of entries in the following array | |||||
Sky Light arrays | Length | Array | VarInt | Length of the following array in bytes (always 2048) | |||
Sky Light array | Array of 2048 bytes | There is 1 array for each bit set to true in the sky light mask, starting with the lowest value. Half a byte per light value. | |||||
Block Light array count | VarInt | Number of entries in the following array | |||||
Block Light arrays | Length | Array | VarInt | Length of the following array in bytes (always 2048) | |||
Block Light array | Array of 2048 bytes | There is 1 array for each bit set to true in the block light mask, starting with the lowest value. Half a byte per light value. |
Note that the Notchian client requires an Update View Position packet when it crosses a chunk border, otherwise it'll only display render distance + 2 chunks around the chunk it spawned in.
The compacted array format has been adjusted so that individual entries no longer span across multiple longs, affecting the main data array and heightmaps.
New format, 5 bits per block, containing the following references to blocks in a palette (not shown): 122344566480743131516914101202
0020863148418841
0000000000100000100001100011000101001000010000011000100001000001
01018A7260F68C87
0000000100000001100010100111001001100000111101101000110010000111
Serverbound
No changes so far.
Status
Clientbound
No changes so far.
Serverbound
No changes so far.
Login
Clientbound
No changes so far.
Serverbound
No changes so far.