Difference between revisions of "Pre-release protocol"

From wiki.vg
Jump to navigation Jump to search
(→‎New/modified data types: Started adding the new chunk section format)
m (Add type to system message)
(21 intermediate revisions by 8 users not shown)
Line 1: Line 1:
This page documents the changes from the [[Protocol|last stable Minecraft release]] (currently [[Protocol version numbers|1.17.1, protocol 756]]) to the current pre-release (currently [[Protocol version numbers|21w44a, protocol {{Snapshot PVN|1073741872}}]]). Note that this page contains bleeding-edge information that may not be completely or correctly documented.
+
This page documents the changes from the [[Protocol|last stable Minecraft release]] (currently [[Protocol version numbers|1.18.2, protocol 758]]) to the current pre-release (currently [[Protocol version numbers|22w16b, protocol {{Snapshot PVN|1073741905}}]]). 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.
 
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.
Line 13: Line 13:
 
=== Packets ===
 
=== Packets ===
  
 +
Packet ID shifts have not been included.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 20: Line 21:
 
  |-
 
  |-
 
!colspan="4"| Play clientbound
 
!colspan="4"| Play clientbound
{{PacketList|0x0A|Block Entity Data}}
+
{{PacketList|0x02|Spawn Living Entity|pre=removed}}
{{PacketList|0x22|Chunk Data and Update Light}}
+
{{PacketList|0x03|Spawn Painting|pre=removed}}
{{PacketList|0x26|Join Game}}
+
{{PacketList|0x05|Sculk Vibration Signal|pre=removed}}
{{PacketList|0x57|Update Simulation Distance|rel=added}}
+
{{PacketList|0x05|Acknowledge Block Changes|rel=added}}
{{PacketList|{{change|0x57|0x58}}|Set Title SubTitle|pre=unchanged}}
+
{{PacketList|0x08|Acknowledge Player Digging|pre=removed}}
{{PacketList|{{change|0x58|0x59}}|Time Update|pre=unchanged}}
+
{{PacketList|0x5C|System Message|rel=added}}
{{PacketList|{{change|0x59|0x5A}}|Set Title Text|pre=unchanged}}
 
{{PacketList|{{change|0x5A|0x5B}}|Set Title Times|pre=unchanged}}
 
{{PacketList|{{change|0x5B|0x5C}}|Entity Sound Effect|pre=unchanged}}
 
{{PacketList|{{change|0x5C|0x5D}}|Sound Effect|pre=unchanged}}
 
{{PacketList|{{change|0x5D|0x5E}}|Stop Sound|pre=unchanged}}
 
{{PacketList|{{change|0x5E|0x5F}}|Player List Header And Footer|pre=unchanged}}
 
{{PacketList|{{change|0x5F|0x60}}|NBT Query Response|pre=unchanged}}
 
{{PacketList|{{change|0x60|0x61}}|Collect Item|pre=unchanged}}
 
{{PacketList|{{change|0x61|0x62}}|Entity Teleport|pre=unchanged}}
 
{{PacketList|{{change|0x62|0x63}}|Advancements|pre=unchanged}}
 
{{PacketList|{{change|0x63|0x64}}|Entity Properties|pre=unchanged}}
 
{{PacketList|{{change|0x64|0x65}}|Entity Effect|pre=unchanged}}
 
{{PacketList|{{change|0x65|0x66}}|Declare Recipes|pre=unchanged}}
 
{{PacketList|{{change|0x66|0x67}}|Tags|pre=unchanged}}
 
|}
 
 
 
== New/modified data types ==
 
 
 
=== Chunk Section ===
 
  
The data section of the packet contains most of the useful data for the chunk.
 
 
{| class="wikitable"
 
 
  |-
 
  |-
! Field Name
+
!colspan="4"| Play serverbound
! Field Type
 
! Notes
 
 
  |-
 
  |-
| Data
+
!colspan="4"| Handshaking serverbound
| Array of [[#Chunk Section structure|Chunk Section]]
 
| The number of elements in the array is {{change|equal to the number of bits set in Primary Bit Mask|calculated based on the world's height}}. Sections are sent bottom-to-top{{change|, i.e. the first section, if sent, extends from Y=0 to Y=15|}}.
 
 
  |}
 
  |}
  
==== Chunk Section structure ====
+
== New/modified data types ==
  
A Chunk Section is defined in terms of other [[data types]]. A Chunk Section consists of the following fields:
+
No changes so far.
  
{| class="wikitable"
+
== Entity Metadata ==
|-
 
! 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.
 
|- {{removed}}
 
| Bits Per Block
 
| Unsigned Byte
 
| Determines how many bits are used to encode a block. Note that not all numbers are valid here.
 
|- {{removed}}
 
| Palette
 
| Varies
 
| See below for the format.
 
|- {{removed}}
 
| Data Array Length
 
| VarInt
 
| Number of longs in the following array
 
|- {{removed}}
 
| Data Array
 
| Array of Long
 
| Compacted list of 4096 (16x16x16) indices pointing to state IDs in the Palette (see [[#Compacted data array|Compacted data array]])
 
|- {{added}}
 
| Block states
 
| [[#Paletted Container structure|Paletted Container]]
 
| Consists of 4096 entries, representing all the blocks in the chunk section
 
|- {{added}}
 
| Biomes
 
| [[#Paletted Container structure|Paletted Container]]
 
| Consists of 64 entries, representing 4x4x4 biome regions in the chunk section
 
|}
 
  
==== {{change||Paletted Container structure}} ====
+
=== Goat ===
  
{{change||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:}}
+
{{Metadata inherit|Goat}}
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Index
 +
! Type
 +
!style="width: 250px;" colspan="2"| Meaning
 +
! Default
 +
|-
 +
| {{Metadata id|}}
 +
| Boolean
 +
|colspan="2"| Is Screaming Goat
 +
| false
 
  |- {{added}}
 
  |- {{added}}
  ! Field Name
+
  | {{Metadata id|}}
  ! Field Type
+
  | Boolean
  ! Notes
+
  |colspan="2"| Has Left Horn
 +
| true
 
  |- {{added}}
 
  |- {{added}}
  | Bits Per Entry
+
  | {{Metadata id|}}
| Unsigned Byte
+
  | Boolean
| Determines how many bits are used to encode entries. Note that not all numbers are valid here.
+
  |colspan="2"| Has Right Horn
|- {{added}}
+
  | true
  | Palette
+
  |-
  | Varies
 
| See below for the format.
 
|- {{added}}
 
  | Data Array Length
 
| VarInt
 
| Number of longs in the following array
 
  |- {{added}}
 
| 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|Single valued palette]])
 
 
  |}
 
  |}
  
{{change||Data Array is given for each entry with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates.}}
+
=== Painting ===
 
 
===== Palettes =====
 
 
 
The bits per {{change|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 {{change|block|entry}}. Servers must make sure that the bits per {{change|block|entry}} value is correct. {{change||There are currently three types of palettes:}}
 
 
 
====== {{change||Single valued}} ======
 
 
 
{{change||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.}}
 
  
{{change||The format is as follows:}}
+
{{Metadata inherit|Painting}}
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Index
 +
! Type
 +
!style="width: 250px;" colspan="2"| Meaning
 +
! Default
 
  |- {{added}}
 
  |- {{added}}
! Field Name
+
  | {{Metadata id|}}
! Field Type
 
! Notes
 
  |- {{added}}
 
| Value
 
 
  | VarInt
 
  | VarInt
  | ID of the corresponding entry in its global palette
+
  |colspan="2"| PaintingVariant
 +
| 0
 
  |}
 
  |}
  
====== Indirect ======
+
=== Player ===
  
There are {{change|two|three}} variants of this:
+
{{Metadata inherit|Player}}
 
 
* For {{change||block states and }}bits per {{change|block|entry}} <= 4, 4 bits are used to represent a block.
 
* For {{change||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 {{change|block states|entries}} used. Values in the chunk section's data array are indices into the palette, which in turn gives a proper {{change|block state|entry}}.
 
 
 
The format is as follows:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Index
 +
! Type
 +
!style="width: 250px;" colspan="2"| Meaning
 +
! Default
 
  |-
 
  |-
  ! Field Name
+
  | {{Metadata id|}}
  ! Field Type
+
  | Float
  ! Notes
+
  |colspan="2"| Additional Hearts
 +
| 0.0
 
  |-
 
  |-
  | Palette Length
+
  | {{Metadata id|}}
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array.
+
  |colspan="2"| Score
 +
| 0
 
  |-
 
  |-
  | Palette
+
  |rowspan="10"| {{Metadata id|}}
  | Array of VarInt
+
|rowspan="10"| Byte
  | Mapping of {{change|block state|entry}} IDs in the global palette to indices of this array
+
|colspan="2"| The Displayed Skin Parts bit mask that is sent in [[Protocol#Client Settings|Client Settings]]
  |}
+
|rowspan="10"| 0
 
+
|-
====== Direct ======
+
! Bit mask !! Meaning
 
+
|-
This format is used for bits per {{change|block|entry}} values greater than or equal to {{change|9|a threshold (9 for block states, 4 for biomes)}}. The number of bits used to represent {{change|a block|an entry}} is the base 2 logarithm of the number of {{change|block states|entries in the global palette}}, rounded up. For the current vanilla release, this is 15 bits {{change|per block|per entry for block states, and 6 bits per entry for biomes}}.
+
| 0x01 || Cape enabled
 
+
|-
The "palette" uses the following format:
+
| 0x02 || Jacket enabled
{| class="wikitable"
+
|-
 +
| 0x04 || Left sleeve enabled
 +
  |-
 +
  | 0x08 || Right sleeve enabled
 +
  |-
 +
| 0x10 || Left pants leg enabled
 +
|-
 +
| 0x20 || Right pants leg enabled
 +
|-
 +
| 0x40 || Hat enabled
 +
|-
 +
| 0x80 || ''Unused''
 +
|-
 +
| {{Metadata id|}}
 +
| Byte
 +
|colspan="2"| Main hand (0 : Left, 1 : Right)
 +
| 1
 
  |-
 
  |-
  ! Field Name
+
  | {{Metadata id|}}
  ! Field Type
+
  | [[NBT]]
  ! Notes
+
  |colspan="2"| Left shoulder entity data (for occupying parrot)
 +
| Empty
 
  |-
 
  |-
  |colspan="3"| ''no fields''
+
| {{Metadata id|}}
 +
| [[NBT]]
 +
  |colspan="2"| Right shoulder entity data (for occupying parrot)
 +
| Empty
 +
|- {{added}}
 +
| {{Metadata id|}}
 +
| Global Position
 +
|colspan="2"| Optional Last Death Location (used for respawn compass)
 +
| Empty
 
  |}
 
  |}
  
== Entity Metadata ==
 
  
No changes so far.
 
  
 
=== Entity ===
 
=== Entity ===
Line 213: Line 169:
 
=== Clientbound ===
 
=== Clientbound ===
  
==== Block Entity Data ====
+
==== Spawn Entity ====
  
Sets the block entity associated with the block at the given location.
+
Sent by the server when a vehicle or other non-living entity is created.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 225: Line 181:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x0A
+
|rowspan="13"| 0x00
 +
|rowspan="13"| Play
 +
|rowspan="13"| Client
 +
| Entity ID
 +
| VarInt
 +
| Entity ID.
 +
|-
 +
| Object UUID
 +
| UUID
 +
|
 +
|-
 +
| Type
 +
| VarInt
 +
| The type of entity (same as in [[#Spawn Living Entity|Spawn Living Entity]]).
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Pitch
 +
| Angle
 +
| To get the real pitch, you must divide this by (256.0F / 360.0F)
 +
|-
 +
| Yaw
 +
| Angle
 +
| To get the real yaw, you must divide this by (256.0F / 360.0F)
 +
|- {{added}}
 +
| Head Yaw
 +
| Angle
 +
|-
 +
| Data
 +
| Int
 +
| Meaning dependent on the value of the Type field, see [[Object Data]] for details.
 +
|-
 +
| Velocity X
 +
| Short
 +
|rowspan="3"| Same units as [[#Entity Velocity|Entity Velocity]].  Always sent, but only used when Data is greater than 0 (except for some entities which always ignore it; see [[Object Data]] for details).
 +
|-
 +
| Velocity Y
 +
| Short
 +
|-
 +
| Velocity Z
 +
| Short
 +
|}
 +
 
 +
 
 +
==== Acknowledge Block Changes ====
 +
 
 +
{| class="wikitable" {{Added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
  |rowspan="4"| 0x05
 
  |rowspan="4"| Play
 
  |rowspan="4"| Play
 
  |rowspan="4"| Client
 
  |rowspan="4"| Client
  | Location
+
  | Sequence ID
| Position
 
|
 
|- {{removed}}
 
| Action
 
| Unsigned Byte
 
| The type of update to perform, see below.
 
|- {{added}}
 
| Type
 
 
  | VarInt
 
  | VarInt
  | The type of block entity
+
  | Represents the sequence to acknowledge, this is used for properly syncing block changes to the client after interactions.
 
  |-
 
  |-
| 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 ====
+
==== Block Action ====
{{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)}}
+
This packet is used for a number of actions and animations performed by blocks, usually non-persistent. The client ignores the provided block type and instead uses the block state in their world.
  
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).
+
See [[Block Actions]] for a list of values.
 +
 
 +
{{Warning2|This packet uses a block ID, not a block state.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 257: Line 266:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="32"| {{change|0x20|0x22}}
+
  |rowspan="5"| 0x0B
  |rowspan="32"| Play
+
  |rowspan="5"| Play
  |rowspan="32"| Client
+
  |rowspan="5"| Client
  |colspan="2"| Chunk X
+
  | Location
  |colspan="2"| Int
+
  | Position
  | Chunk coordinate (block coordinate divided by 16, rounded down)
+
  | Block coordinates.
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  | Action ID (Byte 1)
|colspan="2"| Int
+
  | Unsigned Byte
| Chunk coordinate (block coordinate divided by 16, rounded down)
+
  | Varies depending on block — see [[Block Actions]].
  |- {{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
+
  | Action Param (Byte 2)
  |colspan="2"| [[NBT]]
+
  | Unsigned Byte
  | 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{{change| at 9 bits per entry totaling 36 longs|, with the number of bits per entry varying depending on the world's height, defined by the formula <code>ceil(log2(height + 1))</code>}}). 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.
+
  | Varies depending on block — see [[Block Actions]].
|- {{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&times;4&times;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
+
  | Block Type
|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
 
  | VarInt
  | The type of block entity
+
  | The block type ID for the block. This must match the block at the given coordinates.
  |- {{added}}
 
| Data
 
| [[NBT]]
 
| The block entity's data, without the X, Y, and Z values
 
 
  |- {{added}}
 
  |- {{added}}
  |colspan="2"| Trust Edges
+
  | Sequence
|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
 
  | 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.
+
==== Named Sound Effect ====
 +
{{See also|#Sound Effect}}
  
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>
+
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
 
 
<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>
 
 
 
==== Join Game ====
 
 
 
See [[Protocol Encryption]] for information on logging in.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 412: Line 307:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="17"| 0x26
+
  |rowspan="8"| {{change|0x19|0x16}}
  |rowspan="17"| Play
+
  |rowspan="8"| Play
  |rowspan="17"| Client
+
  |rowspan="8"| Client
  | Entity ID
+
  | Sound Name
 +
| Identifier
 +
| All sound effect names as of 1.16.5 can be seen [https://pokechu22.github.io/Burger/1.16.5.html#sounds here].
 +
|-
 +
| Sound Category
 +
| VarInt Enum
 +
| The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories]).
 +
|-
 +
| Effect Position X
 
  | Int
 
  | Int
  | The player's Entity ID (EID).
+
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | Is hardcore
+
  | Effect Position Y
  | Boolean
+
  | Int
  |
+
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | Gamemode
+
  | Effect Position Z
  | Unsigned Byte
+
  | Int
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
+
  | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
|-
 
| 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
+
  | Volume
  | VarInt
+
  | Float
  | Size of the following array.
+
  | 1 is 100%, can be more.
 
  |-
 
  |-
  | World Names
+
  | Pitch
  | Array of Identifier
+
  | Float
  | Identifiers for all worlds on the server.
+
  | Float between 0.5 and 2.0 by Notchian clients.
 +
|- {{added}}
 +
| Seed
 +
| long
 +
| Seed used to pick sound varient.
 +
|}
 +
 
 +
==== {{change|Chat Message|Player Chat Msg}} (clientbound) ====
 +
 
 +
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options.  See [[Chat#Processing chat|processing chat]] for more info about these positions.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Dimension Codec
+
  |rowspan="10"| {{change|0x0F|0x2F}}
  | [[NBT|NBT Tag Compound]]
+
|rowspan="10"| Play
  | The full extent of these is still unknown, but the tag represents a dimension and biome registry. See below for the vanilla default.
+
|rowspan="10"| Client
 +
| JSON Data
 +
  | [[Chat]]
 +
  | Limited to 262144 bytes.
 
  |-
 
  |-
  | Dimension
+
  | {{change|Position|Type}}
| [[NBT|NBT Tag Compound]]
+
  | {{change|Byte|VarInt}}
  | Valid dimensions are defined per dimension registry sent before this. The structure of this tag is a dimension type (see below).
+
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar), 3: say command, 4: msg command, 5: team msg command, 6: emote command, 7: tellraw command
|-
 
| World Name
 
  | Identifier
 
| Name of the world being spawned into.
 
 
  |-
 
  |-
  | Hashed seed
+
  | Sender
 +
| UUID
 +
| Used by the Notchian client for the disableChat launch option. Setting both longs to 0 will always display the message regardless of the setting.
 +
|- {{added}}
 +
| Display Name
 +
| Component
 +
|
 +
|- {{added}}
 +
| Has Team Display Name
 +
| Boolean
 +
| Used in /teammsg
 +
|- {{added}}
 +
| Team Display Name
 +
| Component
 +
| Used in /teammsg
 +
|- {{added}}
 +
| Timestamp
 
  | Long
 
  | Long
  | First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
+
  | Used to check that the message was received within 2 minutes of it being sent.
  |-
+
  |- {{added}}
  | Max Players
+
  | Salt
  | VarInt
+
  | Long
  | Was once used by the client to draw the player list, but now is ignored.
+
  | Cryptography, TODO:
  |-
+
  |- {{added}}
  | View Distance
+
  | Signature Length
 
  | VarInt
 
  | VarInt
  | Render distance (2-32).
+
  | Array Length
 
  |- {{added}}
 
  |- {{added}}
  | Simulation Distance
+
  | Message Signature
  | VarInt
+
  | Bytes
  | The distance that the client will process specific things, such as entities.
+
  | Cryptography, TODO:
|-
 
| Reduced Debug Info
 
| Boolean
 
| If true, a Notchian client shows reduced information on the {{Minecraft Wiki|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 {{Minecraft Wiki|debug mode}} world; debug mode worlds cannot be modified and have predefined blocks.
 
|-
 
| Is Flat
 
| Boolean
 
| True if the world is a {{Minecraft Wiki|superflat}} world; flat worlds have different void fog and a horizon at y=0 instead of y=63.
 
 
  |}
 
  |}
  
 +
==== System Chat Message (clientbound) ====
  
The '''Dimension Codec''' NBT Tag Compound ([https://gist.githubusercontent.com/BomBardyGamer/c075a7a34b51f2df9d5aabdd2a762f4f/raw/c7352784dfadbca00d2282aeca04ed80081bfb09/dimension_codec.snbt Default value in SNBT]) includes two registries: "minecraft:dimension_type" and "minecraft:worldgen/biome".
+
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options.  See [[Chat#Processing chat|processing chat]] for more info about these positions.
  
 
{| class="wikitable"
 
{| class="wikitable"
  !Name
+
  ! Packet ID
  !Type
+
! State
  !style="width: 250px;" colspan="2"| Notes
+
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | minecraft:dimension_type
+
  |rowspan="2"| 0x5C
  | TAG_Compound
+
|rowspan="2"| Play
  | The dimension type registry (see below).
+
|rowspan="2"| Client
 +
| JSON Data
 +
  | [[Chat]]
 +
  | Limited to 262144 bytes.
 
  |-
 
  |-
  | minecraft:worldgen/biome
+
  | Type
  | TAG_Compound
+
  | VarInt
  | The biome registry (see below).
+
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar), 3: say command, 4: msg command, 5: team msg command, 6: emote command, 7: tellraw command
 
  |}
 
  |}
  
Dimension type registry:
+
==== Entity Sound Effect ====
 +
 
 +
Plays a sound effect from an entity.
  
 
{| class="wikitable"
 
{| class="wikitable"
  !Name
+
  ! Packet ID
  !Type
+
! State
  !style="width: 250px;" colspan="2"| Notes
+
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | type
+
  |rowspan="6"| {{change|0x5C|0x59}}
  | TAG_String
+
|rowspan="6"| Play
  | The name of the registry. Always "minecraft:dimension_type".
+
  |rowspan="6"| Client
 +
  | Sound ID
 +
| VarInt
 +
| ID of hardcoded sound event ([https://pokechu22.github.io/Burger/1.16.5.html#sounds events] as of 1.16.5).
 
  |-
 
  |-
  | value
+
  | Sound Category
  | TAG_List
+
  | VarInt Enum
  | List of dimension types registry entries (see below).
+
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories]).
|}
 
 
 
Dimension type registry entry:
 
 
 
{| class="wikitable"
 
!Name
 
!Type
 
!style="width: 250px;" colspan="2"| Notes
 
 
  |-
 
  |-
  | name
+
  | Entity ID
  | TAG_String
+
  | VarInt
  | The name of the dimension type (for example, "minecraft:overworld").
+
  |
 
  |-
 
  |-
  | id
+
  | Volume
  | TAG_Int
+
  | Float
  | The protocol ID of the dimension (matches the index of the element in the registry list).
+
  | 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients.
 
  |-
 
  |-
  | element
+
  | Pitch
  | TAG_Compound
+
  | Float
  | The dimension type (see below).
+
  | Float between 0.5 and 2.0 by Notchian clients.
 +
|- {{added}}
 +
| Seed
 +
| long
 +
| Seed used to pick sound varient.
 
  |}
 
  |}
  
Dimension type:
+
 
 +
==== Sound Effect ====
 +
 
 +
This packet is used to play a number of hardcoded sound events. For custom sounds, use [[#Named Sound Effect|Named Sound Effect]].
 +
 
 +
{{Warning|Numeric sound effect IDs are liable to change between versions}}
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Name
+
  ! Packet ID
  ! Type
+
! State
  !style="width: 250px;" colspan="2"| Meaning
+
! Bound To
  ! Values
+
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | piglin_safe
+
  |rowspan="8"| {{change|0x5D|0x5A}}
  | TAG_Byte
+
  |rowspan="8"| Play
  |colspan="2"| Whether piglins shake and transform to zombified piglins.
+
  |rowspan="8"| Client
  | 1: true, 0: false.
+
| Sound ID
 +
| VarInt
 +
  | ID of hardcoded sound event ([https://pokechu22.github.io/Burger/1.16.5.html#sounds events] as of 1.16.5).
 
  |-
 
  |-
  | natural
+
  | Sound Category
  | TAG_Byte
+
  | VarInt Enum
  |colspan="2"| When false, compasses spin randomly. When true, nether portals can spawn zombified piglins.
+
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories]).
| 1: true, 0: false.
 
 
  |-
 
  |-
  | ambient_light
+
  | Effect Position X
  | TAG_Float
+
  | Int
  |colspan="2"| How much light the dimension has.
+
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
| 0.0 to 1.0.
 
 
  |-
 
  |-
  | fixed_time
+
  | Effect Position Y
  | Optional TAG_Long
+
  | Int
  |colspan="2"| If set, the time of the day is the specified value.
+
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
| If set, 0 to 24000.
 
 
  |-
 
  |-
  | infiniburn
+
  | Effect Position Z
  | TAG_String
+
  | Int
  |colspan="2"| A resource location defining what block tag to use for infiniburn.
+
  | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
| "" or minecraft resource "minecraft:...".
 
 
  |-
 
  |-
  | respawn_anchor_works
+
  | Volume
  | TAG_Byte
+
  | Float
  |colspan="2"| Whether players can charge and use respawn anchors.
+
  | 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients.
| 1: true, 0: false.
 
 
  |-
 
  |-
  | has_skylight
+
  | Pitch
  | TAG_Byte
+
  | Float
  |colspan="2"| Whether the dimension has skylight access or not.
+
  | Float between 0.5 and 2.0 by Notchian clients.
  | 1: true, 0: false.
+
|- {{added}}
 +
| Seed
 +
| long
 +
| Seed used to pick sound varient.
 +
  |}
 +
 
 +
==== Entity Effect ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | bed_works
+
  |rowspan="7"| {{change|0x65|0x62}}
  | TAG_Byte
+
  |rowspan="7"| Play
  |colspan="2"| Whether players can use a bed to sleep.
+
  |rowspan="7"| Client
  | 1: true, 0: false.
+
| Entity ID
 +
| VarInt
 +
  |  
 
  |-
 
  |-
  | effects
+
  | Effect ID
  | TAG_String
+
  | VarInt
  |colspan="2"| ?
+
  | See {{Minecraft Wiki|Status effect#Effect IDs|this table}}.
| "minecraft:overworld", "minecraft:the_nether", "minecraft:the_end" or something else.
 
 
  |-
 
  |-
  | has_raids
+
  | Amplifier
  | TAG_Byte
+
  | Byte
  |colspan="2"| Whether players with the Bad Omen effect can cause a raid.
+
  | Notchian client displays effect level as Amplifier + 1.
| 1: true, 0: false.
 
 
  |-
 
  |-
  | min_y
+
  | Duration
  | TAG_Int
+
  | VarInt
  |colspan="2"| The minimum Y level.
+
  | Duration in ticks.
|
 
 
  |-
 
  |-
  | height
+
  | Flags
  | TAG_Int
+
  | Byte
  |colspan="2"| The maximum height.
+
  | Bit field, see below.
|
+
  |- {{added}}
|-
+
  | Has Factor Data
| logical_height
+
  | boolean
| TAG_Int
+
  | Used in DARKNESS effect
|colspan="2"| The maximum height to which chorus fruits and nether portals can bring players within this dimension.
+
  |- {{added}}
| 0-256.
+
  | Factor Codec
  |-
+
  | NBT Tag
  | coordinate_scale
+
  | See below
  | TAG_Float
 
  |colspan="2"| The multiplier applied to coordinates when traveling to the dimension.
 
  | 0.00001 - 30000000.0
 
  |-
 
  | ultrawarm
 
  | TAG_Byte
 
|colspan="2"| 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
 
|colspan="2"| Whether the dimension has a bedrock ceiling or not. When true, causes lava to spread faster.
 
| 1: true, 0: false.
 
 
  |}
 
  |}
  
Biome registry:
+
Within flags:
 +
 
 +
* 0x01: Is ambient - was the effect spawned from a beacon?  All beacon-generated effects are ambient.  Ambient effects use a different icon in the HUD (blue border rather than gray).  If all effects on an entity are ambient, the [[Entity_metadata#Living Entity|"Is potion effect ambient" living metadata field]] should be set to true.  Usually should not be enabled.
 +
* 0x02: Show particles - should all particles from this effect be hidden?  Effects with particles hidden are not included in the calculation of the effect color, and are not rendered on the HUD (but are still rendered within the inventory).  Usually should be enabled.
 +
* 0x04: Show icon - should the icon be displayed on the client?  Usually should be enabled.
  
 +
Factor Data
 
{| class="wikitable"
 
{| class="wikitable"
 
  !Name
 
  !Name
Line 633: Line 568:
 
  !style="width: 250px;" colspan="2"| Notes
 
  !style="width: 250px;" colspan="2"| Notes
 
  |-
 
  |-
  | type
+
  | padding_duration
  | TAG_String
+
  | TAG_INT
  | The name of the registry. Always "minecraft:worldgen/biome".
+
  |
 
  |-
 
  |-
  | value
+
  | factor_target
  | TAG_List
+
  | TAG_FLOAT
  | List of biome registry entries (see below).
+
  |  
 +
|-
 +
| factor_current
 +
| TAG_FLOAT
 +
|
 +
|-
 +
| effect_changed_timestamp
 +
| TAG_INT
 +
|-
 +
| factor_previous_frame
 +
| TAG_FLOAT
 +
|-
 +
| had_effect_last_tick
 +
| TAG_BOOLEAN
 
  |}
 
  |}
  
Biome registry entry:
+
=== Serverbound ===
 +
 
 +
==== Player Digging ====
 +
 
 +
Sent when the player mines a block. A Notchian server only accepts digging packets with coordinates within a 6-unit radius between the center of the block and 1.5 units from the player's feet (''not'' their eyes).
  
 
{| class="wikitable"
 
{| class="wikitable"
  !Name
+
  ! Packet ID
  !Type
+
! State
  !style="width: 250px;" colspan="2"| Notes
+
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | name
+
  |rowspan="4"| 0x1A
  | TAG_String
+
  |rowspan="4"| Play
  | The name of the biome (for example, "minecraft:ocean").
+
|rowspan="4"| Server
 +
| Status
 +
| VarInt Enum
 +
  | The action the player is taking against the block (see below).
 
  |-
 
  |-
  | id
+
  | Location
  | TAG_Int
+
  | Position
  | The protocol ID of the biome (matches the index of the element in the registry list).
+
  | Block position.
 
  |-
 
  |-
  | element
+
  | Face
  | TAG_Compound
+
  | Byte Enum
  | The biome properties (see below).
+
  | The face being hit (see below).
 +
|- {{added}}
 +
| Sequence
 +
| VarInt
 
  |}
 
  |}
  
Biome properties:
+
Status can be one of seven values:
  
 
{| class="wikitable"
 
{| class="wikitable"
  !colspan="2"|Name
+
  ! Value
  !colspan="2"|Type
+
  ! Meaning
!style="width: 250px;" colspan="2"| Meaning
+
  ! Notes
  !colspan="2"|Values
 
 
  |-
 
  |-
  |colspan="2"|precipitation
+
  | 0
  |colspan="2"|TAG_String
+
  | Started digging
  |colspan="2"| The type of precipitation in the biome.
+
  |  
|colspan="2"|"rain", "snow", or "none".
 
 
  |-
 
  |-
  |colspan="2"| depth
+
  | 1
  |colspan="2"| TAG_Float
+
  | Cancelled digging
  |colspan="2"| The depth factor of the biome.
+
  | Sent when the player lets go of the Mine Block key (default: left click).
|colspan="2"| The default values vary between 1.5 and -1.8.
 
 
  |-
 
  |-
  |colspan="2"| temperature
+
  | 2
  |colspan="2"| TAG_Float
+
  | Finished digging
  |colspan="2"| The temperature factor of the biome.
+
  | Sent when the client thinks it is finished.
|colspan="2"| The default values vary between 2.0 and -0.5.
 
 
  |-
 
  |-
  |colspan="2"| scale
+
  | 3
  |colspan="2"| TAG_Float
+
  | Drop item stack
  |colspan="2"| ?
+
  | Triggered by using the Drop Item key (default: Q) with the modifier to drop the entire selected stack (default: Control or Command, depending on OS). Location is always set to 0/0/0, Face is always set to -Y.
|colspan="2"| The default values vary between 1.225 and 0.0.
 
 
  |-
 
  |-
  |colspan="2"| downfall
+
  | 4
|colspan="2"| TAG_Float
+
  | Drop item
  |colspan="2"| ?
+
  | Triggered by using the Drop Item key (default: Q). Location is always set to 0/0/0, Face is always set to -Y.
  |colspan="2"| The default values vary between 1.0 and 0.0.
 
 
  |-
 
  |-
  |colspan="2"| category
+
  | 5
  |colspan="2"| TAG_String
+
  | Shoot arrow / finish eating
  |colspan="2"| The category of the biome.
+
  | Indicates that the currently held item should have its state updated such as eating food, pulling back bows, using buckets, etc. Location is always set to 0/0/0, Face is always set to -Y.
|colspan="2"| Known values are "ocean", "plains", "desert", "forest", "extreme_hills", "taiga", "swamp", "river", "nether", "the_end", "icy", "mushroom", "beach", "jungle", "mesa", "savanna", and "none".  
 
 
  |-
 
  |-
  |colspan="2"| temperature_modifier
+
  | 6
  |colspan="2"| Optional TAG_String
+
| Swap item in hand
  |colspan="2"| ?
+
  | Used to swap or assign an item to the second hand. Location is always set to 0/0/0, Face is always set to -Y.
|colspan="2"| The only known value is "frozen".
+
  |}
 +
 
 +
The Face field can be one of the following values, representing the face being hit:
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  |rowspan="11"| effects
+
  ! Value
  | sky_color
+
  ! Offset
  |rowspan="11"| TAG_Compound
+
  ! Face
| TAG_Int
 
|colspan="2"| The color of the sky.
 
| Example: 8364543, which is #7FA1FF in RGB.
 
 
  |-
 
  |-
  | water_fog_color
+
  | 0
  | TAG_Int
+
  | -Y
  |colspan="2"| Possibly the tint color when swimming.
+
  | Bottom
| Example: 8364543, which is #7FA1FF in RGB.
 
 
  |-
 
  |-
  | fog_color
+
  | 1
  | TAG_Int
+
  | +Y
  |colspan="2"| Possibly the color of the fog effect when looking past the view distance.
+
  | Top
| Example: 8364543, which is #7FA1FF in RGB.
 
 
  |-
 
  |-
  | water_color
+
  | 2
| TAG_Int
+
  | -Z
  |colspan="2"| The tint color of the water blocks.
+
  | North
  | Example: 8364543, which is #7FA1FF in RGB.
 
 
  |-
 
  |-
  | foliage_color
+
  | 3
  | Optional TAG_Int
+
  | +Z
  |colspan="2"| The tint color of the grass.
+
  | South
| Example: 8364543, which is #7FA1FF in RGB.
 
|-
 
| grass_color
 
| Optional TAG_Int
 
| colspan="2"| ?
 
| Example: 8364543, which is #7FA1FF in RGB.
 
 
  |-
 
  |-
  | grass_color_modifier
+
  | 4
  | Optional TAG_String
+
  | -X
  |colspan="2"| Unknown, likely affects foliage color.
+
  | West
| If set, known values are "swamp" and "dark_forest".
 
 
  |-
 
  |-
  | music
+
  | 5
  | Optional TAG_Compound
+
  | +X
  |colspan="2"| Music properties for the biome.
+
  | East
  | If present, contains the fields: replace_current_music (TAG_Byte), sound (TAG_String), max_delay (TAG_Int), min_delay (TAG_Int).
+
|}
 +
 
 +
==== Set Beacon Effect ====
 +
 
 +
Changes the effect of the current beacon.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | ambient_sound
+
  |rowspan="5"| 0x24
  | Optional TAG_String
+
  |rowspan="5"| Play
  |colspan="2"| Ambient soundtrack.
+
  |rowspan="5"| Server
  | If present, the ID of a soundtrack. Example: "minecraft:ambient.basalt_deltas.loop".
+
|- {{added}}
 +
| Primary Effect Present
 +
  | Boolean
 
  |-
 
  |-
  | additions_sound
+
  | Primary Effect
  | Optional TAG_Compound
+
  | VarInt
  |colspan="2"| Additional ambient sound that plays randomly.
+
  | A [https://minecraft.gamepedia.com/Data_values#Potions Potion ID]. (Was a full Integer for the plugin message).
  | If present, contains the fields: sound (TAG_String), tick_chance (TAG_Double).
+
|- {{added}}
 +
| Secondary Effect Present
 +
| Boolean
 +
  |  
 
  |-
 
  |-
  | mood_sound
+
  | Secondary Effect
  | Optional TAG_Compound
+
  | VarInt
  |colspan="2"| Additional ambient sound that plays at an interval.
+
  | A [https://minecraft.gamepedia.com/Data_values#Potions Potion ID]. (Was a full Integer for the plugin message).
| If present, contains the fields: sound (TAG_String), tick_delay (TAG_Int), offset (TAG_Double), block_search_extent (TAG_Int).
 
|-
 
|rowspan="2"|particle
 
| probability
 
|rowspan="2"|Optional TAG_Compound
 
| TAG_FLOAT
 
|rowspan="2"| 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 ====
+
==== Use Item ====
 +
 
 +
Sent when pressing the Use Item key (default: right click) with an item in hand.
  
{| class="wikitable" {{Added}}
+
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 786: Line 736:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x26
+
  |rowspan="2"| 0x2F
  | Play
+
  |rowspan="2"| Play
  | Client
+
  |rowspan="2"| Server
  | Simulation Distance
+
| Hand
 +
| VarInt Enum
 +
| Hand used for the animation. 0: main hand, 1: off hand.
 +
|- {{added}}
 +
  | Sequence
 
  | VarInt
 
  | VarInt
| The distance that the client will process specific things, such as entities.
 
 
  |}
 
  |}
  
=== Serverbound ===
 
  
No changes so far.
 
  
 
== Status ==
 
== Status ==

Revision as of 01:44, 6 May 2022

This page documents the changes from the last stable Minecraft release (currently 1.18.2, protocol 758) to the current pre-release (currently 22w16b, protocol Snapshot 81). 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

Packet ID shifts have not been included.

ID Packet name Documentation
Play clientbound
0x02 Spawn Living Entity Current
0x03 Spawn Painting Current
0x05 Sculk Vibration Signal Current
0x05 Acknowledge Block Changes Pre
0x08 Acknowledge Player Digging Current
0x5C System Message Pre
Play serverbound
Handshaking serverbound

New/modified data types

No changes so far.

Entity Metadata

Goat

The base class.

Index Type Meaning Default
0 Boolean Is Screaming Goat false
1 Boolean Has Left Horn true
2 Boolean Has Right Horn true

Painting

The base class.

Index Type Meaning Default
0 VarInt PaintingVariant 0

Player

The base class.

Index Type Meaning Default
0 Float Additional Hearts 0.0
1 VarInt Score 0
2 Byte The Displayed Skin Parts bit mask that is sent in Client Settings 0
Bit mask Meaning
0x01 Cape enabled
0x02 Jacket enabled
0x04 Left sleeve enabled
0x08 Right sleeve enabled
0x10 Left pants leg enabled
0x20 Right pants leg enabled
0x40 Hat enabled
0x80 Unused
3 Byte Main hand (0 : Left, 1 : Right) 1
4 NBT Left shoulder entity data (for occupying parrot) Empty
5 NBT Right shoulder entity data (for occupying parrot) Empty
6 Global Position Optional Last Death Location (used for respawn compass) Empty


Entity

No changes so far.

Block Actions

No changes so far.

Inventories

No changes so far.

Plugin Channels

No changes so far.

Play

Clientbound

Spawn Entity

Sent by the server when a vehicle or other non-living entity is created.

Packet ID State Bound To Field Name Field Type Notes
0x00 Play Client Entity ID VarInt Entity ID.
Object UUID UUID
Type VarInt The type of entity (same as in Spawn Living Entity).
X Double
Y Double
Z Double
Pitch Angle To get the real pitch, you must divide this by (256.0F / 360.0F)
Yaw Angle To get the real yaw, you must divide this by (256.0F / 360.0F)
Head Yaw Angle
Data Int Meaning dependent on the value of the Type field, see Object Data for details.
Velocity X Short Same units as Entity Velocity. Always sent, but only used when Data is greater than 0 (except for some entities which always ignore it; see Object Data for details).
Velocity Y Short
Velocity Z Short


Acknowledge Block Changes

Packet ID State Bound To Field Name Field Type Notes
0x05 Play Client Sequence ID VarInt Represents the sequence to acknowledge, this is used for properly syncing block changes to the client after interactions.

Block Action

This packet is used for a number of actions and animations performed by blocks, usually non-persistent. The client ignores the provided block type and instead uses the block state in their world.

See Block Actions for a list of values.

Warning.png This packet uses a block ID, not a block state.

Packet ID State Bound To Field Name Field Type Notes
0x0B Play Client Location Position Block coordinates.
Action ID (Byte 1) Unsigned Byte Varies depending on block — see Block Actions.
Action Param (Byte 2) Unsigned Byte Varies depending on block — see Block Actions.
Block Type VarInt The block type ID for the block. This must match the block at the given coordinates.
Sequence VarInt


Named Sound Effect

See also: #Sound Effect

Used to play a sound effect on the client. Custom sounds may be added by resource packs.

Packet ID State Bound To Field Name Field Type Notes
0x19 0x16 Play Client Sound Name Identifier All sound effect names as of 1.16.5 can be seen here.
Sound Category VarInt Enum The category that this sound will be played from (current categories).
Effect Position X Int Effect X multiplied by 8 (fixed-point number with only 3 bits dedicated to the fractional part).
Effect Position Y Int Effect Y multiplied by 8 (fixed-point number with only 3 bits dedicated to the fractional part).
Effect Position Z Int Effect Z multiplied by 8 (fixed-point number with only 3 bits dedicated to the fractional part).
Volume Float 1 is 100%, can be more.
Pitch Float Float between 0.5 and 2.0 by Notchian clients.
Seed long Seed used to pick sound varient.

Chat Message Player Chat Msg (clientbound)

Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options. See processing chat for more info about these positions.

Packet ID State Bound To Field Name Field Type Notes
0x0F 0x2F Play Client JSON Data Chat Limited to 262144 bytes.
Position Type Byte VarInt 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar), 3: say command, 4: msg command, 5: team msg command, 6: emote command, 7: tellraw command
Sender UUID Used by the Notchian client for the disableChat launch option. Setting both longs to 0 will always display the message regardless of the setting.
Display Name Component
Has Team Display Name Boolean Used in /teammsg
Team Display Name Component Used in /teammsg
Timestamp Long Used to check that the message was received within 2 minutes of it being sent.
Salt Long Cryptography, TODO:
Signature Length VarInt Array Length
Message Signature Bytes Cryptography, TODO:

System Chat Message (clientbound)

Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options. See processing chat for more info about these positions.

Packet ID State Bound To Field Name Field Type Notes
0x5C Play Client JSON Data Chat Limited to 262144 bytes.
Type VarInt 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar), 3: say command, 4: msg command, 5: team msg command, 6: emote command, 7: tellraw command

Entity Sound Effect

Plays a sound effect from an entity.

Packet ID State Bound To Field Name Field Type Notes
0x5C 0x59 Play Client Sound ID VarInt ID of hardcoded sound event (events as of 1.16.5).
Sound Category VarInt Enum The category that this sound will be played from (current categories).
Entity ID VarInt
Volume Float 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients.
Pitch Float Float between 0.5 and 2.0 by Notchian clients.
Seed long Seed used to pick sound varient.


Sound Effect

This packet is used to play a number of hardcoded sound events. For custom sounds, use Named Sound Effect.

Warning.png Numeric sound effect IDs are liable to change between versions

Packet ID State Bound To Field Name Field Type Notes
0x5D 0x5A Play Client Sound ID VarInt ID of hardcoded sound event (events as of 1.16.5).
Sound Category VarInt Enum The category that this sound will be played from (current categories).
Effect Position X Int Effect X multiplied by 8 (fixed-point number with only 3 bits dedicated to the fractional part).
Effect Position Y Int Effect Y multiplied by 8 (fixed-point number with only 3 bits dedicated to the fractional part).
Effect Position Z Int Effect Z multiplied by 8 (fixed-point number with only 3 bits dedicated to the fractional part).
Volume Float 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients.
Pitch Float Float between 0.5 and 2.0 by Notchian clients.
Seed long Seed used to pick sound varient.

Entity Effect

Packet ID State Bound To Field Name Field Type Notes
0x65 0x62 Play Client Entity ID VarInt
Effect ID VarInt See this table.
Amplifier Byte Notchian client displays effect level as Amplifier + 1.
Duration VarInt Duration in ticks.
Flags Byte Bit field, see below.
Has Factor Data boolean Used in DARKNESS effect
Factor Codec NBT Tag See below

Within flags:

  • 0x01: Is ambient - was the effect spawned from a beacon? All beacon-generated effects are ambient. Ambient effects use a different icon in the HUD (blue border rather than gray). If all effects on an entity are ambient, the "Is potion effect ambient" living metadata field should be set to true. Usually should not be enabled.
  • 0x02: Show particles - should all particles from this effect be hidden? Effects with particles hidden are not included in the calculation of the effect color, and are not rendered on the HUD (but are still rendered within the inventory). Usually should be enabled.
  • 0x04: Show icon - should the icon be displayed on the client? Usually should be enabled.

Factor Data

Name Type Notes
padding_duration TAG_INT
factor_target TAG_FLOAT
factor_current TAG_FLOAT
effect_changed_timestamp TAG_INT
factor_previous_frame TAG_FLOAT
had_effect_last_tick TAG_BOOLEAN

Serverbound

Player Digging

Sent when the player mines a block. A Notchian server only accepts digging packets with coordinates within a 6-unit radius between the center of the block and 1.5 units from the player's feet (not their eyes).

Packet ID State Bound To Field Name Field Type Notes
0x1A Play Server Status VarInt Enum The action the player is taking against the block (see below).
Location Position Block position.
Face Byte Enum The face being hit (see below).
Sequence VarInt

Status can be one of seven values:

Value Meaning Notes
0 Started digging
1 Cancelled digging Sent when the player lets go of the Mine Block key (default: left click).
2 Finished digging Sent when the client thinks it is finished.
3 Drop item stack Triggered by using the Drop Item key (default: Q) with the modifier to drop the entire selected stack (default: Control or Command, depending on OS). Location is always set to 0/0/0, Face is always set to -Y.
4 Drop item Triggered by using the Drop Item key (default: Q). Location is always set to 0/0/0, Face is always set to -Y.
5 Shoot arrow / finish eating Indicates that the currently held item should have its state updated such as eating food, pulling back bows, using buckets, etc. Location is always set to 0/0/0, Face is always set to -Y.
6 Swap item in hand Used to swap or assign an item to the second hand. Location is always set to 0/0/0, Face is always set to -Y.

The Face field can be one of the following values, representing the face being hit:

Value Offset Face
0 -Y Bottom
1 +Y Top
2 -Z North
3 +Z South
4 -X West
5 +X East

Set Beacon Effect

Changes the effect of the current beacon.

Packet ID State Bound To Field Name Field Type Notes
0x24 Play Server
Primary Effect Present Boolean
Primary Effect VarInt A Potion ID. (Was a full Integer for the plugin message).
Secondary Effect Present Boolean
Secondary Effect VarInt A Potion ID. (Was a full Integer for the plugin message).

Use Item

Sent when pressing the Use Item key (default: right click) with an item in hand.

Packet ID State Bound To Field Name Field Type Notes
0x2F Play Server Hand VarInt Enum Hand used for the animation. 0: main hand, 1: off hand.
Sequence VarInt


Status

Clientbound

No changes so far.

Serverbound

No changes so far.

Login

Clientbound

No changes so far.

Serverbound

No changes so far.