Difference between revisions of "Pre-release protocol"
m (1.18-rc1) |
(Documented the client settings packet changes.) |
||
Line 40: | Line 40: | ||
{{PacketList|{{change|0x65|0x66}}|Declare Recipes|pre=unchanged}} | {{PacketList|{{change|0x65|0x66}}|Declare Recipes|pre=unchanged}} | ||
{{PacketList|{{change|0x66|0x67}}|Tags|pre=unchanged}} | {{PacketList|{{change|0x66|0x67}}|Tags|pre=unchanged}} | ||
+ | |- | ||
+ | !colspan="4"| Play serverbound | ||
+ | {{PacketList|0x05|Client Settings}} | ||
+ | |||
|} | |} | ||
+ | |||
== New/modified data types == | == New/modified data types == | ||
Line 796: | Line 801: | ||
=== Serverbound === | === Serverbound === | ||
− | + | ==== Client Settings ==== | |
+ | |||
+ | Sent when the player connects, or when settings are changed. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | |rowspan="8"| 0x05 | ||
+ | |rowspan="8"| Play | ||
+ | |rowspan="8"| Server | ||
+ | | Locale | ||
+ | | String (16) | ||
+ | | e.g. <code>en_GB</code>. | ||
+ | |- | ||
+ | | View Distance | ||
+ | | Byte | ||
+ | | Client-side render distance, in chunks. | ||
+ | |- | ||
+ | | Chat Mode | ||
+ | | VarInt Enum | ||
+ | | 0: enabled, 1: commands only, 2: hidden. See [[Chat#Processing chat|processing chat]] for more information. | ||
+ | |- | ||
+ | | Chat Colors | ||
+ | | Boolean | ||
+ | | “Colors” multiplayer setting. | ||
+ | |- | ||
+ | | Displayed Skin Parts | ||
+ | | Unsigned Byte | ||
+ | | Bit mask, see below. | ||
+ | |- | ||
+ | | Main Hand | ||
+ | | VarInt Enum | ||
+ | | 0: Left, 1: Right. | ||
+ | |- | ||
+ | | Disable text filtering | ||
+ | | Boolean | ||
+ | | Disables filtering of text on signs and written book titles. Currently always true (i.e. the filtering is disabled) | ||
+ | |- {{added}} | ||
+ | | Allow server listings | ||
+ | | Boolean | ||
+ | | Servers usually list online players, this option should let you not show up in that list. | ||
+ | |} | ||
+ | |||
+ | ''Displayed Skin Parts'' flags: | ||
+ | |||
+ | * Bit 0 (0x01): Cape enabled | ||
+ | * Bit 1 (0x02): Jacket enabled | ||
+ | * Bit 2 (0x04): Left Sleeve enabled | ||
+ | * Bit 3 (0x08): Right Sleeve enabled | ||
+ | * Bit 4 (0x10): Left Pants Leg enabled | ||
+ | * Bit 5 (0x20): Right Pants Leg enabled | ||
+ | * Bit 6 (0x40): Hat enabled | ||
+ | |||
+ | The most significant bit (bit 7, 0x80) appears to be unused. | ||
== Status == | == Status == |
Revision as of 21:53, 28 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 1.18-rc1, protocol Snapshot 57). 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
Packets
ID | Packet name | Documentation | |
---|---|---|---|
Play clientbound | |||
0x0A | Block Entity Data | Current | Pre |
0x22 | Chunk Data and Update Light | Current | Pre |
0x26 | Join Game | Current | Pre |
0x57 | Update Simulation Distance | Pre | |
Set Title SubTitle | Current | (unchanged) | |
Time Update | Current | (unchanged) | |
Set Title Text | Current | (unchanged) | |
Set Title Times | Current | (unchanged) | |
Entity Sound Effect | Current | (unchanged) | |
Sound Effect | Current | (unchanged) | |
Stop Sound | Current | (unchanged) | |
Player List Header And Footer | Current | (unchanged) | |
NBT Query Response | Current | (unchanged) | |
Collect Item | Current | (unchanged) | |
Entity Teleport | Current | (unchanged) | |
Advancements | Current | (unchanged) | |
Entity Properties | Current | (unchanged) | |
Entity Effect | Current | (unchanged) | |
Declare Recipes | Current | (unchanged) | |
Tags | Current | (unchanged) | |
Play serverbound | |||
0x05 | Client Settings | Current | Pre |
New/modified data types
Chunk Section
The data section of the packet contains most of the useful data for the chunk.
Field Name | Field Type | Notes |
---|---|---|
Data | Array of Chunk Section | The number of elements in the array is |
Chunk Section structure
A Chunk Section is defined in terms of other data types. A Chunk Section consists of the following fields:
Field Name | Field Type | Notes |
---|---|---|
Block count | Short | Number of non-air blocks present in the chunk section. "Non-air" is defined as any block other than air, cave air, and void air (in particular, note that fluids such as water are still counted). The client uses this to unload chunks empty chunks. It will keep count of the blocks as they are broken/placed and if this integer reaches 0 the whole chunk section is not rendered, even though there may still be blocks left, if the server sends an incorrect block count. |
Bits Per Block | Unsigned Byte | Determines how many bits are used to encode a block. Note that not all numbers are valid here. |
Palette | Varies | See below for the format. |
Data Array Length | VarInt | Number of longs in the following array |
Data Array | Array of Long | Compacted list of 4096 (16x16x16) indices pointing to state IDs in the Palette (see Compacted data array) |
Block states | Paletted Container | Consists of 4096 entries, representing all the blocks in the chunk section |
Biomes | Paletted Container | Consists of 64 entries, representing 4x4x4 biome regions in the chunk section |
Paletted Container structure
A Paletted Container is a palette-based storage of entries. Paletted Containers have an associated global palette (either block states or biomes as of now), where values are mapped from. A Paletted Container consists of the following fields:
Field Name | Field Type | Notes |
---|---|---|
Bits Per Entry | Unsigned Byte | Determines how many bits are used to encode entries. Note that not all numbers are valid here. |
Palette | Varies | See below for the format. |
Data Array Length | VarInt | Number of longs in the following array |
Data Array | Array of Long | Compacted list of indices pointing to entry IDs in the Palette. When Bits Per Entry is 0, this array is empty (see Single valued palette) |
Data Array is given for each entry with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates.
Palettes
The bits per block entry value determines what format is used for the palette. In most cases, invalid values will be interpreted as a different value when parsed by the notchian client, meaning that chunk data will be parsed incorrectly if you use an invalid bits per block entry. Servers must make sure that the bits per block entry value is correct. There are currently three types of palettes:
Single valued
This format is used when bits per entry is equal to 0, and signifies that the palette contains a single value. When this palette is used, the Data Array sent/received is empty, since entries can be inferred from the palette's single value.
The format is as follows:
Field Name | Field Type | Notes |
---|---|---|
Value | VarInt | ID of the corresponding entry in its global palette |
Indirect
There are two three variants of this:
- For block states and bits per
blockentry <= 4, 4 bits are used to represent a block. - For block states and bits per block between 5 and 8, the given value is used.
- For biomes and bits per entry <= 3, the given value is used.
This is an actual palette which lists the block states entries used. Values in the chunk section's data array are indices into the palette, which in turn gives a proper block state entry.
The format is as follows:
Field Name | Field Type | Notes |
---|---|---|
Palette Length | VarInt | Number of elements in the following array. |
Palette | Array of VarInt | Mapping of |
Direct
This format is used for bits per block entry values greater than or equal to 9 a threshold (9 for block states, 4 for biomes). The number of bits used to represent a block an entry is the base 2 logarithm of the number of block states entries in the global palette, rounded up. For the current vanilla release, this is 15 bits per block per entry for block states, and 6 bits per entry for biomes.
The "palette" uses the following format:
Field Name | Field Type | Notes |
---|---|---|
no fields |
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 entriesceil(log2(height + 1)) ). 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
Join Game
See Protocol Encryption for information on logging in.
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
0x26 | Play | Client | Entity ID | Int | The player's Entity ID (EID). |
Is hardcore | Boolean | ||||
Gamemode | Unsigned Byte | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. | |||
Previous Gamemode | Byte | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included. The previous gamemode. Defaults to -1 if there is no previous gamemode. (More information needed) | |||
World Count | VarInt | Size of the following array. | |||
World Names | Array of Identifier | Identifiers for all worlds on the server. | |||
Dimension Codec | NBT Tag Compound | The full extent of these is still unknown, but the tag represents a dimension and biome registry. See below for the vanilla default. | |||
Dimension | NBT Tag Compound | Valid dimensions are defined per dimension registry sent before this. The structure of this tag is a dimension type (see below). | |||
World Name | Identifier | Name of the world being spawned into. | |||
Hashed seed | Long | First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise | |||
Max Players | VarInt | Was once used by the client to draw the player list, but now is ignored. | |||
View Distance | VarInt | Render distance (2-32). | |||
Simulation Distance | VarInt | The distance that the client will process specific things, such as entities. | |||
Reduced Debug Info | Boolean | If true, a Notchian client shows reduced information on the debug screen. For servers in development, this should almost always be false. | |||
Enable respawn screen | Boolean | Set to false when the doImmediateRespawn gamerule is true. | |||
Is Debug | Boolean | True if the world is a debug mode world; debug mode worlds cannot be modified and have predefined blocks. | |||
Is Flat | Boolean | True if the world is a superflat world; flat worlds have different void fog and a horizon at y=0 instead of y=63. |
The Dimension Codec NBT Tag Compound (Default value in SNBT) includes two registries: "minecraft:dimension_type" and "minecraft:worldgen/biome".
Name | Type | Notes | |
---|---|---|---|
minecraft:dimension_type | TAG_Compound | The dimension type registry (see below). | |
minecraft:worldgen/biome | TAG_Compound | The biome registry (see below). |
Dimension type registry:
Name | Type | Notes | |
---|---|---|---|
type | TAG_String | The name of the registry. Always "minecraft:dimension_type". | |
value | TAG_List | List of dimension types registry entries (see below). |
Dimension type registry entry:
Name | Type | Notes | |
---|---|---|---|
name | TAG_String | The name of the dimension type (for example, "minecraft:overworld"). | |
id | TAG_Int | The protocol ID of the dimension (matches the index of the element in the registry list). | |
element | TAG_Compound | The dimension type (see below). |
Dimension type:
Name | Type | Meaning | Values | |
---|---|---|---|---|
piglin_safe | TAG_Byte | Whether piglins shake and transform to zombified piglins. | 1: true, 0: false. | |
natural | TAG_Byte | When false, compasses spin randomly. When true, nether portals can spawn zombified piglins. | 1: true, 0: false. | |
ambient_light | TAG_Float | How much light the dimension has. | 0.0 to 1.0. | |
fixed_time | Optional TAG_Long | If set, the time of the day is the specified value. | If set, 0 to 24000. | |
infiniburn | TAG_String | A resource location defining what block tag to use for infiniburn. | "" or minecraft resource "minecraft:...". | |
respawn_anchor_works | TAG_Byte | Whether players can charge and use respawn anchors. | 1: true, 0: false. | |
has_skylight | TAG_Byte | Whether the dimension has skylight access or not. | 1: true, 0: false. | |
bed_works | TAG_Byte | Whether players can use a bed to sleep. | 1: true, 0: false. | |
effects | TAG_String | ? | "minecraft:overworld", "minecraft:the_nether", "minecraft:the_end" or something else. | |
has_raids | TAG_Byte | Whether players with the Bad Omen effect can cause a raid. | 1: true, 0: false. | |
min_y | TAG_Int | The minimum Y level. | ||
height | TAG_Int | The maximum height. | ||
logical_height | TAG_Int | The maximum height to which chorus fruits and nether portals can bring players within this dimension. | 0-256. | |
coordinate_scale | TAG_Float | The multiplier applied to coordinates when traveling to the dimension. | 0.00001 - 30000000.0 | |
ultrawarm | TAG_Byte | Whether the dimensions behaves like the nether (water evaporates and sponges dry) or not. Also causes lava to spread thinner. | 1: true, 0: false. | |
has_ceiling | TAG_Byte | Whether the dimension has a bedrock ceiling or not. When true, causes lava to spread faster. | 1: true, 0: false. |
Biome registry:
Name | Type | Notes | |
---|---|---|---|
type | TAG_String | The name of the registry. Always "minecraft:worldgen/biome". | |
value | TAG_List | List of biome registry entries (see below). |
Biome registry entry:
Name | Type | Notes | |
---|---|---|---|
name | TAG_String | The name of the biome (for example, "minecraft:ocean"). | |
id | TAG_Int | The protocol ID of the biome (matches the index of the element in the registry list). | |
element | TAG_Compound | The biome properties (see below). |
Biome properties:
Name | Type | Meaning | Values | ||||
---|---|---|---|---|---|---|---|
precipitation | TAG_String | The type of precipitation in the biome. | "rain", "snow", or "none". | ||||
depth | TAG_Float | The depth factor of the biome. | The default values vary between 1.5 and -1.8. | ||||
temperature | TAG_Float | The temperature factor of the biome. | The default values vary between 2.0 and -0.5. | ||||
scale | TAG_Float | ? | The default values vary between 1.225 and 0.0. | ||||
downfall | TAG_Float | ? | The default values vary between 1.0 and 0.0. | ||||
category | TAG_String | The category of the biome. | Known values are "ocean", "plains", "desert", "forest", "extreme_hills", "taiga", "swamp", "river", "nether", "the_end", "icy", "mushroom", "beach", "jungle", "mesa", "savanna", and "none". | ||||
temperature_modifier | Optional TAG_String | ? | The only known value is "frozen". | ||||
effects | sky_color | TAG_Compound | TAG_Int | The color of the sky. | Example: 8364543, which is #7FA1FF in RGB. | ||
water_fog_color | TAG_Int | Possibly the tint color when swimming. | Example: 8364543, which is #7FA1FF in RGB. | ||||
fog_color | TAG_Int | Possibly the color of the fog effect when looking past the view distance. | Example: 8364543, which is #7FA1FF in RGB. | ||||
water_color | TAG_Int | The tint color of the water blocks. | Example: 8364543, which is #7FA1FF in RGB. | ||||
foliage_color | Optional TAG_Int | The tint color of the grass. | Example: 8364543, which is #7FA1FF in RGB. | ||||
grass_color | Optional TAG_Int | ? | Example: 8364543, which is #7FA1FF in RGB. | ||||
grass_color_modifier | Optional TAG_String | Unknown, likely affects foliage color. | If set, known values are "swamp" and "dark_forest". | ||||
music | Optional TAG_Compound | Music properties for the biome. | If present, contains the fields: replace_current_music (TAG_Byte), sound (TAG_String), max_delay (TAG_Int), min_delay (TAG_Int). | ||||
ambient_sound | Optional TAG_String | Ambient soundtrack. | If present, the ID of a soundtrack. Example: "minecraft:ambient.basalt_deltas.loop". | ||||
additions_sound | Optional TAG_Compound | Additional ambient sound that plays randomly. | If present, contains the fields: sound (TAG_String), tick_chance (TAG_Double). | ||||
mood_sound | Optional TAG_Compound | Additional ambient sound that plays at an interval. | If present, contains the fields: sound (TAG_String), tick_delay (TAG_Int), offset (TAG_Double), block_search_extent (TAG_Int). | ||||
particle | probability | Optional TAG_Compound | TAG_FLOAT | Particles that appear randomly in the biome. | Possibly the probability of spawning the particle. | ? | |
options | TAG_COMPOUND | The properties of the particle to spawn. | Contains the field "type" (TAG_String), which identifies the particle type. |
Update Simulation Distance
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
0x26 | Play | Client | Simulation Distance | VarInt | The distance that the client will process specific things, such as entities. |
Serverbound
Client Settings
Sent when the player connects, or when settings are changed.
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
0x05 | Play | Server | Locale | String (16) | e.g. en_GB .
|
View Distance | Byte | Client-side render distance, in chunks. | |||
Chat Mode | VarInt Enum | 0: enabled, 1: commands only, 2: hidden. See processing chat for more information. | |||
Chat Colors | Boolean | “Colors” multiplayer setting. | |||
Displayed Skin Parts | Unsigned Byte | Bit mask, see below. | |||
Main Hand | VarInt Enum | 0: Left, 1: Right. | |||
Disable text filtering | Boolean | Disables filtering of text on signs and written book titles. Currently always true (i.e. the filtering is disabled) | |||
Allow server listings | Boolean | Servers usually list online players, this option should let you not show up in that list. |
Displayed Skin Parts flags:
- Bit 0 (0x01): Cape enabled
- Bit 1 (0x02): Jacket enabled
- Bit 2 (0x04): Left Sleeve enabled
- Bit 3 (0x08): Right Sleeve enabled
- Bit 4 (0x10): Left Pants Leg enabled
- Bit 5 (0x20): Right Pants Leg enabled
- Bit 6 (0x40): Hat enabled
The most significant bit (bit 7, 0x80) appears to be unused.
Status
Clientbound
No changes so far.
Serverbound
No changes so far.
Login
Clientbound
No changes so far.
Serverbound
No changes so far.