Difference between revisions of "Pre-release protocol"

From wiki.vg
Jump to navigation Jump to search
(moar stuff)
 
Line 1: Line 1:
This page documents the changes from the [[Protocol|last stable Minecraft release]] (currently [[Protocol version numbers|1.8.8, protocol 47]]) to the current pre-release (currently [[Protocol version numbers|15w38b, protocol 73]]). Note that this page contains bleeding-edge information that may not be completely or correctly documented.
+
This page documents the changes from release 1.21.1 (protocol 767) to the current release (1.21.3, protocol 768). The stable protocol documentation is currently lagging behind, and the changes documented here will be merged soon, once they are complete. The current pre-release (snapshot 24w44a) is not yet 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.
__NOTOC__
+
 
 
== Contents ==
 
== Contents ==
 +
 +
<div style="float:right;">__TOC__</div>
  
 
=== Data types ===
 
=== Data types ===
  
* [[#Chunk Section|Chunk Section]]
+
{| class="wikitable"
* [[#Entity Metadata|Entity Metadata]]
+
|-
 +
! Name
 +
! Size (bytes)
 +
! Encodes
 +
! Notes
 +
|- {{added}}
 +
! id=Type:Teleport_Flags | {{Type|Teleport Flags}}
 +
| 4
 +
| Bit field specifying how a teleportation is to be applied on each axis.
 +
| See [[#Teleport Flags]]
 +
|}
 +
 
 +
==== Teleport Flags ====
 +
 
 +
A bit field represented as an {{Type|Int}}, specifying how a teleportation is to be applied on each axis.
  
=== Packets ===
+
In the lower 8 bits of the bit field, a set bit means the teleportation on the corresponding axis is relative, and an unset bit that it is absolute.
  
 
{| class="wikitable"
 
{| class="wikitable"
! ID
 
! Packet name
 
! colspan=2 | Documentation
 
 
  |-
 
  |-
  ! colspan=4 | Handshaking serverbound
+
  ! Hex Mask
{{PacketList|0x00|Handshake}}
+
! Field
 +
|-
 +
| 0x0001
 +
| Relative X
 
  |-
 
  |-
  ! colspan=4 | Play clientbound
+
  | 0x0002
{{PacketList|{{Change|0x0E|0x00}}|Spawn Object}}
+
| Relative Y
{{PacketList|{{Change|0x11|0x01}}|Spawn Experience Orb|pre=unchanged}}
 
{{PacketList|{{Change|0x2C|0x02}}|Spawn Global Entity|pre=unchanged}}
 
{{PacketList|{{Change|0x0F|0x03}}|Spawn Mob}}
 
{{PacketList|{{Change|0x10|0x04}}|Spawn Painting|pre=unchanged}}
 
{{PacketList|{{Change|0x0C|0x05}}|Spawn Player}}
 
{{PacketList|{{Change|0x0B|0x06}}|Animation|pre=unchanged}}
 
{{PacketList|{{Change|0x37|0x07}}|Statistics|pre=unchanged}}
 
{{PacketList|{{Change|0x25|0x08}}|Block Break Animation|pre=unchanged}}
 
{{PacketList|{{Change|0x35|0x09}}|Update Block Entity|pre=unchanged}}
 
{{PacketList|{{Change|0x24|0x0A}}|Block Action|pre=unchanged}}
 
{{PacketList|{{Change|0x23|0x0B}}|Block Change|pre=unchanged}}
 
{{PacketList|0x0C|Boss Bar|rel=added}}
 
{{PacketList|{{Change|0x41|0x0D}}|Server Difficulty|pre=unchanged}}
 
{{PacketList|{{Change|0x3A|0x0E}}|Tab-Complete|pre=unchanged}}
 
{{PacketList|{{Change|0x02|0x0F}}|Chat Message|pre=unchanged}}
 
{{PacketList|{{Change|0x22|0x10}}|Multi Block Change|pre=unchanged}}
 
{{PacketList|{{Change|0x32|0x11}}|Confirm Transaction|pre=unchanged}}
 
{{PacketList|{{Change|0x2E|0x12}}|Close Window|pre=unchanged}}
 
{{PacketList|{{Change|0x2D|0x13}}|Open Window|pre=unchanged}}
 
{{PacketList|{{Change|0x30|0x14}}|Window Items|pre=unchanged}}
 
{{PacketList|{{Change|0x31|0x15}}|Window Property|pre=unchanged}}
 
{{PacketList|{{Change|0x2F|0x16}}|Set Slot|pre=unchanged}}
 
{{PacketList|0x17|Set Cooldown|rel=added}}
 
{{PacketList|{{Change|0x3F|0x18}}|Plugin Message|pre=unchanged}}
 
{{PacketList|{{Change|0x40|0x19}}|Disconnect|pre=unchanged}}
 
{{PacketList|0x1A|Entity Status}}
 
{{PacketList|{{Change|0x27|0x1B}}|Explosion|pre=unchanged}}
 
{{PacketList|0x1C|Unload Chunk|rel=added}}
 
{{PacketList|{{Change|0x46|0x1D}}|Set Compression|pre=unchanged}}
 
{{PacketList|{{Change|0x2B|0x1E}}|Change Game State|pre=unchanged}}
 
{{PacketList|{{Change|0x00|0x1F}}|Keep Alive|pre=unchanged}}
 
{{PacketList|{{Change|0x21|0x20}}|Chunk Data}}
 
{{PacketList|{{Change|0x28|0x21}}|Effect|pre=unchanged}}
 
{{PacketList|{{Change|0x2A|0x22}}|Particle|pre=unchanged}}
 
{{PacketList|{{Change|0x29|0x23}}|Sound Effect|pre=unchanged}}
 
{{PacketList|{{Change|0x01|0x24}}|Join Game|pre=unchanged}}
 
{{PacketList|{{Change|0x34|0x25}}|Map}}
 
{{PacketList|{{Change|0x15|0x26}}|Entity Relative Move|pre=unchanged}}
 
{{PacketList|{{Change|0x17|0x27}}|Entity Look And Relative Move|pre=unchanged}}
 
{{PacketList|{{Change|0x16|0x28}}|Entity Look|pre=unchanged}}
 
{{PacketList|{{Change|0x14|0x29}}|Entity|pre=unchanged}}
 
{{PacketList|{{Change|0x36|0x2A}}|Open Sign Editor|pre=unchanged}}
 
{{PacketList|{{Change|0x39|0x2B}}|Player Abilities|pre=unchanged}}
 
{{PacketList|{{Change|0x42|0x2C}}|Combat Event}}
 
{{PacketList|{{Change|0x38|0x2D}}|Player List Item|pre=unchanged}}
 
{{PacketList|{{Change|0x08|0x2E}}|Player Position And Look|pre=unchanged}}
 
{{PacketList|{{Change|0x0A|0x2F}}|Use Bed|pre=unchanged}}
 
{{PacketList|{{Change|0x13|0x30}}|Destroy Entities|pre=unchanged}}
 
{{PacketList|{{Change|0x1E|0x31}}|Remove Entity Effect|pre=unchanged}}
 
{{PacketList|{{Change|0x48|0x32}}|Resource Pack Send|pre=unchanged}}
 
{{PacketList|{{Change|0x07|0x33}}|Respawn|pre=unchanged}}
 
{{PacketList|{{Change|0x19|0x34}}|Entity Head Look|pre=unchanged}}
 
{{PacketList|{{Change|0x44|0x35}}|World Border|pre=unchanged}}
 
{{PacketList|{{Change|0x43|0x36}}|Camera|pre=unchanged}}
 
{{PacketList|{{Change|0x09|0x37}}|Held Item Change|pre=unchanged}}
 
{{PacketList|{{Change|0x3D|0x38}}|Display Scoreboard|pre=unchanged}}
 
{{PacketList|{{Change|0x1C|0x39}}|Entity Metadata|pre=unchanged}}
 
{{PacketList|{{Change|0x1B|0x3A}}|Attach Entity|pre=unchanged}}
 
{{PacketList|{{Change|0x12|0x3B}}|Entity Velocity|pre=unchanged}}
 
{{PacketList|{{Change|0x04|0x3C}}|Entity Equipment}}
 
{{PacketList|{{Change|0x1F|0x3D}}|Set Experience|pre=unchanged}}
 
{{PacketList|{{Change|0x06|0x3E}}|Update Health|pre=unchanged}}
 
{{PacketList|{{Change|0x3B|0x3F}}|Scoreboard Objective|pre=unchanged}}
 
{{PacketList|{{Change|0x3E|0x40}}|Teams}}
 
{{PacketList|{{Change|0x3C|0x41}}|Update Score|pre=unchanged}}
 
{{PacketList|{{Change|0x05|0x42}}|Spawn Position|pre=unchanged}}
 
{{PacketList|{{Change|0x03|0x43}}|Time Update|pre=unchanged}}
 
{{PacketList|{{Change|0x45|0x44}}|Title|pre=unchanged}}
 
{{PacketList|{{Change|0x33|0x45}}|Update Sign|pre=unchanged}}
 
{{PacketList|{{Change|0x47|0x46}}|Player List Header And Footer|pre=unchanged}}
 
{{PacketList|{{Change|0x0D|0x47}}|Collect Item|pre=unchanged}}
 
{{PacketList|{{Change|0x18|0x48}}|Entity Teleport|pre=unchanged}}
 
{{PacketList|{{Change|0x20|0x49}}|Entity Properties}}
 
{{PacketList|{{Change|0x1D|0x4A}}|Entity Effect|pre=unchanged}}
 
{{PacketList|0x26|Map Chunk Bulk|pre=removed}}
 
{{PacketList|0x49|Update Entity NBT|pre=removed}}
 
 
  |-
 
  |-
  ! colspan=4 | Play serverbound
+
  | 0x0004
{{PacketList|{{Change|0x14|0x00}}|Tab-Complete|rel=Tab-Complete 2|pre=unchanged}}
+
| Relative Z
{{PacketList|0x01|Chat Message|rel=Chat Message 2|pre=unchanged}}
 
{{PacketList|{{Change|0x16|0x02}}|Client Status}}
 
{{PacketList|{{Change|0x15|0x03}}|Client Settings}}
 
{{PacketList|{{Change|0x0F|0x04}}|Confirm Transaction|rel=Confirm Transaction 2|pre=unchanged}}
 
{{PacketList|{{Change|0x11|0x05}}|Enchant Item|pre=unchanged}}
 
{{PacketList|{{Change|0x0E|0x06}}|Click Window|pre=unchanged}}
 
{{PacketList|{{Change|0x0D|0x07}}|Close Window|rel=Close Window 2|pre=unchanged}}
 
{{PacketList|{{Change|0x17|0x08}}|Plugin Message|rel=Plugin Message 2|pre=unchanged}}
 
{{PacketList|{{Change|0x02|0x09}}|Use Entity}}
 
{{PacketList|{{Change|0x00|0x0A}}|Keep Alive|rel=Keep Alive 2|pre=unchanged}}
 
{{PacketList|{{Change|0x04|0x0B}}|Player Position|pre=unchanged}}
 
{{PacketList|{{Change|0x06|0x0C}}|Player Position And Look|rel=Player Position And Look 2|pre=unchanged}}
 
{{PacketList|{{Change|0x05|0x0D}}|Player Look|pre=unchanged}}
 
{{PacketList|{{Change|0x03|0x0E}}|Player|pre=unchanged}}
 
{{PacketList|{{Change|0x13|0x0F}}|Player Abilities|rel=Player Abilities 2|pre=unchanged}}
 
{{PacketList|{{Change|0x07|0x10}}|Player Digging}}
 
{{PacketList|{{Change|0x0B|0x11}}|Entity Action}}
 
{{PacketList|{{Change|0x0C|0x12}}|Steer Vehicle|pre=unchanged}}
 
{{PacketList|{{Change|0x19|0x13}}|Resource Pack Status|pre=unchanged}}
 
{{PacketList|{{Change|0x09|0x14}}|Held Item Change|rel=Held Item Change 2|pre=unchanged}}
 
{{PacketList|{{Change|0x10|0x15}}|Creative Inventory Action|pre=unchanged}}
 
{{PacketList|{{Change|0x12|0x16}}|Update Sign|rel=Update Sign 2}}
 
{{PacketList|{{Change|0x0A|0x17}}|Animation|rel=Animation 2}}
 
{{PacketList|0x18|Spectate|pre=unchanged}}
 
{{PacketList|{{Change|0x08|0x19}}|Player Block Placement}}
 
{{PacketList|0x1A|Use Item|rel=added}}
 
 
  |-
 
  |-
  ! colspan=4 | Status clientbound
+
  | 0x0008
{{PacketList|0x00|Response|pre=unchanged}}
+
| Relative Yaw
{{PacketList|0x01|Pong|pre=unchanged}}
 
 
  |-
 
  |-
  ! colspan=4 | Status serverbound
+
  | 0x0010
{{PacketList|0x00|Request|pre=unchanged}}
+
| Relative Pitch
{{PacketList|0x01|Ping|pre=unchanged}}
+
|- {{added}}
 +
| 0x0020
 +
| Relative Velocity X
 +
|- {{added}}
 +
| 0x0040
 +
| Relative Velocity Y
 +
|- {{added}}
 +
| 0x0080
 +
| Relative Velocity Z
 +
|- {{added}}
 +
| 0x0100
 +
| Rotate velocity according to the change in rotation, ''before'' applying the velocity change in this packet. Combining this with absolute rotation works as expected&mdash;the difference in rotation is still used.
 +
|}
 +
 
 +
=== Packets ===
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Packet name
 +
!colspan="2"| Documentation
 
  |-
 
  |-
  ! colspan=4 | Login clientbound
+
  !colspan="4"| Play clientbound
{{PacketList|0x00|Disconnect|rel=Disconnect 2|pre=unchanged}}
+
{{PacketList|0x12|Close Container}}
{{PacketList|0x01|Encryption Request|pre=unchanged}}
+
{{PacketList|0x13|Set Container Content}}
{{PacketList|0x02|Login Success|pre=unchanged}}
+
{{PacketList|0x14|Set Container Property}}
{{PacketList|0x03|Set Compression|rel=Set Compression 2|pre=unchanged}}
+
{{PacketList|0x15|Set Container Slot}}
 +
{{PacketList|0x17|Set Cooldown}}
 +
{{PacketList|{{change|0x70|0x20}}|Teleport Entity}}
 +
{{PacketList|{{change|0x20|0x21}}|Explosion}}
 +
{{PacketList|{{change|0x23|0x24}}|Open Horse Screen}}
 +
{{PacketList|{{change|0x2B|0x2C}}|Login (play)}}
 +
{{PacketList|0x31|Move Minecart Along Track|rel=added}}
 +
{{PacketList|{{change|0x37|0x39}}|Place Ghost Recipe}}
 +
{{PacketList|{{change|0x3E|0x40}}|Player Info Update}}
 +
{{PacketList|{{change|0x40|0x42}}|Synchronize Player Position}}
 +
{{PacketList|0x41|Update Recipe Book|pre=removed}}
 +
{{PacketList|0x43|Player Rotation|rel=added}}
 +
{{PacketList|0x44|Recipe Book Add|rel=added}}
 +
{{PacketList|0x45|Recipe Book Remove|rel=added}}
 +
{{PacketList|0x46|Recipe Book Settings|rel=added}}
 +
{{PacketList|{{change|0x47|0x4C}}|Respawn}}
 +
{{PacketList|0x5a|Set Cursor Item|rel=added}}
 +
{{PacketList|{{change|0x53|0x63}}|Set Held Item|pre=unchanged}}
 +
{{PacketList|0x66|Set Player Inventory Slot|rel=added}}
 +
{{PacketList|{{change|0x64|0x6b}}|Update Time}}
 +
{{PacketList|0x77|Synchronize Vehicle Position|rel=added}}
 
  |-
 
  |-
  ! colspan=4 | Login serverbound
+
  !colspan="4"| Play serverbound
{{PacketList|0x00|Login Start|pre=unchanged}}
+
{{PacketList|0x02|Bundle Item Selected|rel=added}}
{{PacketList|0x01|Encryption Response|pre=unchanged}}
+
{{PacketList|0x0b|Client Tick End|rel=added}}
 +
{{PacketList|{{change|0x0E|0x10}}|Click Container}}
 +
{{PacketList|{{change|0x0F|0x11}}|Close Container}}
 +
{{PacketList|{{change|0x14|0x16}}|Edit Book}}
 +
{{PacketList|{{change|0x1A|0x1C}}|Set Player Position}}
 +
{{PacketList|{{change|0x1B|0x1D}}|Set Player Position and Rotation}}
 +
{{PacketList|{{change|0x1C|0x1E}}|Set Player Rotation}}
 +
{{PacketList|0x1D|Set Player On Ground|pre=removed}}
 +
{{PacketList|0x1F|Set Player Movement Flags|rel=added}}
 +
{{PacketList|{{change|0x22|0x24}}|Place Recipe}}
 +
{{PacketList|{{change|0x26|0x28}}|Player Input}}
 +
{{PacketList|{{change|0x29|0x2B}}|Set Seen Recipe}}
 +
{{PacketList|{{change|0x38|0x3A}}|Use Item On}}
 
  |}
 
  |}
  
== New/modified data types ==
+
== Entity Metadata ==
 +
 
 +
=== Entity Metadata Format ===
  
=== Chunk Section ===
+
==== Painting Variant ====
  
Format is now:
+
{{See also|Registry Data#Painting Variant}}
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Meaning
 
  |-
 
  |-
! Field Name
+
  | Width
! Field Type
+
  | {{Type|Int}}
! Notes
+
  | The width of the painting, in blocks.  
  |-
 
  | Bits Per Block
 
| Unsigned Byte
 
  | How many bits per block in Data Array. If 0, the Palette Length and Palette fields are omitted and the global palette (with 13 bits per block) is used.
 
 
  |-
 
  |-
  | Palette Length
+
  | Height
  | Optional VarInt
+
  | {{Type|Int}}
  | Length of the following array
+
  | The height of the painting, in blocks.
 
  |-
 
  |-
  | Palette
+
  | Asset ID
  | Optional Array of VarInt
+
  | {{Type|Identifier}}
| Mapping of block state IDs in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (<code>type = x >> 4</code>, <code>meta = x & 15</code>) to indices of this array
+
| The texture for the painting.
  |-
+
The Notchian client uses the corresponding asset located at
  | Data Array Length
+
<code>textures/painting</code>.
  | VarInt
+
  |- {{added}}
  | Number of bytes in the following array, divided by 8 (given as such because Notchian implements Data Array as an Array of Long)
+
  | Has title
  |-
+
  | {{Type|Boolean}}
  | Data Array
+
  |
  | Byte Array
+
  |- {{added}}
  | List of 4096 indices pointing to state IDs in the Palette, followed by padding to round the length up to the next multiple of 8 bytes
+
  | Title
  |-
+
  | {{Type|Optional}} {{Type|Text Component}}
  | Block Light
+
  | The displayed title of the painting. Only present if Has title is true.
  | Byte Array
+
  |- {{added}}
  | Half byte per block
+
  | Has author
  |-
+
  | {{Type|Boolean}}
  | Sky Light
+
  |
  | Optional Byte Array
+
  |- {{added}}
  | Only if in the Overworld; half byte per block
+
  | Author
 +
  | {{Type|Optional}} {{Type|Text Component}}
 +
  | The displayed author of the painting. Only present if Has author is true.
 
  |}
 
  |}
  
Data Array, Block Light, and Sky Light are given for each block with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates.
+
== Registry Data ==
  
=== Entity Metadata ===
+
=== Painting Variant ===
  
Format is now an array of entries, each of which looks like the following:
+
The <code>minecraft:painting_variant</code> registry. It defines the textures and dimensions for the game's paintings.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 198: Line 165:
 
  ! Type
 
  ! Type
 
  ! Meaning
 
  ! Meaning
 +
! Values
 
  |-
 
  |-
  | Index
+
  | asset_id
  | Unsigned Byte
+
  | [[NBT#Specification:string_tag|String Tag]]
  | Unique index key determining the meaning of the following value, see the table below. If this is <code>0xff</code> then the it is the end of the Entity Metadata array and no more is read.
+
  | The texture for the painting.
 +
The Notchian client uses the corresponding asset located at
 +
<code>textures/painting</code>.
 +
| Example: "minecraft:backyard".
 
  |-
 
  |-
  | Type
+
  | height
  | Optional Byte Enum
+
  | [[NBT#Specification:int_tag|Int Tag]]
  | Only if Index is not <code>0xff</code>; the type of the index, see the table below
+
| The height of the painting, in blocks.
 +
  | Example: <code>2</code>
 
  |-
 
  |-
  | Value
+
  | width
  | Optional ''value of Type''
+
  | [[NBT#Specification:int_tag|Int Tag]]
  | Only if Index is not <code>0xff</code>: the value of the metadata field
+
| The width of the painting, in blocks.
 +
|
 +
|- {{added}}
 +
| title
 +
| [[NBT#Specification:compound_tag|Compound Tag]] or [[NBT#Specification:string_tag|String Tag]]
 +
| The displayed title of the painting. See [[Text formatting]].
 +
  | Example: <code>{"color": "gray", "translate": "painting.minecraft.skeleton.title"}</code>
 +
|- {{added}}
 +
| author
 +
| [[NBT#Specification:compound_tag|Compound Tag]] or [[NBT#Specification:string_tag|String Tag]]
 +
| The displayed author of the painting. See [[Text formatting]].
 +
| Example: <code>{"color": "gray", "translate": "painting.minecraft.skeleton.author"}</code>
 
  |}
 
  |}
 +
 +
== Slot Data ==
 +
 +
=== Structured components ===
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Value of Type field
+
  ! Type
  ! Type of Value field
+
  ! Name
  ! Notes
+
  ! Description
|-
+
  ! style="width: 50%" | Data
| 0
+
  |- {{added}}
| Byte
 
|
 
|-
 
| 1
 
| VarInt
 
|
 
|-
 
| 2
 
| Float
 
|
 
|-
 
| 3
 
| String
 
|
 
|-
 
| 4
 
| [[Chat]]
 
|
 
|-
 
| 5
 
| [[Slot]]
 
  |  
 
  |-
 
 
  | 6
 
  | 6
  | Boolean
+
  | <code>minecraft:item_model</code>
  |  
+
  | Item's model.
 +
| As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Model
 +
    | {{Type|Identifier}}
 +
    |
 +
    |}
 
  |-
 
  |-
  | 7
+
  | {{change|20|21}}
  | Vector3F (Array of Float)
+
| <code>minecraft:food</code>
| 3 elements
+
| Makes the item {{change|consumable|restore the player's hunger bar when consumed}}.
  |-  
+
  | As follows:
  | 8
+
  {| class="wikitable"
  | Position
+
    ! colspan="2"| Name
  |  
+
    ! colspan="2"| Type
  |-
+
    ! Description
  | 9
+
    |-
  | OptPosition (Boolean + Optional Position)
+
    | colspan="2"| Nutrition
  | Position is present if the Boolean is set to true
+
    | colspan="2"| {{Type|VarInt}}
  |-
+
    | Non-negative
  | 10
+
    |-
  | Direction (VarInt)
+
    | colspan="2"| Saturation Modifier
  | ???
+
    | colspan="2"| {{Type|Float}}
 +
    | How much saturation will be given after consuming the item.
 +
    |-
 +
    | colspan="2"| Can Always Eat
 +
    | colspan="2"| {{Type|Boolean}}
 +
    | Whether the item can always be eaten, even at full hunger.
 +
    |- {{removed}}
 +
    | colspan="2"| Seconds To Eat
 +
    | colspan="2"| {{Type|Float}}
 +
    | How long it takes to consume the item.
 +
    |- {{removed}}
 +
    | colspan="2"| Using converts to
 +
    | colspan="2"| {{Type|Slot Data}}
 +
    | This specifies the item produced after consuming the current item. In the Notchian server, this is used for stews, which turn into bowls. Set this to Air if the item should be consumed normally without leaving any other item after.
 +
    |- {{removed}}
 +
    | colspan="2"| Number of effects
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |- {{removed}}
 +
    | rowspan="2"| Effect
 +
    | Type ID
 +
    | rowspan="2"| {{Type|Array}}
 +
    | [[#Potion_Effect|Potion Effect]]
 +
    | The potion effect. See [[#Potion_Effect|Potion Effect]].
 +
    |- {{removed}}
 +
    | Probability
 +
    | {{Type|Float}}
 +
    | The probability for this effect to be chosen.
 +
    |}
 +
  |- {{added}}
 +
  | 22
 +
  | <code>minecraft:consumable</code>
 +
  | Makes the item consumable.
 +
  | As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Consume seconds
 +
    | {{Type|Float}}
 +
    | How long it takes to consume the item.
 +
    |-
 +
    | Animation
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | 0: none, 1: eat, 2: drink, 3: block, 4: bow, 5: spear, 6: crossbow, 7: spyglass, 8: toot_horn, 9: brush
 +
    |-
 +
    | Sound
 +
    | {{Type|ID or}} {{Type|Sound Event}}
 +
    | ID in the <code>minecraft:sound_event</code> registry, or an inline definition.
 +
    |-
 +
    | Has consume particles
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Number of effects
 +
    | {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | Effects
 +
    | {{Type|Array}} of [[#Consume Effect|Consume Effect]]
 +
    | Effects to apply on consumption. See [[#Consume Effect|Consume Effect]].
 +
    |}
 +
  |- {{added}}
 +
| 23
 +
  | <code>minecraft:use_remainder</code>
 +
  | This specifies the item produced after using the current item. In the Notchian server, this is used for stews, which turn into bowls.
 +
| As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Remainder
 +
    | {{Type|Slot}}
 +
    |
 +
    |}
 +
  |- {{added}}
 +
| 24
 +
  | <code>minecraft:use_cooldown</code>
 +
  | Cooldown to apply on use of the item.
 +
  | As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Seconds
 +
    | {{Type|Float}}
 +
    |
 +
    |-
 +
    | Cooldown group
 +
    | {{Type|Optional}} {{Type|Identifier}}
 +
    | Group of items to apply the cooldown to. Only present if Has cooldown group is true; otherwise defaults to the item's identifier.
 +
    |}
 
  |-
 
  |-
  | 11
+
  | {{change|21|25}}
  | OptUUID (Boolean + Optional UUID)
+
| <code>minecraft:{{change|fire|damage}}_resistant</code>
| UUID is present if the Boolean is set to true
+
| Marks this item as {{change|fire|damage}} resistant.<br>The client won't render the item as being on-fire if this component is present.
 +
| {{change|None.|As follows:}}
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Types
 +
    | {{Type|Identifier}}
 +
    | Tag specifying damage types the item is immune to. Not prefixed by '#'!.
 +
    |}
 +
|- {{added}}
 +
| 27
 +
| <code>minecraft:enchantable</code>
 +
| Allows the item to be enchanted by an enchanting table.
 +
| As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Value
 +
    | {{Type|VarInt}}
 +
    | Opaque internal value controlling how expensive enchantments may be offered.
 +
    |}
 +
|- {{added}}
 +
| 28
 +
| <code>minecraft:equippable</code>
 +
| Allows the item to be equipped by the player.
 +
  | As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Slot
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | 0: mainhand, 1: feet, 2: legs, 3: chest, 4: head, 5: offhand, 6: body
 +
    |-
 +
    | Equip sound
 +
    | {{Type|ID or}} {{Type|Sound Event}}
 +
    | ID in the <code>minecraft:sound_event</code> registry, or an inline definition.
 +
    |-
 +
    | Has model
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Model
 +
    | {{Type|Optional}} {{Type|Identifier}}
 +
    | Only present if Has model is true.
 +
    |-
 +
    | Has camera overlay
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Camera overlay
 +
    | {{Type|Optional}} {{Type|Identifier}}
 +
    | Only present if Has camera overlay is true.
 +
    |-
 +
    | Has allowed entities
 +
    | {{Type|Boolean}}
 +
    |-
 +
    | Allowed entities
 +
    | {{Type|Optional}} {{Type|ID Set}}
 +
    | IDs in the <code>minecraft:entity_type</code> registry. Only present if Has allowed entities is true.
 +
    |-
 +
    | Dispensable
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Swappable
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Damage on hurt
 +
    | {{Type|Boolean}}
 +
    |
 +
    |}
 +
|- {{added}}
 +
| 29
 +
| <code>minecraft:repairable</code>
 +
| Items that can be combined with this item in an anvil to repair it.
 +
| As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Items
 +
    | {{Type|ID Set}}
 +
    | IDs in the <code>minecraft:item</code> registry.
 +
    |}
 +
|- {{added}}
 +
| 30
 +
| <code>minecraft:glider</code>
 +
| Makes the item function like elytra.
 +
| None.
 +
|- {{added}}
 +
| 31
 +
| <code>minecraft:tooltip_style</code>
 +
| Custom textures for the item tooltip.
 +
| As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Style
 +
    | {{Type|Identifier}}
 +
    |
 +
    |}
 +
|- {{added}}
 +
| 32
 +
| <code>minecraft:death_protection</code>
 +
| Makes the item function like a totem of undying.
 +
| As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Number of effects
 +
    | {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | Effects
 +
    | {{Type|Array}} of [[#Consume Effect|Consume Effect]]
 +
    | Effects to apply on consumption. See [[#Consume Effect|Consume Effect]].
 +
    |}
 
  |-
 
  |-
  | 12
+
  | {{change|31|41}}
| BlockID
+
  | <code>minecraft:potion_contents</code>
  | <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
+
| Visual and effects of a potion item.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Has Potion ID
 +
    | {{Type|Boolean}}
 +
    | Whether this potion has an ID in the potion registry. If true, it has the default effects associated with the potion type.
 +
    |-
 +
    | Potion ID
 +
    | {{Type|Optional}} {{Type|VarInt}}
 +
    | The ID of the potion type in the potion registry. Only present if Has Potion ID is true.
 +
    |-
 +
    | Has Custom Color
 +
    | {{Type|Boolean}}
 +
    | Whether this potion has a custom color. If false, it uses the default color associated with the potion type.
 +
    |-
 +
    | Custom Color
 +
    | {{Type|Optional}} {{Type|Int}}
 +
    | The RGB components of the color, encoded as an integer. Only present if Has Custom Color is true.
 +
    |-
 +
    | Number Of Custom Effects
 +
    | {{Type|VarInt}}
 +
    | The number of elements in the following array.
 +
    |-
 +
    | Custom Effects
 +
    | {{Type|Array}} of [[#Potion_Effect|Potion Effect]]
 +
    | Any custom effects the potion might have. See [[#Potion_Effect|Potion Effect]].
 +
    |- {{added}}
 +
    | Custom Name
 +
    | {{Type|String}}
 +
    |
 +
    |}
 
  |}
 
  |}
 +
 +
=== Other types ===
 +
 +
==== Consume Effect ====
 +
 +
WIP
 +
 +
==== Instrument ====
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Entity class
+
  ! Name
! Index
 
 
  ! Type
 
  ! Type
  ! Meaning
+
  ! Description
 
  |-
 
  |-
  |rowspan="5"| Entity
+
  | Sound Event
  | 0
+
  | {{Type|Id or}} {{Type|Sound Event}}
| Byte
+
  | The sound to be played.
  | ''Unknown''
 
 
  |-
 
  |-
  | 1
+
  | Use duration
  | VarInt
+
  | {{change|{{Type|VarInt}}|{{Type|Float}}}}
  | ''Unknown''
+
  | The maximum range of the sound.
 
  |-
 
  |-
  | 2
+
  | Range
  | String
+
  | {{Type|Float}}
| ''Unknown''
+
  | The range of the instrument.
|-
+
  |- {{added}}
| 3
+
  | Description
| Boolean
+
  | {{Type|Text Component}}
| ''Unknown''
+
  | Description shown in the item tooltip.
|-
+
  |}
| 4
+
 
| Boolean
+
== Particles ==
| ''Unknown''
+
 
|-
+
{| class="wikitable"
|rowspan="4"| AreaEffectCloud <sup>extends Entity</sup>
 
| 5
 
| Float
 
| ''Unknown''
 
|-
 
| 6
 
| VarInt
 
| ''Unknown''
 
|-
 
| 7
 
| Boolean
 
| ''Unknown''
 
|-
 
| 8
 
| VarInt
 
| ''Unknown''
 
|-
 
| Arrow <sup>extends Entity</sup>
 
| 5
 
| Byte
 
| ''Unknown''
 
|-
 
| TippedArrow <sup>extends Arrow</sup>
 
| 6
 
| VarInt
 
| ''Unknown''
 
|-
 
|rowspan="3"| Boat <sup>extends Entity</sup>
 
| 5
 
| VarInt
 
| ''Unknown''
 
|-
 
| 6
 
| VarInt
 
| ''Unknown''
 
|-
 
| 7
 
| Float
 
  | ''Unknown''
 
  |-
 
  | EnderCrystal <sup>extends Entity</sup>
 
  | 5
 
| OptPosition
 
  | ''Unknown''
 
  |-
 
| Fireball <sup>extends Entity</sup>
 
|colspan="3"| ''no additional metadata''
 
|-
 
| WitherSkull <sup>extends Fireball</sup>
 
| 5
 
| Boolean
 
| ''Unknown''
 
|-
 
| Fireworks <sup>extends Entity</sup>
 
| 5
 
| [[Slot]]
 
| ''Unknown''
 
|-
 
| Hanging <sup>extends Entity</sup>
 
|colspan="3"| ''no additional metadata''
 
|-
 
|rowspan="2"| ItemFrame <sup>extends Hanging</sup>
 
| 5
 
| [[Slot]]
 
| ''Unknown''
 
|-
 
| 6
 
| VarInt
 
| ''Unknown''
 
|-
 
| Item <sup>extends Entity</sup>
 
| 5
 
| [[Slot]]
 
| ''Unknown''
 
|-
 
|rowspan="5"| Living <sup>extends Entity</sup>
 
| 5
 
| Byte
 
| ''Unknown''
 
|-
 
| 6
 
| Float
 
| ''Unknown''
 
|-
 
| 7
 
| VarInt
 
| ''Unknown''
 
|-
 
| 8
 
| Boolean
 
| ''Unknown''
 
|-
 
| 9
 
| VarInt
 
| ''Unknown''
 
|-
 
|rowspan="7"| ArmorStand <sup>extends Living</sup>
 
| 10
 
| Byte
 
| ''Unknown''
 
 
  |-
 
  |-
  | 11
+
  ! Particle Name
  | Vector3F
+
  ! Particle ID
  | ''Unknown''
+
  ! Data
|-
 
| 12
 
| Vector3F
 
| ''Unknown''
 
 
  |-
 
  |-
 +
| <code>minecraft:dust</code>
 
  | 13
 
  | 13
  | Vector3F
+
  |
  | ''Unknown''
+
  {| class="wikitable"
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Meaning
 +
  |- {{removed}}
 +
  | Red
 +
  | {{Type|Float}}
 +
  | The red RGB value, between 0 and 1. Divide actual RGB value by 255.
 +
  |- {{removed}}
 +
  | Green
 +
  | {{Type|Float}}
 +
  | The green RGB value, between 0 and 1. Divide actual RGB value by 255.
 +
  |- {{removed}}
 +
  | Blue
 +
  | {{Type|Float}}
 +
  | The blue RGB value, between 0 and 1. Divide actual RGB value by 255.
 +
  |- {{added}}
 +
  | Color
 +
  | {{Type|Int}}
 +
  | The color, encoded as 0xRRGGBB; top bits are ignored.
 +
  |-
 +
  | Scale
 +
  | {{Type|Float}}
 +
  | The scale, will be clamped between 0.01 and 4.
 +
  |}
 
  |-
 
  |-
 +
| <code>minecraft:dust_color_transition</code>
 
  | 14
 
  | 14
  | Vector3F
+
  |
  | ''Unknown''
+
  {| class="wikitable"
|-
+
  ! Field Name
| 15
+
  ! Field Type
| Vector3F
+
  ! Meaning
| ''Unknown''
+
  |- {{removed}}
|-
+
  | From Red
| 16
+
  | {{Type|Float}}
| Vector3F
+
  | The start red RGB value, between 0 and 1. Divide actual RGB value by 255.
| ''Unknown''
+
  |- {{removed}}
|-
+
  | From Green
| Insentient <sup>extends Living</sup>
+
  | {{Type|Float}}
| 10
+
  | The start green RGB value, between 0 and 1. Divide actual RGB value by 255.
| Byte
+
  |- {{removed}}
| ''Unknown''
+
  | From Blue
|-
+
  | {{Type|Float}}
| Ambient <sup>extends Insentient</sup>
+
  | The start blue RGB value, between 0 and 1. Divide actual RGB value by 255.
|colspan="3"| ''no additional metadata''
+
  |- {{added}}
|-
+
  | From Color
| Bat <sup>extends Ambient</sup>
+
  | {{Type|Int}}
| 11
+
  | The start color, encoded as 0xRRGGBB; top bits are ignored.
| Byte
+
  |- {{removed}}
| ''Unknown''
+
  | To Red
|-
+
  | {{Type|Float}}
| Creature <sup>extends Insentient</sup>
+
  | The end red RGB value, between 0 and 1. Divide actual RGB value by 255.
|colspan="3"| ''no additional metadata''
+
  |- {{removed}}
|-
+
  | To Green
| Ageable <sup>extends Creature</sup>
+
  | {{Type|Float}}
| 11
+
  | The end green RGB value, between 0 and 1. Divide actual RGB value by 255.
| Boolean
+
  |- {{removed}}
| ''Unknown''
+
  | To Blue
|-
+
  | {{Type|Float}}
| Animal <sup>extends Ageable</sup>
+
  | The end blue RGB value, between 0 and 1. Divide actual RGB value by 255.
|colspan="3"| ''no additional metadata''
+
  |- {{added}}
|-
+
  | To Color
|rowspan="5"| Horse <sup>extends Animal</sup>
+
  | {{Type|Int}}
| 12
+
  | The end color, encoded as 0xRRGGBB; top bits are ignored.
| Byte
+
  |-
| ''Unknown''
+
  | Scale
|-
+
  | {{Type|Float}}
| 13
+
  | The scale, will be clamped between 0.01 and 4.
| VarInt
+
  |}
| ''Unknown''
 
|-
 
| 14
 
| VarInt
 
| ''Unknown''
 
|-
 
| 15
 
| OptUUID
 
| ''Unknown''
 
|-
 
| 16
 
| VarInt
 
| ''Unknown''
 
|-
 
| Pig <sup>extends Animal</sup>
 
| 12
 
| Boolean
 
| ''Unknown''
 
|-
 
| Rabbit <sup>extends Animal</sup>
 
| 12
 
| VarInt
 
| ''Unknown''
 
|-
 
| Sheep <sup>extends Animal</sup>
 
| 12
 
| Byte
 
| ''Unknown''
 
|-
 
|rowspan="2"| TameableAnimal <sup>extends Animal</sup>
 
| 12
 
| Byte
 
| ''Unknown''
 
|-
 
| 13
 
| OptUUID
 
| ''Unknown''
 
|-
 
| Ocelot <sup>extends TameableAnimal</sup>
 
| 14
 
| VarInt
 
| ''Unknown''
 
|-
 
|rowspan="3"| Wolf <sup>extends TameableAnimal</sup>
 
| 14
 
| Float
 
| ''Unknown''
 
|-
 
| 15
 
| Boolean
 
| ''Unknown''
 
|-
 
| 16
 
| VarInt
 
| ''Unknown''
 
|-
 
| Villager <sup>extends Ageable</sup>
 
| 12
 
| VarInt
 
| ''Unknown''
 
|-
 
| Golem <sup>extends Creature</sup>
 
|colspan="3"| ''no additional metadata''
 
|-
 
| IronGolem <sup>extends Golem</sup>
 
| 11
 
| Byte
 
| ''Unknown''
 
|-
 
|rowspan="3"| Shulker <sup>extends Golem</sup>
 
| 11
 
| Direction
 
| ''Unknown''
 
|-
 
| 12
 
| OptPosition
 
| ''Unknown''
 
|-
 
| 13
 
| Byte
 
| ''Unknown''
 
|-
 
| Monster <sup>extends Creature</sup>
 
|colspan="3"| ''no additional metadata''
 
|-
 
| Blaze <sup>extends Monster</sup>
 
| 11
 
| Byte
 
| ''Unknown''
 
|-
 
|rowspan="3"| Creeper <sup>extends Monster</sup>
 
| 11
 
| VarInt
 
| ''Unknown''
 
|-
 
| 12
 
| Boolean
 
| ''Unknown''
 
|-
 
| 13
 
| Boolean
 
| ''Unknown''
 
|-
 
|rowspan="2"| Guardian <sup>extends Monster</sup>
 
| 11
 
| Byte
 
| ''Unknown''
 
|-
 
| 12
 
| VarInt
 
| ''Unknown''
 
|-
 
|rowspan="2"| Skeleton <sup>extends Monster</sup>
 
| 11
 
| VarInt
 
| ''Unknown''
 
|-
 
| 12
 
| Boolean
 
| ''Unknown''
 
|-
 
| Spider <sup>extends Monster</sup>
 
| 11
 
| Byte
 
| ''Unknown''
 
|-
 
| Witch <sup>extends Monster</sup>
 
| 11
 
| Boolean
 
| ''Unknown''
 
|-
 
|rowspan="4"| Wither <sup>extends Monster</sup>
 
| 11
 
| VarInt
 
| ''Unknown''
 
|-
 
| 12
 
| VarInt
 
| ''Unknown''
 
|-
 
| 13
 
| VarInt
 
| ''Unknown''
 
|-
 
| 14
 
| VarInt
 
| ''Unknown''
 
|-
 
|rowspan="3"| Zombie <sup>extends Monster</sup>
 
| 11
 
| Boolean
 
| ''Unknown''
 
|-
 
| 12
 
| Boolean
 
| ''Unknown''
 
|-
 
| 13
 
| Boolean
 
| ''Unknown''
 
|-
 
|rowspan="2"| Enderman <sup>extends Monster</sup>
 
| 11
 
| Block ID
 
| ''Unknown''
 
|-
 
| 12
 
| Boolean
 
| ''Unknown''
 
|-
 
| EnderDragon <sup>extends Insentient</sup>
 
| 11
 
| VarInt
 
| ''Unknown''
 
|-
 
| Flying <sup>extends Insentient</sup>
 
|colspan="3"| ''no additional metadata''
 
|-
 
| Ghast <sup>extends Flying</sup>
 
| 11
 
| Boolean
 
| ''Unknown''
 
|-
 
| Slime <sup>extends Insentient</sup>
 
| 11
 
| VarInt
 
| ''Unknown''
 
|-
 
|rowspan="6"| Minecart <sup>extends Entity</sup>
 
| 5
 
| VarInt
 
| ''Unknown''
 
|-
 
| 6
 
| VarInt
 
| ''Unknown''
 
|-
 
| 7
 
| Float
 
| ''Unknown''
 
|-
 
| 8
 
| VarInt
 
| ''Unknown''
 
|-
 
| 9
 
| VarInt
 
| ''Unknown''
 
|-
 
| 10
 
| Boolean
 
| ''Unknown''
 
|-
 
|rowspan="2"| MinecartCommandBlock <sup>extends Minecart</sup>
 
| 11
 
| String
 
| ''Unknown''
 
|-
 
| 12
 
| [[Chat]]
 
| ''Unknown''
 
|-
 
| MinecartFurnace <sup>extends Minecart</sup>
 
| 11
 
| Boolean
 
| ''Unknown''
 
|-
 
| TNTPrimed <sup>extends Entity</sup>
 
| 5
 
| VarInt
 
| ''Unknown''
 
 
  |}
 
  |}
  
Entity classes also recursively use fields from classes they extend.
+
== Handshake ==
 +
 
 +
No changes so far.
 +
 
 +
== Status ==
 +
 
 +
No changes so far.
 +
 
 +
== Login ==
  
== Handshaking ==
+
No changes so far.
  
=== Clientbound ===
+
== Configuration ==
  
 
No changes so far.
 
No changes so far.
  
=== Serverbound ===
+
== Play ==
 +
 
 +
=== Clientbound ===
  
==== Handshake ====
+
==== Close Container ====
  
This causes the server to switch into the target state.
+
This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open. The notchian client disregards the provided window ID and closes any active window.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 708: Line 645:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x00
+
  | ''protocol:''<br/><code>0x12</code><br/><br/>''resource:''<br/><code>container_close</code>
  |rowspan="4"| Handshaking
+
  | Play
  |rowspan="4"| Server
+
  | Client
  | Protocol Version
+
  | Window ID
  | VarInt
+
  | {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
| See [[protocol version numbers]] (currently {{Change|47|73}})
+
  | This is the ID of the window that was closed. 0 for inventory.
|-
 
| Server Address
 
  | String
 
| hostname or IP, e.g. localhost or 127.0.0.1<!-- does this support IPv6? -->
 
|-
 
| Server Port
 
| Unsigned Short
 
| default is 25565
 
|-
 
| Next State
 
| VarInt Enum
 
| 1 for [[#Status|status]], 2 for [[#Login|login]]
 
 
  |}
 
  |}
  
== Play ==
+
==== Set Container Content ====
 
+
[[File:Inventory-slots.png|thumb|The inventory slots]]
=== Clientbound ===
 
  
==== Entity Equipment ====
+
Replaces the contents of a container window. Sent by the server upon initialization of a container window or the player's inventory, and in response to state ID mismatches (see [[#Click Container]]).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 742: Line 666:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x04
+
  | rowspan="5"| ''protocol:''<br/><code>0x13</code><br/><br/>''resource:''<br/><code>container_set_content</code>
  |rowspan="3"| Play
+
  | rowspan="5"| Play
  |rowspan="3"| Client
+
  | rowspan="5"| Client
  | Entity ID
+
  | Window ID
  | VarInt
+
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
  | Entity's EID
+
| The ID of window which items are being sent for. 0 for player inventory. The client ignores any packets targeting a Window ID other than the current one. However, an exception is made for the player inventory, which may be targeted at any time. (The Notchian server does not appear to utilize this special case.)
 +
|-
 +
| State ID
 +
  | {{Type|VarInt}}
 +
| A server-managed sequence number used to avoid desynchronization; see [[#Click Container]].
 +
|-
 +
| Count
 +
| {{Type|VarInt}}
 +
  | Number of elements in the following array.
 
  |-
 
  |-
  | Slot
+
  | Slot Data
  | {{Change|Short|VarInt}} Enum
+
  | {{Type|Array}} of [[Slot Data|Slot]]
| Equipment slot. 0: main hand, {{Change||1: off hand}}, {{Change|1–4|2–5}}: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
 
 
  |-
 
  |-
  | Item
+
  | Carried Item
  | [[Slot Data|Slot]]
+
  | {{Type|Slot}}
  |  
+
  | Item being dragged with the mouse.
 
  |}
 
  |}
  
==== Spawn Player ====
+
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 
+
Use [[#Open Screen|Open Screen]] to open the container on the client.
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
 
 
 
This packet must be sent after the [[Protocol#Player List Item|Player List Item]] ([[#Play|Play]], 0x38, clientbound) packet that adds the player data for the client to use when spawning a player. If the Player List Item for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player List Item packet includes skin/cape data.
 
 
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
 
 
When in online-mode the UUIDs must be valid and have valid skin blobs, in offline-mode UUID v3 is used.
 
  
For NPCs UUID v2 should be used. Note:
+
==== Set Container Property ====
  
<+Grum> i will never confirm this as a feature you know that :)
+
This packet is used to inform the client that part of a GUI window should be updated.
 
 
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 782: Line 704:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| {{Change|0x0C|0x05}}
+
  | rowspan="3"| ''protocol:''<br/><code>0x14</code><br/><br/>''resource:''<br/><code>container_set_data</code>
  |rowspan="9"| Play
+
  | rowspan="3"| Play
  |rowspan="9"| Client
+
  | rowspan="3"| Client
  | Entity ID
+
  | Window ID
  | VarInt
+
  | {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
  | Player's EID
+
  |
 
  |-
 
  |-
  | Player UUID
+
  | Property
  | UUID
+
  | {{Type|Short}}
  |  
+
  | The property to be updated, see below.
 
  |-
 
  |-
  | X
+
  | Value
  | Int
+
  | {{Type|Short}}
  | Player X as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
| The new value for the property, see below.
 +
  |}
 +
 
 +
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  | Y
+
  ! Window type
  | Int
+
  ! Property
  | Player Y as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  ! Value
 
  |-
 
  |-
  | Z
+
  | rowspan="4"| Furnace
  | Int
+
  | 0: Fire icon (fuel left)
  | Player Z as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | counting from fuel burn time down to 0 (in-game ticks)
 
  |-
 
  |-
  | Yaw
+
  | 1: Maximum fuel burn time
| Angle
+
  | fuel burn time or 0 (in-game ticks)
  |  
 
 
  |-
 
  |-
  | Pitch
+
  | 2: Progress arrow
| Angle
+
  | counting from 0 to maximum progress (in-game ticks)
|
 
|- style="background-color: #f4cccc; text-decoration: line-through;"
 
  | Current Item
 
| Short
 
| The item the player is currently holding. Note that this should be 0 for “no item”, unlike -1 used in other packets.
 
 
  |-
 
  |-
  | Metadata
+
  | 3: Maximum progress
  | [[#Entity Metadata|Entity Metadata]]
+
  | always 200 on the notchian server
|
 
|}
 
 
 
==== Spawn Object ====
 
 
 
Sent by the server when an object/vehicle is created.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="13"| {{Change|0x0E|0x00}}
+
  | rowspan="10"| Enchantment Table
  |rowspan="13"| Play
+
  | 0: Level requirement for top enchantment slot
  |rowspan="13"| Client
+
  | rowspan="3"| The enchantment's xp level requirement
| Entity ID
 
| VarInt
 
| EID of the object
 
|- style="background-color: #d9ead3;"
 
| Object UUID
 
| UUID
 
|
 
 
  |-
 
  |-
  | Type
+
  | 1: Level requirement for middle enchantment slot
| Byte
 
| The type of object (See [[Entities#Objects]])
 
 
  |-
 
  |-
  | X
+
  | 2: Level requirement for bottom enchantment slot
| Int
 
| X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Y
+
  | 3: The enchantment seed
  | Int
+
  | Used for drawing the enchantment names (in [[Wikipedia:Standard Galactic Alphabet|SGA]]) clientside.  The same seed ''is'' used to calculate enchantments, but some of the data isn't sent to the client to prevent easily guessing the entire list (the seed value here is the regular seed bitwise and <code>0xFFFFFFF0</code>).
| Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Z
+
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
  | Int
+
  | rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
| Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Pitch
+
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
| Angle
 
|
 
 
  |-
 
  |-
  | Yaw
+
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
| Angle
 
|
 
|- style="background-color: #f4cccc; text-decoration: line-through;"
 
| Data
 
| [[Object Data]]
 
|
 
|-  style="background-color: #d9ead3;"
 
| Info
 
| Int
 
| Depends on Type; see [[Object Data#Meaning of int field]]
 
|-  style="background-color: #d9ead3;"
 
| Velocity X
 
| Short
 
|
 
|-  style="background-color: #d9ead3;"
 
| Velocity Y
 
| Short
 
|
 
|-  style="background-color: #d9ead3;"
 
| Velocity Z
 
| Short
 
 
|}
 
 
 
==== Spawn Mob ====
 
 
 
Sent by the server when a mob entity is spawned.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="13"| {{Change|0x0F|0x03}}
+
  | 7: Enchantment level shown on mouse hover over the top slot
  |rowspan="13"| Play
+
  | rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
|rowspan="13"| Client
 
| Entity ID
 
| VarInt
 
|
 
|- style="background-color: #d9ead3;"
 
| Entity UUID
 
| UUID
 
|
 
 
  |-
 
  |-
  | Type
+
  | 8: Enchantment level shown on mouse hover over the middle slot
| Unsigned Byte
 
| The type of mob. See [[Entities#Mobs]]
 
 
  |-
 
  |-
  | X
+
  | 9: Enchantment level shown on mouse hover over the bottom slot
| Int
 
| X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Y
+
  | rowspan="3"| Beacon
  | Int
+
  | 0: Power level
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | 0-4, controls what effect buttons are enabled
 
  |-
 
  |-
  | Z
+
  | 1: First potion effect
  | Int
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
| Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Yaw
+
  | 2: Second potion effect
  | Angle
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
|  
 
 
  |-
 
  |-
  | Pitch
+
  | Anvil
  | Angle
+
  | 0: Repair cost
  |  
+
  | The repair's cost in xp levels
 
  |-
 
  |-
  | Head Pitch
+
  | rowspan="2"| Brewing Stand
  | Angle
+
  | 0: Brew time
  |  
+
  | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
  |-
 
  |-
  | Velocity X
+
  | 1: Fuel time
  | Short
+
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
| Same units as [[Protocol#Entity Velocity|Entity Velocity]]
 
 
  |-
 
  |-
  | Velocity Y
+
  | Stonecutter
  | Short
+
  | 0: Selected recipe
  | Same units as [[Protocol#Entity Velocity|Entity Velocity]]
+
  | The index of the selected recipe. -1 means none is selected.
 
  |-
 
  |-
  | Velocity Z
+
  | Loom
  | Short
+
  | 0: Selected pattern
  | Same units as [[Protocol#Entity Velocity|Entity Velocity]]
+
  | The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern.
 
  |-
 
  |-
  | Metadata
+
  | Lectern
  | [[#Entity Metadata|Entity Metadata]]
+
  | 0: Page number
  |  
+
  | The current page number, starting from 0.
 
  |}
 
  |}
  
==== Entity Status ====
+
For an enchanting table, the following numerical IDs are used:
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x1A
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Entity ID
 
| Int
 
|
 
|-
 
| Entity Status
 
| Byte Enum
 
| See below
 
|}
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Numerical ID
 +
! Enchantment ID
 +
! Enchantment Name
 
  |-
 
  |-
  ! Entity Status
+
  | 0
  ! Meaning
+
  | minecraft:protection
 +
| Protection
 
  |-
 
  |-
 
  | 1
 
  | 1
  | Sent when resetting a mob spawn minecart's timer — appears to be unused by the client
+
  | minecraft:fire_protection
 +
| Fire Protection
 
  |-
 
  |-
 
  | 2
 
  | 2
  | Living Entity hurt
+
  | minecraft:feather_falling
 +
| Feather Falling
 
  |-
 
  |-
 
  | 3
 
  | 3
  | Living Entity dead
+
  | minecraft:blast_protection
 +
| Blast Protection
 
  |-
 
  |-
 
  | 4
 
  | 4
  | Iron Golem throwing up arms
+
  | minecraft:projectile_protection
 +
| Projectile Protection
 +
|-
 +
| 5
 +
| minecraft:respiration
 +
| Respiration
 
  |-
 
  |-
 
  | 6
 
  | 6
  | Wolf/Ocelot/Horse taming — Spawn “heart” particles
+
  | minecraft:aqua_affinity
 +
| Aqua Affinity
 
  |-
 
  |-
 
  | 7
 
  | 7
  | Wolf/Ocelot/Horse tamed — Spawn “smoke” particles
+
  | minecraft:thorns
 +
| Thorns
 
  |-
 
  |-
 
  | 8
 
  | 8
  | Wolf shaking water — Trigger the shaking animation
+
  | minecraft:depth_strider
 +
| Depth Strider
 
  |-
 
  |-
 
  | 9
 
  | 9
  | (of self) Eating accepted by server
+
  | minecraft:frost_walker
  |-
+
  | Frost Walker
| 10
 
| Sheep eating grass
 
 
  |-
 
  |-
 
  | 10
 
  | 10
  | Play TNT ignite sound
+
  | minecraft:binding_curse
 +
| Curse of Binding
 
  |-
 
  |-
 
  | 11
 
  | 11
  | Iron Golem handing over a rose
+
  | minecraft:soul_speed
 +
| Soul Speed
 
  |-
 
  |-
 
  | 12
 
  | 12
  | Villager mating — Spawn “heart” particles
+
  | minecraft:swift_sneak
 +
| Swift Sneak
 
  |-
 
  |-
 
  | 13
 
  | 13
  | Spawn particles indicating that a villager is angry and seeking revenge
+
  | minecraft:sharpness
 +
| Sharpness
 
  |-
 
  |-
 
  | 14
 
  | 14
  | Spawn happy particles near a villager
+
  | minecraft:smite
 +
| Smite
 
  |-
 
  |-
 
  | 15
 
  | 15
  | Witch animation — Spawn “magic” particles
+
  | minecraft:bane_of_arthropods
 +
| Bane of Arthropods
 
  |-
 
  |-
 
  | 16
 
  | 16
  | Play zombie converting into a villager sound
+
  | minecraft:knockback
 +
| Knockback
 
  |-
 
  |-
 
  | 17
 
  | 17
  | Firework exploding
+
  | minecraft:fire_aspect
 +
| Fire Aspect
 
  |-
 
  |-
 
  | 18
 
  | 18
  | Animal in love (ready to mate) — Spawn “heart” particles
+
  | minecraft:looting
 +
| Looting
 
  |-
 
  |-
 
  | 19
 
  | 19
  | Reset squid rotation
+
  | minecraft:sweeping_edge
 +
| Sweeping Edge
 
  |-
 
  |-
 
  | 20
 
  | 20
  | Spawn explosion particle — works for some living entities
+
  | minecraft:efficiency
 +
| Efficiency
 
  |-
 
  |-
 
  | 21
 
  | 21
  | Play guardian sound — works for every entity
+
  | minecraft:silk_touch
 +
| Silk Touch
 
  |-
 
  |-
 
  | 22
 
  | 22
  | Enables reduced {{Minecraft Wiki|Debug screen|debug}} for players
+
  | minecraft:unbreaking
 +
| Unbreaking
 
  |-
 
  |-
 
  | 23
 
  | 23
  | Disables reduced {{Minecraft Wiki|Debug screen|debug}} for players
+
  | minecraft:fortune
|- style="background-color: #d9ead3;"
+
  | Fortune
| 24–28
 
| Sets {{Minecraft Wiki|Server.properties#op-permission-level|op permission level}} 0–4 for players
 
|}
 
 
 
==== Entity Properties ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
  !colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x20
+
  | 24
|rowspan="6"| Play
+
  | minecraft:power
|rowspan="6"| Client
+
  | Power
  |colspan="2"| Entity ID
 
|colspan="2"| VarInt
 
  |  
 
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | 25
  |colspan="2"| Int
+
  | minecraft:punch
  | Number of elements in the following array
+
  | Punch
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | 26
| Key
+
  | minecraft:flame
|rowspan="4"| Array
+
  | Flame
  | String
 
  | See below
 
 
  |-
 
  |-
  | Value
+
  | 27
  | Double
+
  | minecraft:infinity
  | See below
+
  | Infinity
 
  |-
 
  |-
  | Number Of Modifiers
+
  | 28
  | VarInt
+
  | minecraft:luck_of_the_sea
  | Number of elements in the following array
+
  | Luck of the Sea
 
  |-
 
  |-
  | Modifiers
+
  | 29
  | Array of Modifier Data
+
  | minecraft:lure
| Modifier Data defined below
+
  | Lure
  |}
 
 
 
Known Key values (see also {{Minecraft Wiki|Attribute#Modifiers}}):
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Key
+
  | 30
  ! Default
+
  | minecraft:loyalty
  ! Min
+
  | Loyalty
! Max
 
! Label
 
 
  |-
 
  |-
  | generic.maxHealth
+
  | 31
  | 20.0
+
  | minecraft:impaling
  | 0.0
+
  | Impaling
| {{Change|Double.MaxValue|1024.0}}
 
| Max Health
 
 
  |-
 
  |-
| generic.followRange
+
  | 32
  | 32.0
+
  | minecraft:riptide
| 0.0
+
  | Riptide
  | 2048.0
 
  | Follow Range
 
 
  |-
 
  |-
  | generic.knockbackResistance
+
  | 33
  | 0.0
+
  | minecraft:channeling
  | 0.0
+
  | Channeling
| 1.0
 
| Knockback Resistance
 
 
  |-
 
  |-
  | generic.movementSpeed
+
  | 34
  | 0.699999988079071
+
  | minecraft:multishot
  | 0.0
+
  | Multishot
| {{Change|Double.MaxValue|1024.0}}
 
| Movement Speed
 
 
  |-
 
  |-
  | generic.attackDamage
+
  | 35
  | 2.0
+
  | minecraft:quick_charge
| 0.0
+
  | Quick Charge
| {{Change|Double.MaxValue|2048.0}}
 
| {{Change||Attack Damage}}
 
|- style="background-color: #d9ead3;"
 
| generic.attackSpeed
 
| 4.0
 
| 0.0
 
| 1024.0
 
  | Attack Speed
 
 
  |-
 
  |-
  | horse.jumpStrength
+
  | 36
  | 0.7
+
  | minecraft:piercing
  | 0.0
+
  | Piercing
| 2.0
 
| Jump Strength
 
 
  |-
 
  |-
  | zombie.spawnReinforcements
+
  | 37
  | 0.0
+
  | minecraft:density
| 0.0
+
  | Density
| 1.0
 
| Spawn Reinforcements Chance
 
  |}
 
 
 
''Modifier Data'' structure:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Field Name
+
  | 38
  ! Field Type
+
  | minecraft:breach
  ! Notes
+
  | Breach
 
  |-
 
  |-
  | UUID
+
  | 39
  | UUID
+
  | minecraft:wind_burst
  |  
+
  | Wind Burst
 
  |-
 
  |-
  | Amount
+
  | 40
  | Double
+
  | minecraft:mending
  |  
+
  | Mending
 
  |-
 
  |-
  | Operation
+
  | 41
  | Byte
+
  | minecraft:vanishing_curse
  |  
+
  | Curse of Vanishing
 
  |}
 
  |}
  
==== Chunk Data ====
+
==== Set Container Slot ====
  
Chunk pillars are not unloaded by the client automatically. To unload chunk pillars, {{Change|send this packet with Ground-Up Continuous{{=}}true and no 16^3 chunks (eg. Primary Bit Mask{{=}}0)|send an [[#Unload Chunk|Unload Chunk]] packet with the chunk's X and Z coordinates}}. The server only sends skylight information for chunk pillars in the Overworld, it's up to the client to know in which dimenison the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent.
+
Sent by the server when an item in a slot (in a window) is added/removed.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,190: Line 988:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| {{Change|0x21|0x20}}
+
  | rowspan="4"| ''protocol:''<br/><code>0x15</code><br/><br/>''resource:''<br/><code>container_set_slot</code>
  |rowspan="7"| Play
+
  | rowspan="4"| Play
  |rowspan="7"| Client
+
  | rowspan="4"| Client
  | Chunk X
+
  | Window ID
  | Int
+
  | {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
  | Chunk X coordinate
+
  | The window which is being updated. 0 for player inventory. The client ignores any packets targeting a Window ID other than the current one{{change|; see below for exceptions|, unless it is 0 (see below)}}.
 
  |-
 
  |-
  | Chunk Z
+
  | State ID
  | Int
+
  | {{Type|VarInt}}
  | Chunk Z coordinate
+
  | A server-managed sequence number used to avoid desynchronization; see [[#Click Container]].
 
  |-
 
  |-
  | Ground-Up Continuous
+
  | Slot
  | Boolean
+
  | {{Type|Short}}
  | This is true if the packet represents all chunk sections in this vertical chunk column, where the Primary Bit Mask specifies exactly which chunk sections are included, and which are air.
+
  | The slot that should be updated.
 
  |-
 
  |-
  | Primary Bit Mask
+
  | Slot Data
  | {{Change|Unsigned Short|VarInt}}
+
  | {{Type|Slot}}
  | Bitmask with bits set to 1 for every 16×16×16 chunk section whose data follows in the compressed data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
+
  |
|-
 
| Size
 
| VarInt
 
| Size of Data in bytes
 
|-
 
| Data
 
| Array of [[#Chunk Section|Chunk Section]]
 
| The length of the array is equal to the number of bits set in Primary Bit Mask.
 
|-
 
| Biomes
 
| Optional Byte Array
 
| Only if Ground-Up Continuous: biome array, byte per XZ coordinate, 256 bytes total.
 
 
  |}
 
  |}
  
==== {{Change||Unload Chunk}} ====
+
If Window ID is 0, the hotbar and offhand slots (slots 36 through 45) may be updated even when a different container window is open. (The Notchian server does not appear to utilize this special case.) Updates are also restricted to those slots when the player is looking at a creative inventory tab other than the survival inventory. (The Notchian server does ''not'' handle this restriction in any way, leading to [https://bugs.mojang.com/browse/MC-242392 MC-242392].)
 +
 
 +
{{change|If Window ID is -1, the item being dragged with the mouse is set. In this case, State ID and Slot are ignored.|}}
 +
 
 +
{{change|If Window ID is -2, any slot in the player's inventory can be updated irrespective of the current container window. In this case, State ID is ignored, and the Notchian server uses a bogus value of 0. Used by the Notchian server to implement the [[#Pick Item]] functionality.|}}
 +
 
 +
When a container window is open, the server never sends updates targeting Window ID 0&mdash;all of the [[Inventory|window types]] include slots for the player inventory. The client must automatically apply changes targeting the inventory portion of a container window to the main inventory; the server does not resend them for ID 0 when the window is closed. However, since the armor and offhand slots are only present on ID 0, updates to those slots occurring while a window is open must be deferred by the server until the window's closure.
 +
 
 +
==== Set Cooldown ====
  
Tells the client to unload a chunk.
+
Applies a cooldown period to all items with the given type.  Used by the Notchian server with enderpearls.  This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,233: Line 1,027:
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 +
|-
 +
| rowspan="2"| ''protocol:''<br/><code>0x17</code><br/><br/>''resource:''<br/><code>cooldown</code>
 +
| rowspan="2"| Play
 +
| rowspan="2"| Client
 +
| {{change|Item ID|Cooldown Group}}
 +
| {{change|{{Type|VarInt}}|{{Type|Identifier}}}}
 +
| {{change|Numeric ID of the item|Group of items}} to apply a cooldown to.
 
  |-
 
  |-
  |rowspan="2"| {{Change|0x22|0x1C}}
+
  | Cooldown Ticks
  |rowspan="2"| Play
+
| {{Type|VarInt}}
|rowspan="2"| Client
+
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
| Chunk X
 
| Int
 
| Chunk X coordinate
 
|-
 
| Chunk Z
 
| Int
 
| Chunk Z coordinate
 
 
  |}
 
  |}
  
==== Multi Block Change ====
+
==== Teleport Entity ====
 +
 
 +
{{Warning2|{{change||The Mojang-specified name of this packet was changed in 1.21.2 from <code>teleport_entity</code> to <code>entity_position_sync</code>. There is a new <code>teleport_entity</code>, which this document more appropriately calls [[#Synchronize Vehicle Position|Synchronize Vehicle Position]]. That packet has a different function and will lead to confusing results if used in place of this one.}}}}
  
Fired whenever 2 or more blocks are changed within the render distance.
+
This packet is sent by the server when an entity moves more than 8 blocks.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,254: Line 1,050:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| {{Change|0x22|0x23}}
+
  | rowspan="10"| ''protocol:''<br/><code>{{change|0x70|0x20}}</code><br/><br/>''resource:''<br/><code>{{change|teleport_entity|entity_position_sync}}</code>
  |rowspan="6"| Play
+
  | rowspan="10"| Play
  |rowspan="6"| Client
+
  | rowspan="10"| Client
  |colspan="2"| Chunk X
+
  | Entity ID
  |colspan="2"| Int
+
| {{Type|VarInt}}
  | Chunk X coordinate
+
|
 +
|-
 +
| X
 +
  | {{Type|Double}}
 +
  |  
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  | Y
  |colspan="2"| Int
+
  | {{Type|Double}}
  | Chunk Z coordinate
+
  |
 
  |-
 
  |-
  |colspan="2"| Record Count
+
  | Z
  |colspan="2"| VarInt
+
| {{Type|Double}}
  | Number of elements in the following array, i.e. the number of blocks affected
+
|
 +
|- {{added}}
 +
| Velocity X
 +
| {{Type|Double}}
 +
|
 +
|- {{added}}
 +
| Velocity Y
 +
| {{Type|Double}}
 +
|
 +
|- {{added}}
 +
| Velocity Z
 +
  | {{Type|Double}}
 +
  |
 
  |-
 
  |-
  |rowspan="3"| Record
+
  | Yaw
  | Horizontal Position
+
  | {{change|{{Type|Angle}}|{{Type|Float}}}}
|rowspan="3"| Array
+
  | Rotation on the X axis, in degrees.
| Unsigned Byte
 
  | The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
 
 
  |-
 
  |-
  | Y Coordinate
+
  | Pitch
  | Unsigned Byte
+
  | {{change|{{Type|Angle}}|{{Type|Float}}}}
  |  
+
  | Rotation on the Y axis, in degrees.
 
  |-
 
  |-
  | Block ID
+
  | On Ground
  | VarInt
+
  | {{Type|Boolean}}
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (<code>type = x >> 4</code>, <code>meta = x & 15</code>)
+
  |
  |}
+
|}
 +
 
 +
==== Explosion ====
  
==== Block Change ====
+
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
  
Fired whenever a block is changed within the render distance.
+
{{change|Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x|}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,296: Line 1,108:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  ! colspan="2" | Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| {{Change|0x23|0x24}}
+
  | rowspan="16"| ''protocol:''<br/><code>{{change|0x20|0x21}}</code><br/><br/>''resource:''<br/><code>explode</code>
  |rowspan="2"| Play
+
  | rowspan="16"| Play
  |rowspan="2"| Client
+
  | rowspan="16"| Client
  | Location
+
  | X
  | Position
+
| {{Type|Double}}
  | Block Coordinates
+
|
 +
|-
 +
| Y
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Z
 +
| {{Type|Double}}
 +
|
 +
|- {{removed}}
 +
| Strength
 +
| {{Type|Float}}
 +
| If the strength is greater or equal to 2.0, or the block interaction is not 0 (keep), large explosion particles are used. Otherwise, small explosion particles are used.
 +
|- {{removed}}
 +
| Record Count
 +
| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|- {{removed}}
 +
| Records
 +
| {{Type|Array}} of ({{Type|Byte}}, {{Type|Byte}}, {{Type|Byte}})
 +
| Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
 +
|- {{added}}
 +
| Has Player Motion
 +
| {{Type|Boolean}}
 +
|
 +
|-
 +
| Player Motion X
 +
| {{change|{{Type|Float}}|{{Type|Optional}} {{Type|Double}}}}
 +
| X velocity of the player being pushed by the explosion.{{change|| Only present if Has Player Motion is true.}}
 +
|-
 +
| Player Motion Y
 +
| {{change|{{Type|Float}}|{{Type|Optional}} {{Type|Double}}}}
 +
| Y velocity of the player being pushed by the explosion.{{change|| Only present if Has Player Motion is true.}}
 +
|-
 +
| Player Motion Z
 +
| {{change|{{Type|Float}}|{{Type|Optional}} {{Type|Double}}}}
 +
| Z velocity of the player being pushed by the explosion.{{change|| Only present if Has Player Motion is true.}}
 +
  |- {{removed}}
 +
  | Block Interaction
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| 0 = keep, 1 = destroy, 2 = destroy_with_decay, 3 = trigger_block.
 +
|-
 +
| {{change|Small |}}Explosion Particle ID
 +
| {{Type|VarInt}}
 +
| The particle ID listed in [[Particles]].
 +
|-
 +
| {{change|Small |}}Explosion Particle Data
 +
| Varies
 +
| Particle data as specified in [[Particles]].
 +
|- {{removed}}
 +
| Large Explosion Particle ID
 +
| {{Type|VarInt}}
 +
| The particle ID listed in [[Particles]].
 +
|- {{removed}}
 +
| Large Explosion Particle Data
 +
| Varies
 +
| Particle data as specified in [[Particles]].
 
  |-
 
  |-
  | Block ID
+
  | Explosion Sound
  | VarInt
+
  | {{Type|ID or}} {{Type|Sound Event}}
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (<code>type = x >> 4</code>, <code>meta = x & 15</code>)
+
| ID in the <code>minecraft:sound_event</code> registry, or an inline definition.
 
  |}
 
  |}
  
==== Block Action ====
+
==== Open Horse Screen ====
  
This packet is used for a number of things:
+
This packet is used exclusively for opening the horse GUI. [[#Open Screen|Open Screen]] is used for all other GUIs.  The client will not open the inventory if the Entity ID does not point to an horse-like animal.
 
 
* Chests opening and closing
 
* Pistons pushing and pulling
 
* Note blocks playing
 
* Updating beacons
 
 
 
See also: [[Block Actions]]  
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,331: Line 1,192:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| {{Change|0x24|0x25}}
+
  | rowspan="3"| ''protocol:''<br/><code>0x23</code><br/><br/>''resource:''<br/><code>horse_screen_open</code>
  |rowspan="4"| Play
+
  | rowspan="3"| Play
  |rowspan="4"| Client
+
  | rowspan="3"| Client
  | Location
+
  | Window ID
  | Position
+
  | {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
  | Block coordinates
+
  |
 
  |-
 
  |-
  | Byte 1
+
  | Slot count
  | Unsigned Byte
+
  | {{Type|VarInt}}
  | Varies depending on block — see [[Block Actions]]
+
  |
 
  |-
 
  |-
  | Byte 2
+
  | Entity ID
  | Unsigned Byte
+
  | {{Type|Int}}
| Varies depending on block — see [[Block Actions]]
+
  |
|-
 
| Block Type
 
| VarInt
 
  |  
 
 
  |}
 
  |}
  
==== Block Break Animation ====
+
==== Login (play) ====
 
 
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 
 
 
You can also set an animation to air! The animation will still be visible.
 
  
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
+
{{Need Info|Although the number of portal cooldown ticks is included in this packet, the whole portal usage process is still dictated entirely by the server. What kind of effect does this value have on the client, if any?}}
  
Also if you set the coordinates to a special block like water etc. it won't show the actual break animation but some other interesting effects. For example, water will lose its transparency.
+
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,369: Line 1,222:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| {{Change|0x25|0x26}}
+
  | rowspan="23"| ''protocol:''<br/><code>{{change|0x2B|0x2C}}</code><br/><br/>''resource:''<br/><code>login</code>
  |rowspan="3"| Play
+
  | rowspan="23"| Play
  |rowspan="3"| Client
+
  | rowspan="23"| Client
 
  | Entity ID
 
  | Entity ID
  | VarInt
+
  | {{Type|Int}}
  | EID for the animation
+
  | The player's Entity ID (EID).
 
  |-
 
  |-
  | Location
+
  | Is hardcore
  | Position
+
  | {{Type|Boolean}}
  | Block Position
+
  |
 
  |-
 
  |-
  | Destroy Stage
+
  | Dimension Count
  | Byte
+
  | {{Type|VarInt}}
| 0–9 to set it, any other value to remove it
+
| Size of the following array.
|}
 
 
 
==== {{Change|Map Chunk Bulk|}} ====
 
 
 
Replaced by multiple [[#Chunk Data|Chunk Data]] packets.
 
 
 
==== Map ====
 
 
 
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
!colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="13"| {{Change|0x34|0x25}}
+
  | Dimension Names
  |rowspan="13"| Play
+
| {{Type|Array}} of {{Type|Identifier}}
|rowspan="13"| Client
+
  | Identifiers for all dimensions on the server.
|colspan="2"| Item Damage
 
|colspan="2"| VarInt
 
| The damage value (map ID) of the map being modified
 
 
  |-
 
  |-
  |colspan="2"| Scale
+
  | Max Players
  |colspan="2"| Byte
+
  | {{Type|VarInt}}
  | From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
+
  | Was once used by the client to draw the player list, but now is ignored.
|- style="background-color: #d9ead3;"
 
|colspan="2" | Tracking Position
 
|colspan="2" | Boolean
 
| Specifies whether the icons are shown
 
|-
 
|colspan="2"| Icon Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  | View Distance
  | Direction And Type
+
  | {{Type|VarInt}}
|rowspan="3"| Array
+
  | Render distance (2-32).
| Byte
 
  | 0xF0 = Direction, 0x0F = Type
 
 
  |-
 
  |-
  | X
+
  | Simulation Distance
  | Byte
+
  | {{Type|VarInt}}
  |  
+
  | The distance that the client will process specific things, such as entities.
 
  |-
 
  |-
  | Z
+
  | Reduced Debug Info
  | Byte
+
  | {{Type|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.
|-
 
  |colspan="2"| Columns
 
  |colspan="2"| Byte
 
| Number of columns updated
 
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | Enable respawn screen
  |colspan="2"| Optional Byte
+
  | {{Type|Boolean}}
  | Only if Columns is more than 0; number of rows updated
+
  | Set to false when the doImmediateRespawn gamerule is true.
 
  |-
 
  |-
  |colspan="2"| X
+
  | Do limited crafting
  |colspan="2"| Optional Byte
+
  | {{Type|Boolean}}
  | Only if Columns is more than 0; x offset of the westernmost column
+
  | Whether players can only craft recipes they have already unlocked. Currently unused by the client.
 
  |-
 
  |-
  |colspan="2"| Z
+
  | Dimension Type
  |colspan="2"| Optional Byte
+
  | {{Type|VarInt}}
  | Only if Columns is more than 0; z offset of the northernmost row
+
  | The ID of the type of dimension in the <code>minecraft:dimension_type</code> registry, defined by the Registry Data packet.
 
  |-
 
  |-
  |colspan="2"| Length
+
  | Dimension Name
  |colspan="2"| Optional VarInt
+
  | {{Type|Identifier}}
  | Only if Columns is more than 0; length of the following array
+
  | Name of the dimension being spawned into.
 
  |-
 
  |-
  |colspan="2"| Data
+
  | Hashed seed
|colspan="2"| Optional Array of Byte Enum
+
  | {{Type|Long}}
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
+
  | First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
  |}
 
 
 
==== Teams ====
 
 
 
Creates and updates teams.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="11"| 0x3E
+
  | Game mode
|rowspan="11"| Play
+
  | {{Type|Unsigned Byte}}
  |rowspan="11"| Client
+
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
| Team Name
 
| String
 
  | A unique name for the team. (Shared with scoreboard).
 
 
  |-
 
  |-
  | Mode
+
  | Previous Game mode
  | Byte Enum
+
  | {{Type|Byte}}
  | 0: create team, 1: remove team, 2: update team info; 3: add players to team; 4: remove players from team
+
  | -1: Undefined (null), 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. The previous game mode. Vanilla client uses this for the debug (F3 + N & F3 + F4) game mode switch. (More information needed)
 
  |-
 
  |-
  | Team Display Name
+
  | Is Debug
  | Optional String
+
  | {{Type|Boolean}}
  | Only if Mode is 0 or 2.
+
  | True if the world is a {{Minecraft Wiki|debug mode}} world; debug mode worlds cannot be modified and have predefined blocks.
 
  |-
 
  |-
  | Team Prefix
+
  | Is Flat
  | Optional String
+
  | {{Type|Boolean}}
  | Only if Mode is 0 or 2. Displayed before the players' name that are part of this team.
+
  | 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.
 
  |-
 
  |-
  | Team Suffix
+
  | Has death location
  | Optional String
+
  | {{Type|Boolean}}
  | Only if Mode is 0 or 2. Displayed after the players' name that are part of this team.
+
  | If true, then the next two fields are present.
 
  |-
 
  |-
  | Friendly Fire
+
  | Death dimension name
  | Optional Byte
+
  | {{Type|Optional}} {{Type|Identifier}}
  | Only if Mode is 0 or 2. 0 for off, 1 for on, 3 for seeing friendly invisibles.
+
  | Name of the dimension the player died in.
 
  |-
 
  |-
  | Name Tag Visibility
+
  | Death location
  | Optional String
+
  | {{Type|Optional}} {{Type|Position}}
| Only if Mode is 0 or 2. <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>.
+
  | The location that the player died at.
|- style="background-color: #d9ead3;"
 
| Collision Rule
 
| Optional String
 
  | Only if Mode is 0 or 2. <code>always</code>, <code>hideForOtherTeams</code> ''(sic)'', <code>hideForOwnTeam</code> ''(sic)'', <code>never</code>
 
 
  |-
 
  |-
  | Color
+
  | Portal cooldown
  | Optional Byte
+
  | {{Type|VarInt}}
  | Only if Mode is 0 or 2. Same as [[Chat]] colors.
+
  | The number of ticks until the player can use the portal again.
 +
|- {{added}}
 +
| Sea level
 +
| {{Type|VarInt}}
 +
|
 
  |-
 
  |-
  | Player Count
+
  | Enforces Secure Chat
  | Optional VarInt
+
  | {{Type|Boolean}}
| Only if Mode is 0 or 3 or 4. Number of players in the array.
+
  |
|-
 
| Players
 
| Optional Array of String
 
  | Only if Mode is 0 or 3 or 4. Players to be added/remove from the team. Max 40 characters so may be uuid's later.
 
 
  |}
 
  |}
  
==== Combat Event ====
+
==== Move Minecart Along Track ====
  
{| class="wikitable"
+
{| class="wikitable" {{added}}
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! colspan="2"| Field Name
  ! Field Type
+
  ! colspan="2"| Field Type
  ! Notes
+
  ! colspan="2"| Notes
 
  |-
 
  |-
  |rowspan="8"| {{Change|0x42|0x2C}}
+
  | rowspan="11"| ''protocol:''<br/><code>0x31</code><br/><br/>''resource:''<br/><code>move_minecart_along_track</code>
  |rowspan="8"| Play
+
  | rowspan="11"| Play
  |rowspan="8"| Client
+
  | rowspan="11"| Client
  |colspan="2"| Event
+
  | colspan="2"| Entity ID
  | VarInt Enum
+
  | colspan="2"| {{Type|VarInt}}
  | Determines the layout of the remaining packet
+
  |
 
  |-
 
  |-
  ! Event
+
  | colspan="2"| Step Count
  ! Field Name
+
  | colspan="2"| {{Type|VarInt}}
  !
+
  | Number of elements in the following array.
!
 
 
  |-
 
  |-
  | 0: enter combat
+
  | rowspan="9"| Steps
  | ''no fields''
+
  | X
  | ''no fields''
+
  | rowspan="9"| {{Type|Array}}
 +
| {{Type|Double}}
 
  |  
 
  |  
 
  |-
 
  |-
  |rowspan="2"| 1: end combat
+
  | Y
  | Duration
+
  | {{Type|Double}}
| VarInt
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Entity ID
+
  | Z
  | Int
+
  | {{Type|Double}}
 
  |  
 
  |  
 
  |-
 
  |-
  |rowspan="3"| 2: entity dead
+
  | Velocity X
  | Player ID
+
| {{Type|Double}}
  | VarInt
+
|
  |  
+
|-
 +
| Velocity Y
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Velocity Z
 +
| {{Type|Double}}
 +
  |
 +
  |-
 +
| Yaw
 +
| {{Type|Angle}}
 +
  |
 
  |-
 
  |-
  | Entity ID
+
  | Pitch
  | Int
+
  | {{Type|Angle}}
  |  
+
  |
 
  |-
 
  |-
  | Message
+
  | Weight
  | {{Change|String|[[Chat]]}}
+
  | {{Type|Float}}
|
+
|}
|}
 
 
 
==== {{Change|Update Entity NBT|}} ====
 
 
 
Was only used to update boss bars, replaced by [[#Boss Bar|Boss Bar]] accordingly.
 
 
 
==== {{Change||Boss Bar}} ====
 
  
This packet replaces Update Entity NBT packet which has been removed.
+
==== Player Info Update ====
  
 +
Sent by the server to update the user list (<tab> in the client).
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! colspan="2"| Field Name
  ! Field Type
+
  ! colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="15"| {{Change|0x49|0x0C}}
+
  | rowspan="4"| ''protocol:''<br/><code>{{change|0x3E|0x40}}</code><br/><br/>''resource:''<br/><code>player_info_update</code>
  |rowspan="15"| Play
+
  | rowspan="4"| Play
  |rowspan="15"| Client
+
  | rowspan="4"| Client
  |colspan="2"| UUID
+
  | colspan="2"| Actions
 +
| colspan="2"| {{Type|Byte}}
 +
| Determines what actions are present.
 +
|-
 +
| colspan="2"| Number Of Players
 +
| colspan="2"| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|-
 +
| rowspan="2" | Players
 
  | UUID
 
  | UUID
  | Unique ID for this bar
+
  | rowspan="2" | {{Type|Array}}
|-
+
  | {{Type|UUID}}
|colspan="2"| Action
+
  | The player UUID
  | VarInt Enum
 
  | Determines the layout of the remaining packet
 
 
  |-
 
  |-
 +
| Player Actions
 +
| {{Type|Array}} of [[#player-info:player-actions|Player&nbsp;Actions]]
 +
| The length of this array is determined by the number of [[#player-info:player-actions|Player Actions]] that give a non-zero value when applying its mask to the actions flag. For example given the decimal number 5, binary 00000101. The masks 0x01 and 0x04 would return a non-zero value, meaning the Player Actions array would include two actions: Add Player and Update Game Mode.
 +
|}
 +
 +
{| class="wikitable"
 +
|+ id="player-info:player-actions" | Player Actions
 
  ! Action
 
  ! Action
  ! Field Name
+
  ! Mask
  !  
+
  ! colspan="2" | Field Name
  !  
+
  ! colspan="2" | Type
|-
+
  ! Notes
|rowspan="5"| 0: add
 
  | Title
 
| [[Chat]]
 
|
 
 
  |-
 
  |-
  | Health
+
  | rowspan="6" | Add Player
  | Float
+
| rowspan="6" | 0x01
  | From 0 to 1. Values greater than 1 do not crash the client, and start [https://i.johni0702.de/nA.png rendering part of a second health bar] at around 1.5.
+
  | colspan="2" | Name
 +
  | colspan="2" | {{Type|String}} (16)
 
  |-
 
  |-
  | Color
+
  | colspan="2" | Number Of Properties
  | VarInt
+
  | colspan="2" | {{Type|VarInt}}
  | Color ID (see below)
+
  | Number of elements in the following array.
 
  |-
 
  |-
  | Dividers
+
  | rowspan="4" | Property
  | VarInt
+
| Name
  | Number of dividers rendered in the bar
+
| rowspan="4"| {{Type|Array}}
 +
  | {{Type|String}} (32767)
 +
  |
 
  |-
 
  |-
  | Flags
+
  | Value
  | Unsigned Byte
+
  | {{Type|String}} (32767)
  | Bit mask: 0x1 should darken sky, 0x2: is dragon bar
+
  |
 
  |-
 
  |-
  | 1: remove
+
  | Is Signed
  | ''no fields''
+
  | {{Type|Boolean}}
| ''no fields''
+
  |
  | Removes this boss bar
 
 
  |-
 
  |-
  | 2: update health
+
  | Signature
  | Health
+
  | {{Type|Optional}} {{Type|String}} (32767)
| Float
+
  | Only if Is Signed is true.
  | as above
 
 
  |-
 
  |-
  | 3: update title
+
  | rowspan="7" | Initialize Chat
  | Title
+
  | rowspan="7" | 0x02
  | [[Chat]]
+
  | colspan="2" | Has Signature Data
  |  
+
  | colspan="2" | {{Type|Boolean}}
 
  |-
 
  |-
  |rowspan="2"| 4: update style
+
  | colspan="2" | Chat session ID
  | Color
+
  | colspan="2" | {{Type|UUID}}
| VarInt Enum
+
  | Only sent if Has Signature Data is true.
  | Color ID (see below)
 
 
  |-
 
  |-
  | Dividers
+
  | colspan="2" | Public key expiry time
  | VarInt
+
  | colspan="2" | {{Type|Long}}
  | as above
+
  | Key expiry time, as a UNIX timestamp in milliseconds. Only sent if Has Signature Data is true.
 
  |-
 
  |-
  | 5: update flags
+
  | colspan="2" | Encoded public key size
  | Flags
+
  | colspan="2" | {{Type|VarInt}}
| Unsigned Byte
+
  | Size of the following array. Only sent if Has Signature Data is true. Maximum length is 512 bytes.
  | as above
 
 
  |-
 
  |-
  |}
+
  | colspan="2" | Encoded public key
 
+
| colspan="2" | {{Type|Byte Array}} (512)
{| class="wikitable"
+
  | The player's public key, in bytes. Only sent if Has Signature Data is true.
  ! ID
 
! Color
 
 
  |-
 
  |-
  | 0
+
  | colspan="2" | Public key signature size
  | Pink(ish)
+
| colspan="2" | {{Type|VarInt}}
 +
  | Size of the following array. Only sent if Has Signature Data is true. Maximum length is 4096 bytes.
 
  |-
 
  |-
  | 1
+
  | colspan="2" | Public key signature
  | Cyan
+
| colspan="2" | {{Type|Byte Array}} (4096)
 +
  | The public key's digital signature. Only sent if Has Signature Data is true.
 
  |-
 
  |-
  | 2
+
  | Update Game Mode
  | Red
+
| 0x04
 +
| colspan="2" | Game Mode
 +
  | colspan="2" | {{Type|VarInt}}
 
  |-
 
  |-
  | 3
+
  | Update Listed
  | Lime
+
  | 0x08
 +
| colspan="2" | Listed
 +
| colspan="2" | {{Type|Boolean}}
 +
| Whether the player should be listed on the player list.
 
  |-
 
  |-
  | 4
+
  | Update Latency
  | Yellow
+
  | 0x10
 +
| colspan="2" | Ping
 +
| colspan="2" | {{Type|VarInt}}
 +
| Measured in milliseconds.
 
  |-
 
  |-
  | 5
+
  | rowspan="2" | Update Display Name
  | Purple
+
| rowspan="2" | 0x20
 +
  | colspan="2" | Has Display Name
 +
| colspan="2" | {{Type|Boolean}}
 
  |-
 
  |-
  | 6
+
  | colspan="2" | Display Name
  | White
+
| colspan="2" | {{Type|Optional}} {{Type|Text Component}}
 +
| Only sent if Has Display Name is true.
 +
|- {{added}}
 +
| Update List Priority
 +
| 0x40
 +
| colspan="2" | Priority
 +
| colspan="2" | {{Type|VarInt}}
 +
  | See below.
 
  |}
 
  |}
  
==== {{Change||Set Cooldown}} ====
+
The properties included in this packet are the same as in [[#Login Success|Login Success]], for the current player.
 +
 
 +
Ping values correspond with icons in the following way:
 +
* A ping that negative (i.e. not known to the server yet) will result in the no connection icon.
 +
* A ping under 150 milliseconds will result in 5 bars
 +
* A ping under 300 milliseconds will result in 4 bars
 +
* A ping under 600 milliseconds will result in 3 bars
 +
* A ping under 1000 milliseconds (1 second) will result in 2 bars
 +
* A ping greater than or equal to 1 second will result in 1 bar.
 +
 
 +
The order of players in the player list is determined as follows:
 +
* {{change||Players with higher priorities are sorted before those with lower priorities.}}
 +
* {{change||Among players of equal priorities, }}spectators are sorted after non-spectators.
 +
* Within each of those groups, players are sorted into teams. The teams are ordered case-sensitively by team name in ascending order. Players with no team are listed first.
 +
* The players of each team (and non-team) are sorted case-insensitively by name in ascending order.
 +
 
 +
==== Synchronize Player Position ====
 +
 
 +
Teleports the client, e.g. during login, when using an ender pearl, in response to invalid move packets, etc.
  
Applies a cooldown period to an item type.
+
Due to latency, the server may receive outdated movement packets sent before the client was aware of the teleport. To account for this, the server ignores all movement packets from the client until a [[#Confirm Teleportation|Confirm Teleportation]] packet with an ID matching the one sent in the teleport packet is received.
 +
 
 +
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360 (see [https://bugs.mojang.com/browse/MC-90097 MC-90097]).
 +
 
 +
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,691: Line 1,541:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| {{Change|0x4A|0x17}}
+
  | rowspan="11"| ''protocol:''<br/><code>{{change|0x40|0x42}}</code><br/><br/>''resource:''<br/><code>player_position</code>
  |rowspan="2"| Play
+
  | rowspan="11"| Play
  |rowspan="2"| Client
+
  | rowspan="11"| Client
  | Item ID
+
  | {{added}} | Teleport ID
  | VarInt
+
  | {{added}} | {{Type|VarInt}}
  | ID of the item to apply a cooldown to.
+
  | {{added}} | Client should confirm this packet with [[#Confirm Teleportation|Confirm Teleportation]] containing the same Teleport ID.
 +
|-
 +
| X
 +
| {{Type|Double}}
 +
| Absolute or relative position, depending on Flags.
 +
|-
 +
| Y
 +
| {{Type|Double}}
 +
| Absolute or relative position, depending on Flags.
 +
|-
 +
| Z
 +
| {{Type|Double}}
 +
| Absolute or relative position, depending on Flags.
 +
|- {{added}}
 +
| Velocity X
 +
| {{Type|Double}}
 +
|
 +
|- {{added}}
 +
| Velocity Y
 +
| {{Type|Double}}
 +
|
 +
|- {{added}}
 +
| Velocity Z
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Yaw
 +
| {{Type|Float}}
 +
| Absolute or relative rotation on the X axis, in degrees.
 +
|-
 +
| Pitch
 +
| {{Type|Float}}
 +
| Absolute or relative rotation on the Y axis, in degrees.
 
  |-
 
  |-
  | Cooldown Ticks
+
  | Flags
  | VarInt
+
  | {{change|{{Type|Byte}}|{{Type|Teleport Flags}}}}
  | Number of ticks to apply a cooldown for.
+
| {{change|Reference the Flags table below. When the value of the this byte masked is zero the field is absolute, otherwise relative.|}}
 +
|- {{removed}}
 +
| Teleport ID
 +
| {{Type|VarInt}}
 +
  | Client should confirm this packet with [[#Confirm Teleportation|Confirm Teleportation]] containing the same Teleport ID.
 
  |}
 
  |}
  
=== Serverbound ===
+
==== Player Rotation ====
 
 
==== Use Entity ====
 
 
 
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
 
 
 
A Notchian server only accepts this packet if the entity being attacked/used is visible without obstruction and within a 4-unit radius of the player's position.
 
 
 
Note that middle-click in creative mode is interpreted by the client and sent as a [[#Creative Inventory Action|Creative Inventory Action]] packet instead.
 
  
{| class="wikitable"
+
{| class="wikitable" {{added}}
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 1,721: Line 1,599:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x02
+
  | rowspan="2"| ''protocol:''<br/><code>0x43</code><br/><br/>''resource:''<br/><code>player_rotation</code>
  |rowspan="6"| Play
+
  | rowspan="2"| Play
  |rowspan="6"| Server
+
  | rowspan="2"| Client
  | Target
+
  | Yaw
  | VarInt
+
  | {{Type|Float}}
  |  
+
  | Rotation on the X axis, in degrees.
 
  |-
 
  |-
  | Type
+
  | Pitch
  | VarInt Enum
+
  | {{Type|Float}}
| 0: interact, 1: attack, 2: interact at
+
  | Rotation on the Y axis, in degrees.
|-
 
| Target X
 
| Optional Float
 
  | Only if Type is interact at
 
|-
 
| Target Y
 
| Optional Float
 
| Only if Type is interact at
 
|-
 
| Target Z
 
| Optional Float
 
| Only if Type is interact at
 
|- style="background-color: #d9ead3;"
 
| Hand
 
| Optional VarInt Enum
 
| Only if Type is interact or interact at; 0: main hand, 1: off hand
 
 
  |}
 
  |}
  
==== Player Digging ====
+
==== Place Ghost Recipe ====
  
Sent when the player mines a block. A Notchian server only accepts digging packets with coordinates within a 6-unit radius of the player's position.
+
Response to the serverbound packet ([[#Place Recipe|Place Recipe]]), with the same recipe ID. Appears to be used to notify the UI.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,761: Line 1,623:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x07
+
  | rowspan="4"| ''protocol:''<br/><code>{{change|0x37|0x39}}</code><br/><br/>''resource:''<br/><code>place_ghost_recipe</code>
  |rowspan="3"| Play
+
  | rowspan="4"| Play
  |rowspan="3"| Server
+
  | rowspan="4"| Client
  | Status
+
  | Window ID
  | Byte Enum
+
  | {{change|{{Type|Byte}}|{{Type|VarInt}}}}
  | The action the player is taking against the block (see below)
+
|
  |-
+
  |- {{removed}}
  | Location
+
| Recipe
  | Position
+
| {{Type|Identifier}}
  | Block position
+
| A recipe ID.
  |-
+
  |- {{added}}
  | Face
+
  | Recipe Display ID
  | Byte Enum
+
  | {{Type|VarInt}}
  | The face being hit (see below)
+
  | ID in the <code>minecraft:recipe_display</code> registry.
 +
  |- {{added}}
 +
  | Recipe Data
 +
  | Varies
 +
  | Depends on Recipe Type; see below.
 
  |}
 
  |}
  
Status can be one of seven values:
+
''below''
 +
 
 +
==== Recipe Book Add ====
  
{| class="wikitable"
+
{| class="wikitable" {{added}}
  ! Value
+
  ! Packet ID
  ! Meaning
+
  ! State
  ! Notes
+
  ! Bound To
 +
! colspan="2"| Field Name
 +
! colspan="2"| Field Type
 +
! colspan="2"| Notes
 +
|-
 +
| rowspan="10"| ''protocol:''<br/><code>0x44</code><br/><br/>''resource:''<br/><code>recipe_book_add</code>
 +
| rowspan="10"| Play
 +
| rowspan="10"| Client
 +
| colspan="2"| Recipe Count
 +
| colspan="2"| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|-
 +
| rowspan="8"| Recipes
 +
| Recipe ID
 +
| rowspan="8"| {{Type|Array}}
 +
| {{Type|VarInt}}
 +
| ID to assign to the recipe.
 +
|-
 +
| Display ID
 +
| {{Type|VarInt}}
 +
| ID in the <code>minecraft:recipe_display</code> registry.
 +
|-
 +
| Group ID
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Category ID
 +
| {{Type|VarInt}}
 +
| ID in the <code>minecraft:recipe_book_category</code> registry.
 +
|-
 +
| Has Ingredients
 +
| {{Type|Boolean}}
 +
|
 
  |-
 
  |-
  | 0
+
  | Ingredient Count
  | Started digging
+
  | {{Type|Optional}} {{Type|VarInt}}
  |  
+
  | Number of elements in the following array. Only present if Has Ingredients is true.
 
  |-
 
  |-
  | 1
+
  | Ingredients
  | Cancelled digging
+
  | {{Type|Optional}} {{Type|Array}} of {{Type|ID Set}}
  | Sent when the player lets go of the Mine Block key (default: left click)
+
  | IDs in the <code>minecraft:item</code> registry, or an inline definition. Only present if Has Ingredients is true.
 
  |-
 
  |-
  | 2
+
  | Flags
  | Finished digging
+
  | {{Type|Byte}}
  | Sent when the client thinks it is finished
+
  | 0x01: show notification; 0x02: highlight as new
 
  |-
 
  |-
  | 3
+
  | colspan="2"| Replace
  | Drop item stack
+
  | colspan="2"| {{Type|Boolean}}
  | Triggered by using the Drop Item key (default: Q) with the modifier to drop the entire selected stack (default: depends on OS). Location is always set to 0/0/0, Face is always set to -Y.
+
  | Replace or Add to known recipes
 +
|}
 +
 
 +
==== Recipe Book Remove ====
 +
 
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 4
+
  | rowspan="2"| ''protocol:''<br/><code>0x45</code><br/><br/>''resource:''<br/><code>recipe_book_remove</code>
  | Drop item
+
| rowspan="2"| Play
  | Triggered by using the Drop Item key (default: Q). Location is always set to 0/0/0, Face is always set to -Y.
+
| rowspan="2"| Client
 +
| Recipe Count
 +
  | {{Type|VarInt}}
 +
  | Number of elements in the following array.
 
  |-
 
  |-
  | 5
+
  | Recipes
  | Shoot arrow / finish eating
+
  | {{Type|Array}} of {{Type|VarInt}}
| Location is always set to 0/0/0, Face is always set to Special.
+
  | IDs of recipes to remove.
|- style="background-color: #d9ead3;"
 
  | 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 (or the Special value used for “shoot arrow / finish eating”):
+
==== Recipe Book Settings ====
  
{| class="wikitable"
+
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Value
+
  | rowspan="8"| ''protocol:''<br/><code>0x46</code><br/><br/>''resource:''<br/><code>recipe_book_settings</code>
  ! Offset
+
  | rowspan="8"| Play
  ! Face
+
  | rowspan="8"| Client
 +
| Crafting Recipe Book Open
 +
| {{Type|Boolean}}
 +
| If true, then the crafting recipe book will be open when the player opens its inventory.
 
  |-
 
  |-
  | 0
+
  | Crafting Recipe Book Filter Active
  | -Y
+
  | {{Type|Boolean}}
  | Bottom
+
  | If true, then the filtering option is active when the players opens its inventory.
 
  |-
 
  |-
  | 1
+
  | Smelting Recipe Book Open
  | +Y
+
  | {{Type|Boolean}}
  | Top
+
  | If true, then the smelting recipe book will be open when the player opens its inventory.
 
  |-
 
  |-
  | 2
+
  | Smelting Recipe Book Filter Active
  | -Z
+
  | {{Type|Boolean}}
  | North
+
  | If true, then the filtering option is active when the players opens its inventory.
 
  |-
 
  |-
  | 3
+
  | Blast Furnace Recipe Book Open
  | +Z
+
  | {{Type|Boolean}}
  | South
+
  | If true, then the blast furnace recipe book will be open when the player opens its inventory.
 
  |-
 
  |-
  | 4
+
  | Blast Furnace Recipe Book Filter Active
  | -X
+
  | {{Type|Boolean}}
  | West
+
  | If true, then the filtering option is active when the players opens its inventory.
 
  |-
 
  |-
  | 5
+
  | Smoker Recipe Book Open
  | +X
+
  | {{Type|Boolean}}
  | East
+
  | If true, then the smoker recipe book will be open when the player opens its inventory.
 
  |-
 
  |-
  | 255
+
  | Smoker Recipe Book Filter Active
  |
+
  | {{Type|Boolean}}
  | Special
+
  | If true, then the filtering option is active when the players opens its inventory.
 
  |}
 
  |}
  
==== {{Change||Use Item}} ====
+
==== Respawn ====
 +
 
 +
{{Need Info|Although the number of portal cooldown ticks is included in this packet, the whole portal usage process is still dictated entirely by the server. What kind of effect does this value have on the client, if any?}}
  
Sent when pressing the Use Item key (default: right click) with an item in hand.
+
To change the player's dimension (overworld/nether/end), send them a respawn packet with the appropriate dimension, followed by prechunks/chunks for the new dimension, and finally a position and look packet. You do not need to unload chunks, the client will do it automatically.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,862: Line 1,783:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x08
+
  | rowspan="13"| ''protocol:''<br/><code>{{change|0x47|0x4C}}</code><br/><br/>''resource:''<br/><code>respawn</code>
  |rowspan="1"| Play
+
  | rowspan="13"| Play
  |rowspan="1"| Server
+
  | rowspan="13"| Client
  | Hand
+
  | Dimension Type
  | VarInt Enum
+
  | {{Type|VarInt}}
  | Hand used for the animation
+
| The ID of type of dimension in the <code>minecraft:dimension_type</code> registry, defined by the [[Protocol#Registry_Data|Registry Data]] packet.
 +
|-
 +
| Dimension Name
 +
| {{Type|Identifier}}
 +
| Name of the dimension being spawned into.
 +
|-
 +
  | Hashed seed
 +
| {{Type|Long}}
 +
| First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
 +
|-
 +
| Game mode
 +
| {{Type|Unsigned Byte}}
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
 +
|-
 +
| Previous Game mode
 +
| {{Type|Byte}}
 +
| -1: Undefined (null), 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. The previous game mode. Vanilla client uses this for the debug (F3 + N & F3 + F4) game mode switch. (More information needed)
 +
|-
 +
| Is Debug
 +
| {{Type|Boolean}}
 +
| True if the world is a {{Minecraft Wiki|debug mode}} world; debug mode worlds cannot be modified and have predefined blocks.
 +
|-
 +
| Is Flat
 +
| {{Type|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.
 +
|-
 +
| Has death location
 +
| {{Type|Boolean}}
 +
| If true, then the next two fields are present.
 +
|-
 +
| Death dimension Name
 +
| {{Type|Optional}} {{Type|Identifier}}
 +
| Name of the dimension the player died in.
 +
|-
 +
| Death location
 +
| {{Type|Optional}} {{Type|Position}}
 +
| The location that the player died at.
 +
|-
 +
| Portal cooldown
 +
| {{Type|VarInt}}
 +
| The number of ticks until the player can use the portal again.
 +
|- {{added}}
 +
| Sea level
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Data kept
 +
| {{Type|Byte}}
 +
| Bit mask. 0x01: Keep attributes, 0x02: Keep metadata. Tells which data should be kept on the client side once the player has respawned.
 +
In the Notchian implementation, this is context dependent:
 +
* normal respawns (after death) keep no data;
 +
* exiting the end poem/credits keeps the attributes;
 +
* other dimension changes (portals or teleports) keep all data.
 
  |}
 
  |}
  
==== Player Block Placement ====
+
{{Warning2|Avoid changing player's dimension to same dimension they were already in unless they are dead. If you change the dimension to one they are already in, weird bugs can occur, such as the player being unable to attack other players in new world (until they die and respawn).
 +
 
 +
Before 1.16, if you must respawn a player in the same dimension without killing them, send two respawn packets, one to a different world and then another to the world you want. You do not need to complete the first respawn; it only matters that you send two packets.}}
 +
 
 +
==== Set Cursor Item ====
  
{| class="wikitable"
+
{| class="wikitable" {{added}}
|-
 
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 1,881: Line 1,857:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| {{Change|0x08|0x09}}
+
  | 0x5A
  |rowspan="7"| Play
+
  | Play
  |rowspan="7"| Server
+
  | Client
  | Location
+
  | Slot Data
| Position
+
  | {{Type|Slot}}
| Block position
+
  |
|-
 
| Face
 
  | {{Change|Byte|VarInt}} Enum
 
| The face on which the block is placed (as documented at [[#Player Digging|Player Digging]])
 
|- style="background-color: #f4cccc; text-decoration: line-through;"
 
| Held Item
 
| [[Slot Data|Slot]]
 
|
 
|- style="background-color: #d9ead3;"
 
| Hand
 
| VarInt Enum
 
| The hand from which the block is placed; 0: main hand, 1: off hand
 
|-
 
| Cursor Position X
 
| Byte
 
| The position of the crosshair on the block
 
|-
 
| Cursor Position Y
 
| Byte
 
|
 
|-
 
| Cursor Position Z
 
| Byte
 
  |  
 
 
  |}
 
  |}
  
In normal operation (i.e. placing a block), this packet is sent once, with the values set normally.
+
==== Update Time ====
 
 
This packet has a special case where X, Y, Z, and Direction are all -1. (Note that Y is unsigned so set to 255.) This special packet indicates that the currently held item for the player should have its state updated such as eating food, pulling back bows, using buckets, etc.
 
  
Special note on using buckets: When using buckets, the Notchian client might send two packets: first a normal and then a special case. The first normal packet is sent when you're looking at a block (e.g. the water you want to scoop up). This normal packet does not appear to do anything with a Notchian server. The second, special case packet appears to perform the action — based on current position/orientation and with a distance check — it appears that buckets can only be used within a radius of 6 units.
+
Time is based on ticks, where 20 ticks happen every second. There are 24000 ticks in a day, making Minecraft days exactly 20 minutes long.
  
==== Held Item Change ====
+
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
  
Sent when the player changes the slot selection.
+
The default SMP server increments the time by <code>20</code> every second.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,931: Line 1,881:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| {{Change|0x09|0x0A}}
+
  | rowspan="3"| ''protocol:''<br/><code>{{change|0x64|0x6B}}</code><br/><br/>''resource:''<br/><code>set_time</code>
  |rowspan="1"| Play
+
  | rowspan="3"| Play
  |rowspan="1"| Server
+
  | rowspan="3"| Client
  | Slot
+
  | World Age
  | Short
+
  | {{Type|Long}}
  | The slot which the player has selected (0–8)
+
| In ticks; not changed by server commands.
 +
|-
 +
| Time of day
 +
| {{Type|Long}}
 +
  | The world (or region) time, in ticks. {{change|If negative the sun will stop moving at the Math.abs of the time.|}}
 +
|- {{added}}
 +
| Time of day increasing
 +
| {{Type|Boolean}}
 +
| If true, the client should automatically advance the time of day according to its ticking rate.
 
  |}
 
  |}
  
==== Animation ====
+
==== Set Player Inventory Slot ====
  
Sent when the player's arm swings.
+
{| class="wikitable" {{added}}
 
 
{| class="wikitable"
 
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 1,951: Line 1,907:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| {{Change|0x0A|0x0B}}
+
  | rowspan="2"| ''protocol:''<br/><code>0x66</code><br/><br/>''resource:''<br/><code>set_player_inventory</code>
  |rowspan="1"| Play
+
  | rowspan="2"| Play
  |rowspan="1"| Server
+
  | rowspan="2"| Client
  |style="background-color: #d9ead3;"| Hand
+
| Slot
  |style="background-color: #d9ead3;"| VarInt Enum
+
  | {{Type|VarInt}}
  |style="background-color: #d9ead3;"| Hand used for the animation
+
|
 +
  |-
 +
| Slot Data
 +
  | {{Type|Slot}}
 +
|
 
  |}
 
  |}
  
==== Entity Action ====
+
==== Synchronize Vehicle Position ====
  
Sent at least when crouching, leaving a bed, or sprinting. To send action animation to client use 0x28. The client will send this with Action ID = 3 when “Leave Bed” is clicked.
+
Teleports the entity on the client without changing the reference point of movement deltas in future [[#Update Entity Position|Update Entity Position]] packets. Seems to be used to make relative adjustments to vehicle positions; more information needed.
  
{| class="wikitable"
+
{| class="wikitable" {{added}}
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 1,971: Line 1,931:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| {{Change|0x0B|0x0C}}
+
  | rowspan="11"| ''protocol:''<br/><code>0x77</code><br/><br/>''resource:''<br/><code>teleport_entity</code>
  |rowspan="3"| Play
+
  | rowspan="11"| Play
  |rowspan="3"| Server
+
  | rowspan="11"| Client
 
  | Entity ID
 
  | Entity ID
  | VarInt
+
  | {{Type|VarInt}}
  | Player ID
+
|
 +
|-
 +
| X
 +
| {{Type|Double}}
 +
  |
 
  |-
 
  |-
  | Action ID
+
  | Y
  | VarInt Enum
+
  | {{Type|Double}}
  | The ID of the action, see below
+
  |
 
  |-
 
  |-
  | Jump Boost
+
  | Z
  | VarInt
+
  | {{Type|Double}}
| Horse jump boost. Ranged from 0 to 100.
+
  |
  |}
 
 
 
Action ID can be one of the following values:
 
 
 
{| class="wikitable"
 
! ID
 
! Action
 
 
  |-
 
  |-
  | 0
+
  | Velocity X
  | Crouch
+
| {{Type|Double}}
 +
  |
 
  |-
 
  |-
  | 1
+
  | Velocity Y
  | Uncrouch
+
| {{Type|Double}}
 +
  |
 
  |-
 
  |-
  | 2
+
  | Velocity Z
  | Leave bed
+
| {{Type|Double}}
 +
  |
 
  |-
 
  |-
  | 3
+
  | Yaw
  | Start sprinting
+
  | {{Type|Float}}
 +
| Rotation on the Y axis, in degrees.
 
  |-
 
  |-
  | 4
+
  | Pitch
  | Stop sprinting
+
| {{Type|Float}}
 +
| Rotation on the Y axis, in degrees.
 +
|- {{added}}
 +
| Flags
 +
| {{Type|Teleport Flags}}
 +
  |
 
  |-
 
  |-
  | 5
+
  | On Ground
  | Jump with horse
+
  | {{Type|Boolean}}
|- style="background-color: #f4cccc; text-decoration: line-through;"
+
  |
| 6
 
  | Open inventory
 
 
  |}
 
  |}
  
“Open inventory” is now sent via the [[#Client Status|Client Status]] packet.
+
=== Serverbound ===
  
==== Steer Vehicle ====
+
==== Bundle Item Selected ====
  
{| class="wikitable"
+
{| class="wikitable" {{added}}
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 2,027: Line 1,991:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| {{Change|0x0C|0x0D}}
+
  | rowspan="2"| ''protocol:''<br/><code>0x02</code><br/><br/>''resource:''<br/><code>bundle_item_selected</code>
  |rowspan="3"| Play
+
  | rowspan="2"| Play
  |rowspan="3"| Server
+
  | rowspan="2"| Server
  | Sideways
+
  | Slot of Bundle
  | Float
+
  | {{Type|VarInt}}
  | Positive to the left of the player
+
  |
 
  |-
 
  |-
  | Forward
+
  | Slot in Bundle
  | Float
+
  | {{Type|VarInt}}
| Positive forward
+
  |
|-
 
| Flags
 
| Unsigned Byte
 
  | Bit mask. 0x1: jump, 0x2: unmount
 
 
  |}
 
  |}
  
==== Close Window ====
+
==== Client Tick End ====
 
 
This packet is sent by the client when closing a window.
 
  
Notchian clients send a Close Window packet with Window ID 0 to close their inventory even though there is never an [[#Open Window|Open Window]] packet for the inventory.
+
{| class="wikitable" {{added}}
 
 
{| class="wikitable"
 
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 2,057: Line 2,013:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | {{Change|0x0D|0x0E}}
+
  | ''protocol:''<br/><code>0x0B</code><br/><br/>''resource:''<br/><code>client_tick_end</code>
  |rowspan="1"| Play
+
  | Play
  |rowspan="1"| Server
+
  | Server
  | Window ID
+
  | colspan="3"| ''no fields''
| Unsigned Byte
 
| This is the ID of the window that was closed. 0 for player inventory.
 
 
  |}
 
  |}
  
==== Click Window ====
+
==== Click Container ====
  
This packet is sent by the player when it clicks on a slot in a window.
+
This packet is sent by the client when the player clicks on a slot in a window.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,073: Line 2,027:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  ! colspan="2"| Field Name
  ! Field Type
+
  ! colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| {{Change|0x0E|0x0F}}
+
  | rowspan="9"| ''protocol:''<br/><code>{{change|0x0E|0x10}}</code><br/><br/>''resource:''<br/><code>container_click</code>
  |rowspan="6"| Play
+
  | rowspan="9"| Play
  |rowspan="6"| Server
+
  | rowspan="9"| Server
  | Window ID
+
  | colspan="2"| Window ID
  | Unsigned Byte
+
  | colspan="2"| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
  | The ID of the window which was clicked. 0 for player inventory.
+
  | colspan="2"| The ID of the window which was clicked. 0 for player inventory. The server ignores any packets targeting a Window ID other than the current one, including ignoring 0 when any other window is open.
 +
|-
 +
| colspan="2"| State ID
 +
| colspan="2"| {{Type|VarInt}}
 +
| colspan="2"| The last received State ID from either a [[#Set Container Slot|Set Container Slot]] or a [[#Set Container Content|Set Container Content]] packet.
 +
|-
 +
| colspan="2"| Slot
 +
| colspan="2"| {{Type|Short}}
 +
| colspan="2"| The clicked slot number, see below.
 +
|-
 +
| colspan="2"| Button
 +
| colspan="2"| {{Type|Byte}}
 +
| colspan="2"| The button used in the click, see below.
 
  |-
 
  |-
  | Slot
+
  | colspan="2"| Mode
  | Short
+
  | colspan="2"| {{Type|VarInt}} {{Type|Enum}}
  | The clicked slot number, see below
+
  | colspan="2"| Inventory operation mode, see below.
 
  |-
 
  |-
  | Button
+
  | colspan="2"| Length of the array
  | Byte
+
  | colspan="2"| {{Type|VarInt}}
  | The button used in the click, see below
+
  | colspan="2"| Maximum value for Notchian server is 128 slots.
 
  |-
 
  |-
  | Action Number
+
  | rowspan="2"| Array of changed slots
  | Short
+
  | Slot number
  | A unique number for the action, implemented by Notchian as a counter, starting at 1. Used by the server to send back a [[Protocol#Confirm Transaction|Confirm Transaction]].
+
| rowspan="2"| {{Type|Array}} (128)
 +
| {{Type|Short}}
 +
  |
 
  |-
 
  |-
  | Mode
+
  | Slot data
  | Byte Enum
+
  | {{Type|Slot}}
  | Inventory operation mode, see below
+
  | New data for this slot, in the client's opinion; see below.
 
  |-
 
  |-
  | Clicked item
+
  | colspan="2"| Carried item
  | [[Slot Data|Slot]]
+
  | colspan="2"| [[Slot Data|Slot]]
  | The clicked slot. Has to be empty (item ID = -1) for drop mode.
+
  | colspan="2"| Item carried by the cursor. Has to be empty (item ID = -1) for drop mode, otherwise nothing will happen.
 
  |}
 
  |}
  
 
See [[Inventory]] for further information about how slots are indexed.
 
See [[Inventory]] for further information about how slots are indexed.
 +
 +
After performing the action, the server compares the results to the slot change information included in the packet, as applied on top of the server's view of the container's state prior to the action. For any slots that do not match, it sends [[#Set Container Slot|Set Container Slot]] packets containing the correct results. If State ID does not match the last ID sent by the server, it will instead send a full [[#Set Container Content|Set Container Content]] to resynchronize the client.
  
 
When right-clicking on a stack of items, half the stack will be picked up and half left in the slot. If the stack is an odd number, the half left in the slot will be smaller of the amounts.
 
When right-clicking on a stack of items, half the stack will be picked up and half left in the slot. If the stack is an odd number, the half left in the slot will be smaller of the amounts.
Line 2,117: Line 2,087:
 
  ! Trigger
 
  ! Trigger
 
  |-
 
  |-
  !rowspan="2"| 0
+
  ! rowspan="4"| 0
 
  | 0
 
  | 0
 
  | Normal
 
  | Normal
Line 2,126: Line 2,096:
 
  | Right mouse click
 
  | Right mouse click
 
  |-
 
  |-
  !rowspan="2"| 1
+
| 0
 +
| -999
 +
| Left click outside inventory (drop cursor stack)
 +
|-
 +
| 1
 +
| -999
 +
| Right click outside inventory (drop cursor single item)
 +
|-
 +
  ! rowspan="2"| 1
 
  | 0
 
  | 0
 
  | Normal
 
  | Normal
Line 2,135: Line 2,113:
 
  | Shift + right mouse click ''(identical behavior)''
 
  | Shift + right mouse click ''(identical behavior)''
 
  |-
 
  |-
  !rowspan="5"| 2
+
  ! rowspan="7"| 2
 
  | 0
 
  | 0
 
  | Normal
 
  | Normal
Line 2,156: Line 2,134:
 
  | Number key 9
 
  | Number key 9
 
  |-
 
  |-
  !rowspan="1"| 3
+
| ⋮
 +
| ⋮
 +
| Button is used as the slot index (impossible in vanilla clients)
 +
|-
 +
| 40
 +
| Normal
 +
| Offhand swap key F
 +
|-
 +
  ! 3
 
  | 2
 
  | 2
 
  | Normal
 
  | Normal
  | Middle click
+
  | Middle click, only defined for creative players in non-player inventories.
 
  |-
 
  |-
  !rowspan="4"| 4
+
  ! rowspan="2"| 4
 
  | 0
 
  | 0
 
  | Normal*
 
  | Normal*
  | Drop key (Q) (* Clicked item is different, see above)
+
  | Drop key (Q) (* Clicked item is always empty)
 
  |-
 
  |-
 
  | 1
 
  | 1
 
  | Normal*
 
  | Normal*
  | Ctrl + Drop key (Ctrl-Q) ''(drops full stack)''
+
  | Control + Drop key (Q) (* Clicked item is always empty)
 
  |-
 
  |-
 +
! rowspan="9"| 5
 
  | 0
 
  | 0
 
  | -999
 
  | -999
  | Left click outside inventory holding nothing ''(no-op)''
+
  | Starting left mouse drag
 
  |-
 
  |-
  | 1
+
  | 4
 
  | -999
 
  | -999
  | Right click outside inventory holding nothing ''(no-op)''
+
  | Starting right mouse drag
 
  |-
 
  |-
  !rowspan="6"| 5
+
  | 8
| 0
 
| -999
 
| Starting left mouse drag ''(or middle mouse)''
 
|-
 
| 4
 
 
  | -999
 
  | -999
  | Starting right mouse drag
+
  | Starting middle mouse drag, only defined for creative players in non-player inventories.
 
  |-
 
  |-
 
  | 1
 
  | 1
Line 2,194: Line 2,176:
 
  | Normal
 
  | Normal
 
  | Add slot for right-mouse drag
 
  | Add slot for right-mouse drag
 +
|-
 +
| 9
 +
| Normal
 +
| Add slot for middle-mouse drag, only defined for creative players in non-player inventories.
 
  |-
 
  |-
 
  | 2
 
  | 2
Line 2,203: Line 2,189:
 
  | Ending right mouse drag
 
  | Ending right mouse drag
 
  |-
 
  |-
  ! 6
+
| 10
 +
| -999
 +
| Ending middle mouse drag, only defined for creative players in non-player inventories.
 +
|-
 +
  ! rowspan="2"| 6
 
  | 0
 
  | 0
 
  | Normal
 
  | Normal
 
  | Double click
 
  | Double click
 +
|-
 +
| 1
 +
| Normal
 +
| Pickup all but check items in reverse order (impossible in vanilla clients)
 
  |}
 
  |}
  
Line 2,217: Line 2,211:
 
If any of the painting packets other than the “progress” ones are sent out of order (for example, a start, some slots, then another start; or a left-click in the middle) the painting status will be reset.
 
If any of the painting packets other than the “progress” ones are sent out of order (for example, a start, some slots, then another start; or a left-click in the middle) the painting status will be reset.
  
The server will send back a [[Protocol#Confirm Transaction|Confirm Transaction]] packet. If the click was not accepted, the client must reflect that packet before sending more [[#Click Window|Click Window]] packets, otherwise the server will reject them silently. The Notchian server also sends a [[Protocol#Window Items|Window Items]] packet for the open window and [[Protocol#Set Slot|Set Slot]] packets for the clicked and cursor slot, but only when the click was not accepted, probably to resynchronize client and server.
+
==== Close Container ====
  
==== Confirm Transaction ====
+
This packet is sent by the client when closing a window.
  
<SpaceManiac> noooo idea why the serverbound confirm transaction packet exists
+
Notchian clients send a Close Window packet with Window ID 0 to close their inventory even though there is never an [[#Open Screen|Open Screen]] packet for the inventory.
<SpaceManiac> I think it's sent as a response to the clientbound confirm transaction in some situations, but it's fuzzy
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,232: Line 2,225:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| {{Change|0x0F|0x10}}
+
  | ''protocol:''<br/><code>{{change|0x0F|0x11}}</code><br/><br/>''resource:''<br/><code>container_close</code>
  |rowspan="3"| Play
+
  | Play
  |rowspan="3"| Server
+
  | Server
 
  | Window ID
 
  | Window ID
  | Byte
+
  | {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
  | The ID of the window that the action occurred in
+
  | This is the ID of the window that was closed. 0 for player inventory.
|-
 
| Action Number
 
| Short
 
| Every action that is to be accepted has a unique number. This field corresponds to that number.
 
|-
 
| Accepted
 
| Boolean
 
| Whether the action was accepted
 
 
  |}
 
  |}
  
==== Creative Inventory Action ====
+
==== Edit Book ====
 
 
While the user is in the standard inventory (i.e., not a crafting bench) in Creative mode, the player will send this packet.
 
 
 
Clicking in the creative inventory menu is quite different from non-creative inventory management. Picking up an item with the mouse actually deletes the item from the server, and placing an item into a slot or dropping it out of the inventory actually tells the server to create the item from scratch. (This can be verified by clicking an item that you don't mind deleting, then severing the connection to the server; the item will be nowhere to be found when you log back in.) As a result of this implementation strategy, the "Destroy Item" slot is just a client-side implementation detail that means "I don't intend to recreate this item.". Additionally, the long listings of items (by category, etc.) are a client-side interface for choosing which item to create. Picking up an item from such listings sends no packets to the server; only when you put it somewhere does it tell the server to create the item in that location.
 
 
 
This action can be described as “set inventory slot”. Picking up an item sets the slot to item ID -1. Placing an item into an inventory slot sets the slot to the specified item. Dropping an item (by clicking outside the window) effectively sets slot -1 to the specified item, which causes the server to spawn the item entity, etc.. All other inventory slots are numbered the same as the non-creative inventory (including slots for the 2×2 crafting menu, even though they aren't visible in the vanilla client).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,264: Line 2,243:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| {{Change|0x10|0x11}}
+
  | rowspan="5"| ''protocol:''<br/><code>{{change|0x14|0x16}}</code><br/><br/>''resource:''<br/><code>edit_book</code>
  |rowspan="2"| Play
+
  | rowspan="5"| Play
  |rowspan="2"| Server
+
  | rowspan="5"| Server
 
  | Slot
 
  | Slot
  | Short
+
  | {{Type|VarInt}}
  | Inventory slot
+
  | The hotbar slot where the written book is located
 +
|-
 +
| Count
 +
| {{Type|VarInt}}
 +
| Number of elements in the following array. Maximum array size is {{change|200|100}}.
 +
|-
 +
| Entries
 +
| {{Type|Array}} ({{change|200|100}}) of {{Type|String}} ({{change|8192|1024}})
 +
| Text from each page. Maximum string length is {{change|8192|1024}} chars.
 +
|-
 +
| Has title
 +
| {{Type|Boolean}}
 +
| If true, the next field is present. true if book is being signed, false if book is being edited.
 
  |-
 
  |-
  | Clicked Item
+
  | Title
  | [[Slot Data|Slot]]
+
  | {{Type|Optional}} {{Type|String}} ({{change|128|32}})
  |  
+
  | Title of book.
 
  |}
 
  |}
  
==== Enchant Item ====
+
==== Set Player Position ====
 +
 
 +
Updates the player's XYZ position on the server.
 +
 
 +
If the player is in a vehicle, the position is ignored (but in case of [[#Set Player Position and Rotation|Set Player Position and Rotation]], the rotation is still used as normal). No validation steps other than value range clamping are performed in this case.
 +
 
 +
If the player is sleeping, the position (or rotation) is not changed, and a [[#Synchronize Player Position|Synchronize Player Position]] is sent if the received position deviated from the server's view by more than a meter.
 +
 
 +
The Notchian server silently clamps the x and z coordinates between -30,000,000 and 30,000,000, and the y coordinate between -20,000,000 and 20,000,000. A similar condition has historically caused a kick for "Illegal position"; this is no longer the case. However, infinite or NaN coordinates (or angles) still result in a kick for <code>multiplayer.disconnect.invalid_player_movement</code>.
 +
 
 +
As of 1.20.6, checking for moving too fast is achieved like this (sic):
 +
 
 +
* Each server tick, the player's current position is stored.
 +
* When the player moves, the offset from the stored position to the requested position is computed (&Delta;x, &Delta;y, &Delta;z).
 +
* The requested movement distance squared is computed as &Delta;x&sup2; + &Delta;y&sup2; + &Delta;z&sup2;.
 +
* The baseline expected movement distance squared is computed based on  the player's server-side velocity as Vx&sup2; + Vy&sup2; + Vz&sup2;. The player's server-side velocity is a somewhat ill-defined quantity that includes among other things gravity, jump velocity and knockback, but ''not'' regular horizontal movement. A proper description would bring much of Minecraft's physics engine with it. It is accessible as the <code>Motion</code> NBT tag on the player entity.
 +
* The maximum permitted movement distance squared is computed as 100 (300 if the player is using an elytra), multiplied by the number of movement packets received since the last tick, including this one, unless that value is greater than 5, in which case no multiplier is applied.
 +
* If the requested movement distance squared minus the baseline distance squared is more than the maximum squared, the player is moving too fast.
 +
 
 +
If the player is moving too fast, it is logged that "<player> moved too quickly! " followed by the change in x, y, and z, and the player is teleported back to their current (before this packet) server-side position.
 +
 
 +
Checking for block collisions is achieved like this:
 +
 
 +
* A temporary collision-checked move of the player is attempted from its current position to the requested one.
 +
* The offset from the resulting position to the requested position is computed. If the absolute value of the offset on the y axis is less than 0.5, it (only the y component) is rounded down to 0.
 +
* If the magnitude of the offset is greater than 0.25 and the player isn't in creative or spectator mode, it is logged that "<player> moved wrongly!", and the player is teleported back to their current (before this packet) server-side position.
 +
* In addition, if the player's hitbox stationary at the requested position would intersect with a block, and they aren't in spectator mode, they are teleported back without a log message.
 +
 
 +
Checking for illegal flight is achieved like this:
 +
 
 +
* When a movement packet is received, a flag indicating whether or not the player is floating mid-air is updated. The flag is set if the move test described above detected no collision below the player ''and'' the y component of the offset from the player's current position to the requested one is greater than -0.5, unless any of various conditions permitting flight (creative mode, elytra, levitation effect, etc., but not jumping) are met.
 +
* Each server tick, it is checked if the flag has been set for more than 80 consecutive ticks. If so, and the player isn't currently sleeping, dead or riding a vehicle, they are kicked for <code>multiplayer.disconnect.flying</code>.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,286: Line 2,308:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| {{Change|0x11|0x12}}
+
  | rowspan="5"| ''protocol:''<br/><code>{{change|0x1A|0x1C}}</code><br/><br/>''resource:''<br/><code>move_player_pos</code>
  |rowspan="2"| Play
+
  | rowspan="5"| Play
  |rowspan="2"| Server
+
  | rowspan="5"| Server
  | Window ID
+
  | X
  | Byte
+
  | {{Type|Double}}
  | The ID of the enchantment table window sent by [[Protocol#Open Window|Open Window]]
+
  | Absolute position.
 +
|-
 +
| Feet Y
 +
| {{Type|Double}}
 +
| Absolute feet position, normally Head Y - 1.62.
 
  |-
 
  |-
  | Enchantment
+
  | Z
  | Byte
+
  | {{Type|Double}}
  | The position of the enchantment on the enchantment table window, starting with 0 as the topmost one
+
  | Absolute position.
 +
|- {{removed}}
 +
| On Ground
 +
| {{Type|Boolean}}
 +
| True if the client is on the ground, false otherwise.
 +
|- {{added}}
 +
| Flags
 +
| {{Type|Byte}}
 +
| Bit field: 0x01: on ground, 0x02: pushing against wall.
 
  |}
 
  |}
  
==== Update Sign ====
+
==== Set Player Position and Rotation ====
  
This message is sent from the client to the server when the “Done” button is pushed after placing a sign.
+
A combination of [[#Set Player Rotation|Move Player Rotation]] and [[#Set Player Position|Move Player Position]].
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,310: Line 2,344:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| {{Change|0x12|0x13}}
+
  | rowspan="7"| ''protocol:''<br/><code>{{change|0x1B|0x1D}}</code><br/><br/>''resource:''<br/><code>move_player_pos_rot</code>
  |rowspan="5"| Play
+
  | rowspan="7"| Play
  |rowspan="5"| Server
+
  | rowspan="7"| Server
  | Location
+
  | X
  | Position
+
  | {{Type|Double}}
  | Block Coordinates
+
  | Absolute position.
 
  |-
 
  |-
  | Line 1
+
  | Feet Y
  | {{Change|[[Chat]]|String}}
+
  | {{Type|Double}}
  | First line of text in the sign
+
  | Absolute feet position, normally Head Y - 1.62.
 
  |-
 
  |-
  | Line 2
+
  | Z
  | {{Change|[[Chat]]|String}}
+
  | {{Type|Double}}
  | Second line of text in the sign
+
  | Absolute position.
 
  |-
 
  |-
  | Line 3
+
  | Yaw
  | {{Change|[[Chat]]|String}}
+
  | {{Type|Float}}
  | Third line of text in the sign
+
  | Absolute rotation on the X Axis, in degrees.
 
  |-
 
  |-
  | Line 4
+
  | Pitch
  | {{Change|[[Chat]]|String}}
+
  | {{Type|Float}}
  | Fourth line of text in the sign
+
| Absolute rotation on the Y Axis, in degrees.
 +
|- {{removed}}
 +
  | On Ground
 +
| {{Type|Boolean}}
 +
| True if the client is on the ground, false otherwise.
 +
|- {{added}}
 +
| Flags
 +
| {{Type|Byte}}
 +
| Bit field: 0x01: on ground, 0x02: pushing against wall.
 
  |}
 
  |}
  
==== Player Abilities ====
+
==== Set Player Rotation ====
 +
[[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]]
 +
[[File:Yaw.png|thumb|The unit circle of yaw, redrawn]]
 +
 
 +
Updates the direction the player is looking in.
 +
 
 +
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0,-1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
 +
 
 +
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 +
 
 +
The yaw and pitch of player (in degrees), standing at point (x0, y0, z0) and looking towards point (x, y, z) can be calculated with:
 +
 
 +
dx = x-x0
 +
dy = y-y0
 +
dz = z-z0
 +
r = sqrt( dx*dx + dy*dy + dz*dz )
 +
yaw = -atan2(dx,dz)/PI*180
 +
if yaw < 0 then
 +
    yaw = 360 + yaw
 +
pitch = -arcsin(dy/r)/PI*180
  
The latter 2 bytes are used to indicate the walking and flying speeds respectively, while the first byte is used to determine the value of 4 booleans.
+
You can get a unit vector from a given yaw/pitch via:
  
The vanilla client sends this packet when the player starts/stops flying with the second parameter changed accordingly. All other parameters are ignored by the vanilla server.
+
x = -cos(pitch) * sin(yaw)
 +
y = -sin(pitch)
 +
z =  cos(pitch) * cos(yaw)
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,348: Line 2,411:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| {{Change|0x13|0x14}}
+
  | rowspan="4"| ''protocol:''<br/><code>{{change|0x1C|0x1E}}</code><br/><br/>''resource:''<br/><code>move_player_rot</code>
  |rowspan="3"| Play
+
  | rowspan="4"| Play
  |rowspan="3"| Server
+
  | rowspan="4"| Server
 +
| Yaw
 +
| {{Type|Float}}
 +
| Absolute rotation on the X Axis, in degrees.
 +
|-
 +
| Pitch
 +
| {{Type|Float}}
 +
| Absolute rotation on the Y Axis, in degrees.
 +
|- {{removed}}
 +
| On Ground
 +
| {{Type|Boolean}}
 +
| True if the client is on the ground, false otherwise.
 +
|- {{added}}
 
  | Flags
 
  | Flags
  | Byte
+
  | {{Type|Byte}}
  | Bit mask. 0x08: damage disabled (god mode), 0x04: can fly, 0x02: is flying, 0x01: is Creative
+
  | Bit field: 0x01: on ground, 0x02: pushing against wall.
|-
 
| Flying Speed
 
| Float
 
|
 
|-
 
| Walking Speed
 
| Float
 
|
 
 
  |}
 
  |}
 +
{{Anchor|Set Player Movement Flags}}
 +
==== Set Player {{change|On Ground|Movement Flags}} ====
 +
 +
This packet as well as [[#Set Player Position|Set Player Position]], [[#Set Player Rotation|Set Player Rotation]], and [[#Set Player Position and Rotation|Set Player Position and Rotation]] are called the “serverbound movement packets”. Vanilla clients will send Move Player Position once every 20 ticks even for a stationary player.
  
==== Tab-Complete ====
+
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
  
Sent when the user presses ''tab'' while writing text.
+
When dropping from sufficient height, fall damage is applied when this state goes from false to true. The amount of damage applied is based on the point where it last changed from true to false. Note that there are several movement related packets containing this state.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,376: Line 2,447:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| {{Change|0x14|0x15}}
+
  | rowspan="2"| ''protocol:''<br/><code>{{change|0x1D|0x1F}}</code><br/><br/>''resource:''<br/><code>move_player_status_only</code>
  |rowspan="3"| Play
+
  | rowspan="2"| Play
  |rowspan="3"| Server
+
  | rowspan="2"| Server
  | Text
+
  | {{removed}} | On Ground
| String
+
  | {{removed}} | {{Type|Boolean}}
  | All text behind the cursor
+
  | {{removed}} | True if the client is on the ground, false otherwise.
|-
+
  |- {{added}}
| Has Position
+
  | Flags
  | Boolean
+
  | {{Type|Byte}}
|  
+
  | Bit field: 0x01: on ground, 0x02: pushing against wall.
  |-
 
  | Looked At Block
 
  | Optional Position
 
  | The position of the block being looked at. Only sent if Has Position is true.
 
 
  |}
 
  |}
  
==== Client Settings ====
+
==== Place Recipe ====
  
Sent when the player connects, or when settings are changed.
+
This packet is sent when a player clicks a recipe in the crafting book that is craftable (white border).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,404: Line 2,471:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| {{Change|0x15|0x16}}
+
  | rowspan="3"| ''protocol:''<br/><code>{{change|0x22|0x24}}</code><br/><br/>''resource:''<br/><code>place_recipe</code>
  |rowspan="6"| Play
+
  | rowspan="3"| Play
  |rowspan="6"| Server
+
  | rowspan="3"| Server
  | Locale
+
  | Window ID
  | String
+
  | {{Type|Byte}}
| e.g. en_GB
+
  |
|-
 
| View Distance
 
| Byte
 
  | Client-side render distance, in chunks
 
 
  |-
 
  |-
  | Chat Mode
+
  | Recipe{{change|| ID}}
  | {{Change|Byte|VarInt}} Enum
+
  | {{change|{{Type|Identifier}}|{{Type|VarInt}}}}
  | 0: enabled, 1: commands only, 2: hidden
+
  | {{change|A recipe ID.|ID of recipe previously defined in [[#Recipe Book Add|Recipe Book Add]].}}
 
  |-
 
  |-
  | Chat Colors
+
  | Make all
  | Boolean
+
  | {{Type|Boolean}}
  | “Colors” multiplayer setting
+
  | Affects the amount of items processed; true if shift is down when clicked.
|-
 
| Displayed Skin Parts
 
| Unsigned Byte
 
| Skin parts, see note below
 
|- style="background-color: #d9ead3;"
 
| Main Hand
 
| VarInt Enum
 
| 0: Left, 1: Right
 
 
  |}
 
  |}
  
''Displayed Skin Parts'' flags:
+
==== Player Input ====
 
 
* 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.
 
 
 
==== Client Status ====
 
 
 
Sent when the client is ready to complete login and when the client is ready to respawn after death.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,456: Line 2,497:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| {{Change|0x16|0x17}}
+
  | rowspan="3"| ''protocol:''<br/><code>{{change|0x26|0x28}}</code><br/><br/>''resource:''<br/><code>player_input</code>
  |rowspan="1"| Play
+
  | rowspan="3"| Play
  |rowspan="1"| Server
+
  | rowspan="3"| Server
  | Action ID
+
  | {{removed}} | Sideways
  | VarInt Enum
+
| {{removed}} | {{Type|Float}}
  | See below
+
| {{removed}} | Positive to the left of the player.
 +
|- {{removed}}
 +
| Forward
 +
| {{Type|Float}}
 +
| Positive forward.
 +
|-
 +
| Flags
 +
  | {{Type|Unsigned Byte}}
 +
  | Bit mask{{change|. 0x1: jump, 0x2: unmount.|; see below.}}
 
  |}
 
  |}
  
''Action ID'' values:
+
The flags are as follows:
  
{| class="wikitable"
+
{| class="wikitable" {{added}}
 +
|-
 +
! Hex Mask
 +
! Field
 +
|-
 +
| 0x01
 +
| Forward
 +
|-
 +
| 0x02
 +
| Backward
 +
|-
 +
| 0x04
 +
| Left
 
  |-
 
  |-
  ! Action ID
+
  | 0x08
  ! Action
+
  | Right
 
  |-
 
  |-
  | 0
+
  | 0x10
  | Perform respawn
+
  | Jump
 
  |-
 
  |-
  | 1
+
  | 0x20
  | Request stats
+
  | Sneak
 
  |-
 
  |-
  | 2
+
  | 0x40
  | {{Change|''Taking Inventory'' achievement|Open Inventory}}
+
  | Sprint
 
  |}
 
  |}
  
==== Plugin Message ====
+
==== Set Seen Recipe ====
 
 
Mods and plugins can use this to send their data. Minecraft itself uses a number of [[plugin channel]]s. These internal channels are prefixed with <code>MC|</code>.
 
 
 
More documentation on this: [http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/]
 
  
Note that the length of Data is known from the packet length, so there is no need for a length field of any kind.
+
Sent when recipe is first seen in recipe book. Replaces Recipe Book Data, type 0.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,497: Line 2,554:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| {{Change|0x17|0x18}}
+
  | ''protocol:''<br/><code>{{change|0x29|0x2B}}</code><br/><br/>''resource:''<br/><code>recipe_book_seen_recipe</code>
  |rowspan="2"| Play
+
  | Play
  |rowspan="2"| Server
+
  | Server
  | Channel
+
  | Recipe ID
  | String
+
  | {{change|{{Type|Identifier}}|{{Type|VarInt}}}}
| Name of the [[plugin channel]] used to send the data
+
  | ID of recipe previously defined in [[#Recipe Book Add|Recipe Book Add]].
|-
 
| Data
 
| Byte Array
 
  | Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].
 
 
  |}
 
  |}
  
==== Spectate ====
+
==== Use Item On ====
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
|-
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 2,519: Line 2,573:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| {{Change|0x18|0x19}}
+
  | rowspan="9"| ''protocol:''<br/><code>{{change|0x38|0x3A}}</code><br/><br/>''resource:''<br/><code>use_item_on</code>
  |rowspan="1"| Play
+
  | rowspan="9"| Play
  |rowspan="1"| Server
+
  | rowspan="9"| Server
  | Target Player
+
  | Hand
  | UUID
+
| {{Type|VarInt}} {{Type|Enum}}
  |  
+
| The hand from which the block is placed; 0: main hand, 1: off hand.
  |}
+
  |-
 
+
  | Location
==== Resource Pack Status ====
+
  | {{Type|Position}}
 
+
| Block position.
{| class="wikitable"
+
|-
  ! Packet ID
+
| Face
  ! State
+
| {{Type|VarInt}} {{Type|Enum}}
  ! Bound To
+
| The face on which the block is placed (as documented at [[#Player Action|Player Action]]).
  ! Field Name
+
|-
  ! Field Type
+
| Cursor Position X
  ! Notes
+
| {{Type|Float}}
 +
| The position of the crosshair on the block, from 0 to 1 increasing from west to east.
 +
|-
 +
| Cursor Position Y
 +
  | {{Type|Float}}
 +
  | The position of the crosshair on the block, from 0 to 1 increasing from bottom to top.
 +
  |-
 +
  | Cursor Position Z
 +
  | {{Type|Float}}
 +
  | The position of the crosshair on the block, from 0 to 1 increasing from north to south.
 
  |-
 
  |-
  |rowspan="2"| {{Change|0x19|0x1A}}
+
  | Inside block
  |rowspan="2"| Play
+
| {{Type|Boolean}}
  |rowspan="2"| Server
+
  | True when the player's head is inside of a block.
  | Hash
+
  |- {{added}}
  | String
+
  | World border hit
  | The hash sent in the [[Protocol#Resource Pack Send|Resource Pack Send]] packet.
+
  | {{Type|Boolean}}
 +
  | Seems to always be false, even when interacting with blocks around or outside the world border, or while the player is outside the border.
 
  |-
 
  |-
  | Result
+
  | Sequence
  | VarInt Enum
+
  | {{Type|VarInt}}
  | 0: successfully loaded, 1: declined, 2: failed download, 3: accepted
+
  | Block change sequence number (see [[#Acknowledge Block Change]]).
 
  |}
 
  |}
  
== Status ==
+
Upon placing a block, this packet is sent once.
 
 
=== Clientbound ===
 
 
 
No changes so far.
 
 
 
=== Serverbound ===
 
 
 
No changes so far.
 
 
 
== Login ==
 
  
=== Clientbound ===
+
The Cursor Position X/Y/Z fields (also known as in-block coordinates) are calculated using raytracing. The unit corresponds to sixteen pixels in the default resource pack. For example, let's say a slab is being placed against the south face of a full block. The Cursor Position X will be higher if the player was pointing near the right (east) edge of the face, lower if pointing near the left. The Cursor Position Y will be used to determine whether it will appear as a bottom slab (values 0.0–0.5) or as a top slab (values 0.5-1.0). The Cursor Position Z should be 1.0 since the player was looking at the southernmost part of the block.
  
No changes so far.
+
Inside block is true when a player's head (specifically eyes) are inside of a block's collision. In 1.13 and later versions, collision is rather complicated and individual blocks can have multiple collision boxes. For instance, a ring of vines has a non-colliding hole in the middle. This value is only true when the player is directly in the box. In practice, though, this value is only used by scaffolding to place in front of the player when sneaking inside of it (other blocks will place behind when you intersect with them -- try with glass for instance).
  
=== Serverbound ===
+
[[Category:Minecraft Modern]]
 
 
No changes so far.
 

Latest revision as of 11:58, 21 November 2024

This page documents the changes from release 1.21.1 (protocol 767) to the current release (1.21.3, protocol 768). The stable protocol documentation is currently lagging behind, and the changes documented here will be merged soon, once they are complete. The current pre-release (snapshot 24w44a) is not yet 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

Name Size (bytes) Encodes Notes
Teleport Flags 4 Bit field specifying how a teleportation is to be applied on each axis. See #Teleport Flags

Teleport Flags

A bit field represented as an Int, specifying how a teleportation is to be applied on each axis.

In the lower 8 bits of the bit field, a set bit means the teleportation on the corresponding axis is relative, and an unset bit that it is absolute.

Hex Mask Field
0x0001 Relative X
0x0002 Relative Y
0x0004 Relative Z
0x0008 Relative Yaw
0x0010 Relative Pitch
0x0020 Relative Velocity X
0x0040 Relative Velocity Y
0x0080 Relative Velocity Z
0x0100 Rotate velocity according to the change in rotation, before applying the velocity change in this packet. Combining this with absolute rotation works as expected—the difference in rotation is still used.

Packets

ID Packet name Documentation
Play clientbound
0x12 Close Container Current Pre
0x13 Set Container Content Current Pre
0x14 Set Container Property Current Pre
0x15 Set Container Slot Current Pre
0x17 Set Cooldown Current Pre
0x70 0x20 Teleport Entity Current Pre
0x20 0x21 Explosion Current Pre
0x23 0x24 Open Horse Screen Current Pre
0x2B 0x2C Login (play) Current Pre
0x31 Move Minecart Along Track Pre
0x37 0x39 Place Ghost Recipe Current Pre
0x3E 0x40 Player Info Update Current Pre
0x40 0x42 Synchronize Player Position Current Pre
0x41 Update Recipe Book Current
0x43 Player Rotation Pre
0x44 Recipe Book Add Pre
0x45 Recipe Book Remove Pre
0x46 Recipe Book Settings Pre
0x47 0x4C Respawn Current Pre
0x5a Set Cursor Item Pre
0x53 0x63 Set Held Item Current (unchanged)
0x66 Set Player Inventory Slot Pre
0x64 0x6b Update Time Current Pre
0x77 Synchronize Vehicle Position Pre
Play serverbound
0x02 Bundle Item Selected Pre
0x0b Client Tick End Pre
0x0E 0x10 Click Container Current Pre
0x0F 0x11 Close Container Current Pre
0x14 0x16 Edit Book Current Pre
0x1A 0x1C Set Player Position Current Pre
0x1B 0x1D Set Player Position and Rotation Current Pre
0x1C 0x1E Set Player Rotation Current Pre
0x1D Set Player On Ground Current
0x1F Set Player Movement Flags Pre
0x22 0x24 Place Recipe Current Pre
0x26 0x28 Player Input Current Pre
0x29 0x2B Set Seen Recipe Current Pre
0x38 0x3A Use Item On Current Pre

Entity Metadata

Entity Metadata Format

Painting Variant

See also: Registry Data#Painting Variant
Name Type Meaning
Width Int The width of the painting, in blocks.
Height Int The height of the painting, in blocks.
Asset ID Identifier The texture for the painting.

The Notchian client uses the corresponding asset located at textures/painting.

Has title Boolean
Title Optional Text Component The displayed title of the painting. Only present if Has title is true.
Has author Boolean
Author Optional Text Component The displayed author of the painting. Only present if Has author is true.

Registry Data

Painting Variant

The minecraft:painting_variant registry. It defines the textures and dimensions for the game's paintings.

Name Type Meaning Values
asset_id String Tag The texture for the painting.

The Notchian client uses the corresponding asset located at textures/painting.

Example: "minecraft:backyard".
height Int Tag The height of the painting, in blocks. Example: 2
width Int Tag The width of the painting, in blocks.
title Compound Tag or String Tag The displayed title of the painting. See Text formatting. Example: {"color": "gray", "translate": "painting.minecraft.skeleton.title"}
author Compound Tag or String Tag The displayed author of the painting. See Text formatting. Example: {"color": "gray", "translate": "painting.minecraft.skeleton.author"}

Slot Data

Structured components

Type Name Description Data
6 minecraft:item_model Item's model. As follows:
Name Type Description
Model Identifier
20 21 minecraft:food Makes the item consumable restore the player's hunger bar when consumed. As follows:
Name Type Description
Nutrition VarInt Non-negative
Saturation Modifier Float How much saturation will be given after consuming the item.
Can Always Eat Boolean Whether the item can always be eaten, even at full hunger.
Seconds To Eat Float How long it takes to consume the item.
Using converts to Slot Data This specifies the item produced after consuming the current item. In the Notchian server, this is used for stews, which turn into bowls. Set this to Air if the item should be consumed normally without leaving any other item after.
Number of effects VarInt Number of elements in the following array.
Effect Type ID Array Potion Effect The potion effect. See Potion Effect.
Probability Float The probability for this effect to be chosen.
22 minecraft:consumable Makes the item consumable. As follows:
Name Type Description
Consume seconds Float How long it takes to consume the item.
Animation VarInt Enum 0: none, 1: eat, 2: drink, 3: block, 4: bow, 5: spear, 6: crossbow, 7: spyglass, 8: toot_horn, 9: brush
Sound ID or Sound Event ID in the minecraft:sound_event registry, or an inline definition.
Has consume particles Boolean
Number of effects VarInt Number of elements in the following array.
Effects Array of Consume Effect Effects to apply on consumption. See Consume Effect.
23 minecraft:use_remainder This specifies the item produced after using the current item. In the Notchian server, this is used for stews, which turn into bowls. As follows:
Name Type Description
Remainder Slot
24 minecraft:use_cooldown Cooldown to apply on use of the item. As follows:
Name Type Description
Seconds Float
Cooldown group Optional Identifier Group of items to apply the cooldown to. Only present if Has cooldown group is true; otherwise defaults to the item's identifier.
21 25 minecraft:fire damage_resistant Marks this item as fire damage resistant.
The client won't render the item as being on-fire if this component is present.
None. As follows:
Name Type Description
Types Identifier Tag specifying damage types the item is immune to. Not prefixed by '#'!.
27 minecraft:enchantable Allows the item to be enchanted by an enchanting table. As follows:
Name Type Description
Value VarInt Opaque internal value controlling how expensive enchantments may be offered.
28 minecraft:equippable Allows the item to be equipped by the player. As follows:
Name Type Description
Slot VarInt Enum 0: mainhand, 1: feet, 2: legs, 3: chest, 4: head, 5: offhand, 6: body
Equip sound ID or Sound Event ID in the minecraft:sound_event registry, or an inline definition.
Has model Boolean
Model Optional Identifier Only present if Has model is true.
Has camera overlay Boolean
Camera overlay Optional Identifier Only present if Has camera overlay is true.
Has allowed entities Boolean
Allowed entities Optional ID Set IDs in the minecraft:entity_type registry. Only present if Has allowed entities is true.
Dispensable Boolean
Swappable Boolean
Damage on hurt Boolean
29 minecraft:repairable Items that can be combined with this item in an anvil to repair it. As follows:
Name Type Description
Items ID Set IDs in the minecraft:item registry.
30 minecraft:glider Makes the item function like elytra. None.
31 minecraft:tooltip_style Custom textures for the item tooltip. As follows:
Name Type Description
Style Identifier
32 minecraft:death_protection Makes the item function like a totem of undying. As follows:
Name Type Description
Number of effects VarInt Number of elements in the following array.
Effects Array of Consume Effect Effects to apply on consumption. See Consume Effect.
31 41 minecraft:potion_contents Visual and effects of a potion item. As follows:
Name Type Description
Has Potion ID Boolean Whether this potion has an ID in the potion registry. If true, it has the default effects associated with the potion type.
Potion ID Optional VarInt The ID of the potion type in the potion registry. Only present if Has Potion ID is true.
Has Custom Color Boolean Whether this potion has a custom color. If false, it uses the default color associated with the potion type.
Custom Color Optional Int The RGB components of the color, encoded as an integer. Only present if Has Custom Color is true.
Number Of Custom Effects VarInt The number of elements in the following array.
Custom Effects Array of Potion Effect Any custom effects the potion might have. See Potion Effect.
Custom Name String

Other types

Consume Effect

WIP

Instrument

Name Type Description
Sound Event Id or Sound Event The sound to be played.
Use duration VarInt Float The maximum range of the sound.
Range Float The range of the instrument.
Description Text Component Description shown in the item tooltip.

Particles

Particle Name Particle ID Data
minecraft:dust 13
Field Name Field Type Meaning
Red Float The red RGB value, between 0 and 1. Divide actual RGB value by 255.
Green Float The green RGB value, between 0 and 1. Divide actual RGB value by 255.
Blue Float The blue RGB value, between 0 and 1. Divide actual RGB value by 255.
Color Int The color, encoded as 0xRRGGBB; top bits are ignored.
Scale Float The scale, will be clamped between 0.01 and 4.
minecraft:dust_color_transition 14
Field Name Field Type Meaning
From Red Float The start red RGB value, between 0 and 1. Divide actual RGB value by 255.
From Green Float The start green RGB value, between 0 and 1. Divide actual RGB value by 255.
From Blue Float The start blue RGB value, between 0 and 1. Divide actual RGB value by 255.
From Color Int The start color, encoded as 0xRRGGBB; top bits are ignored.
To Red Float The end red RGB value, between 0 and 1. Divide actual RGB value by 255.
To Green Float The end green RGB value, between 0 and 1. Divide actual RGB value by 255.
To Blue Float The end blue RGB value, between 0 and 1. Divide actual RGB value by 255.
To Color Int The end color, encoded as 0xRRGGBB; top bits are ignored.
Scale Float The scale, will be clamped between 0.01 and 4.

Handshake

No changes so far.

Status

No changes so far.

Login

No changes so far.

Configuration

No changes so far.

Play

Clientbound

Close Container

This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open. The notchian client disregards the provided window ID and closes any active window.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x12

resource:
container_close
Play Client Window ID Unsigned Byte VarInt This is the ID of the window that was closed. 0 for inventory.

Set Container Content

The inventory slots

Replaces the contents of a container window. Sent by the server upon initialization of a container window or the player's inventory, and in response to state ID mismatches (see #Click Container).

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x13

resource:
container_set_content
Play Client Window ID Unsigned Byte VarInt The ID of window which items are being sent for. 0 for player inventory. The client ignores any packets targeting a Window ID other than the current one. However, an exception is made for the player inventory, which may be targeted at any time. (The Notchian server does not appear to utilize this special case.)
State ID VarInt A server-managed sequence number used to avoid desynchronization; see #Click Container.
Count VarInt Number of elements in the following array.
Slot Data Array of Slot
Carried Item Slot Item being dragged with the mouse.

See inventory windows for further information about how slots are indexed. Use Open Screen to open the container on the client.

Set Container Property

This packet is used to inform the client that part of a GUI window should be updated.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x14

resource:
container_set_data
Play Client Window ID Unsigned Byte VarInt
Property Short The property to be updated, see below.
Value Short The new value for the property, see below.

The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.

Window type Property Value
Furnace 0: Fire icon (fuel left) counting from fuel burn time down to 0 (in-game ticks)
1: Maximum fuel burn time fuel burn time or 0 (in-game ticks)
2: Progress arrow counting from 0 to maximum progress (in-game ticks)
3: Maximum progress always 200 on the notchian server
Enchantment Table 0: Level requirement for top enchantment slot The enchantment's xp level requirement
1: Level requirement for middle enchantment slot
2: Level requirement for bottom enchantment slot
3: The enchantment seed Used for drawing the enchantment names (in SGA) clientside. The same seed is used to calculate enchantments, but some of the data isn't sent to the client to prevent easily guessing the entire list (the seed value here is the regular seed bitwise and 0xFFFFFFF0).
4: Enchantment ID shown on mouse hover over top enchantment slot The enchantment id (set to -1 to hide it), see below for values
5: Enchantment ID shown on mouse hover over middle enchantment slot
6: Enchantment ID shown on mouse hover over bottom enchantment slot
7: Enchantment level shown on mouse hover over the top slot The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
8: Enchantment level shown on mouse hover over the middle slot
9: Enchantment level shown on mouse hover over the bottom slot
Beacon 0: Power level 0-4, controls what effect buttons are enabled
1: First potion effect Potion effect ID for the first effect, or -1 if no effect
2: Second potion effect Potion effect ID for the second effect, or -1 if no effect
Anvil 0: Repair cost The repair's cost in xp levels
Brewing Stand 0: Brew time 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
1: Fuel time 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
Stonecutter 0: Selected recipe The index of the selected recipe. -1 means none is selected.
Loom 0: Selected pattern The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern.
Lectern 0: Page number The current page number, starting from 0.

For an enchanting table, the following numerical IDs are used:

Numerical ID Enchantment ID Enchantment Name
0 minecraft:protection Protection
1 minecraft:fire_protection Fire Protection
2 minecraft:feather_falling Feather Falling
3 minecraft:blast_protection Blast Protection
4 minecraft:projectile_protection Projectile Protection
5 minecraft:respiration Respiration
6 minecraft:aqua_affinity Aqua Affinity
7 minecraft:thorns Thorns
8 minecraft:depth_strider Depth Strider
9 minecraft:frost_walker Frost Walker
10 minecraft:binding_curse Curse of Binding
11 minecraft:soul_speed Soul Speed
12 minecraft:swift_sneak Swift Sneak
13 minecraft:sharpness Sharpness
14 minecraft:smite Smite
15 minecraft:bane_of_arthropods Bane of Arthropods
16 minecraft:knockback Knockback
17 minecraft:fire_aspect Fire Aspect
18 minecraft:looting Looting
19 minecraft:sweeping_edge Sweeping Edge
20 minecraft:efficiency Efficiency
21 minecraft:silk_touch Silk Touch
22 minecraft:unbreaking Unbreaking
23 minecraft:fortune Fortune
24 minecraft:power Power
25 minecraft:punch Punch
26 minecraft:flame Flame
27 minecraft:infinity Infinity
28 minecraft:luck_of_the_sea Luck of the Sea
29 minecraft:lure Lure
30 minecraft:loyalty Loyalty
31 minecraft:impaling Impaling
32 minecraft:riptide Riptide
33 minecraft:channeling Channeling
34 minecraft:multishot Multishot
35 minecraft:quick_charge Quick Charge
36 minecraft:piercing Piercing
37 minecraft:density Density
38 minecraft:breach Breach
39 minecraft:wind_burst Wind Burst
40 minecraft:mending Mending
41 minecraft:vanishing_curse Curse of Vanishing

Set Container Slot

Sent by the server when an item in a slot (in a window) is added/removed.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x15

resource:
container_set_slot
Play Client Window ID Unsigned Byte VarInt The window which is being updated. 0 for player inventory. The client ignores any packets targeting a Window ID other than the current one; see below for exceptions , unless it is 0 (see below).
State ID VarInt A server-managed sequence number used to avoid desynchronization; see #Click Container.
Slot Short The slot that should be updated.
Slot Data Slot

If Window ID is 0, the hotbar and offhand slots (slots 36 through 45) may be updated even when a different container window is open. (The Notchian server does not appear to utilize this special case.) Updates are also restricted to those slots when the player is looking at a creative inventory tab other than the survival inventory. (The Notchian server does not handle this restriction in any way, leading to MC-242392.)

If Window ID is -1, the item being dragged with the mouse is set. In this case, State ID and Slot are ignored.

If Window ID is -2, any slot in the player's inventory can be updated irrespective of the current container window. In this case, State ID is ignored, and the Notchian server uses a bogus value of 0. Used by the Notchian server to implement the #Pick Item functionality.

When a container window is open, the server never sends updates targeting Window ID 0—all of the window types include slots for the player inventory. The client must automatically apply changes targeting the inventory portion of a container window to the main inventory; the server does not resend them for ID 0 when the window is closed. However, since the armor and offhand slots are only present on ID 0, updates to those slots occurring while a window is open must be deferred by the server until the window's closure.

Set Cooldown

Applies a cooldown period to all items with the given type. Used by the Notchian server with enderpearls. This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing).

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x17

resource:
cooldown
Play Client Item ID Cooldown Group VarInt Identifier Numeric ID of the item Group of items to apply a cooldown to.
Cooldown Ticks VarInt Number of ticks to apply a cooldown for, or 0 to clear the cooldown.

Teleport Entity

Warning.png The Mojang-specified name of this packet was changed in 1.21.2 from teleport_entity to entity_position_sync. There is a new teleport_entity, which this document more appropriately calls Synchronize Vehicle Position. That packet has a different function and will lead to confusing results if used in place of this one.

This packet is sent by the server when an entity moves more than 8 blocks.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x70 0x20

resource:
teleport_entity entity_position_sync
Play Client Entity ID VarInt
X Double
Y Double
Z Double
Velocity X Double
Velocity Y Double
Velocity Z Double
Yaw Angle Float Rotation on the X axis, in degrees.
Pitch Angle Float Rotation on the Y axis, in degrees.
On Ground Boolean

Explosion

Sent when an explosion occurs (creepers, TNT, and ghast fireballs).

Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x20 0x21

resource:
explode
Play Client X Double
Y Double
Z Double
Strength Float If the strength is greater or equal to 2.0, or the block interaction is not 0 (keep), large explosion particles are used. Otherwise, small explosion particles are used.
Record Count VarInt Number of elements in the following array.
Records Array of (Byte, Byte, Byte) Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
Has Player Motion Boolean
Player Motion X Float Optional Double X velocity of the player being pushed by the explosion. Only present if Has Player Motion is true.
Player Motion Y Float Optional Double Y velocity of the player being pushed by the explosion. Only present if Has Player Motion is true.
Player Motion Z Float Optional Double Z velocity of the player being pushed by the explosion. Only present if Has Player Motion is true.
Block Interaction VarInt Enum 0 = keep, 1 = destroy, 2 = destroy_with_decay, 3 = trigger_block.
Small Explosion Particle ID VarInt The particle ID listed in Particles.
Small Explosion Particle Data Varies Particle data as specified in Particles.
Large Explosion Particle ID VarInt The particle ID listed in Particles.
Large Explosion Particle Data Varies Particle data as specified in Particles.
Explosion Sound ID or Sound Event ID in the minecraft:sound_event registry, or an inline definition.

Open Horse Screen

This packet is used exclusively for opening the horse GUI. Open Screen is used for all other GUIs. The client will not open the inventory if the Entity ID does not point to an horse-like animal.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x23

resource:
horse_screen_open
Play Client Window ID Unsigned Byte VarInt
Slot count VarInt
Entity ID Int

Login (play)

Huh.png The following information needs to be added to this page:
Although the number of portal cooldown ticks is included in this packet, the whole portal usage process is still dictated entirely by the server. What kind of effect does this value have on the client, if any?

See Protocol Encryption for information on logging in.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x2B 0x2C

resource:
login
Play Client Entity ID Int The player's Entity ID (EID).
Is hardcore Boolean
Dimension Count VarInt Size of the following array.
Dimension Names Array of Identifier Identifiers for all dimensions on the server.
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.
Do limited crafting Boolean Whether players can only craft recipes they have already unlocked. Currently unused by the client.
Dimension Type VarInt The ID of the type of dimension in the minecraft:dimension_type registry, defined by the Registry Data packet.
Dimension Name Identifier Name of the dimension 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
Game mode Unsigned Byte 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
Previous Game mode Byte -1: Undefined (null), 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. The previous game mode. Vanilla client uses this for the debug (F3 + N & F3 + F4) game mode switch. (More information needed)
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.
Has death location Boolean If true, then the next two fields are present.
Death dimension name Optional Identifier Name of the dimension the player died in.
Death location Optional Position The location that the player died at.
Portal cooldown VarInt The number of ticks until the player can use the portal again.
Sea level VarInt
Enforces Secure Chat Boolean

Move Minecart Along Track

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x31

resource:
move_minecart_along_track
Play Client Entity ID VarInt
Step Count VarInt Number of elements in the following array.
Steps X Array Double
Y Double
Z Double
Velocity X Double
Velocity Y Double
Velocity Z Double
Yaw Angle
Pitch Angle
Weight Float

Player Info Update

Sent by the server to update the user list (<tab> in the client).

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x3E 0x40

resource:
player_info_update
Play Client Actions Byte Determines what actions are present.
Number Of Players VarInt Number of elements in the following array.
Players UUID Array UUID The player UUID
Player Actions Array of Player Actions The length of this array is determined by the number of Player Actions that give a non-zero value when applying its mask to the actions flag. For example given the decimal number 5, binary 00000101. The masks 0x01 and 0x04 would return a non-zero value, meaning the Player Actions array would include two actions: Add Player and Update Game Mode.
Player Actions
Action Mask Field Name Type Notes
Add Player 0x01 Name String (16)
Number Of Properties VarInt Number of elements in the following array.
Property Name Array String (32767)
Value String (32767)
Is Signed Boolean
Signature Optional String (32767) Only if Is Signed is true.
Initialize Chat 0x02 Has Signature Data Boolean
Chat session ID UUID Only sent if Has Signature Data is true.
Public key expiry time Long Key expiry time, as a UNIX timestamp in milliseconds. Only sent if Has Signature Data is true.
Encoded public key size VarInt Size of the following array. Only sent if Has Signature Data is true. Maximum length is 512 bytes.
Encoded public key Byte Array (512) The player's public key, in bytes. Only sent if Has Signature Data is true.
Public key signature size VarInt Size of the following array. Only sent if Has Signature Data is true. Maximum length is 4096 bytes.
Public key signature Byte Array (4096) The public key's digital signature. Only sent if Has Signature Data is true.
Update Game Mode 0x04 Game Mode VarInt
Update Listed 0x08 Listed Boolean Whether the player should be listed on the player list.
Update Latency 0x10 Ping VarInt Measured in milliseconds.
Update Display Name 0x20 Has Display Name Boolean
Display Name Optional Text Component Only sent if Has Display Name is true.
Update List Priority 0x40 Priority VarInt See below.

The properties included in this packet are the same as in Login Success, for the current player.

Ping values correspond with icons in the following way:

  • A ping that negative (i.e. not known to the server yet) will result in the no connection icon.
  • A ping under 150 milliseconds will result in 5 bars
  • A ping under 300 milliseconds will result in 4 bars
  • A ping under 600 milliseconds will result in 3 bars
  • A ping under 1000 milliseconds (1 second) will result in 2 bars
  • A ping greater than or equal to 1 second will result in 1 bar.

The order of players in the player list is determined as follows:

  • Players with higher priorities are sorted before those with lower priorities.
  • Among players of equal priorities, spectators are sorted after non-spectators.
  • Within each of those groups, players are sorted into teams. The teams are ordered case-sensitively by team name in ascending order. Players with no team are listed first.
  • The players of each team (and non-team) are sorted case-insensitively by name in ascending order.

Synchronize Player Position

Teleports the client, e.g. during login, when using an ender pearl, in response to invalid move packets, etc.

Due to latency, the server may receive outdated movement packets sent before the client was aware of the teleport. To account for this, the server ignores all movement packets from the client until a Confirm Teleportation packet with an ID matching the one sent in the teleport packet is received.

Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360 (see MC-90097).

Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x40 0x42

resource:
player_position
Play Client Teleport ID VarInt Client should confirm this packet with Confirm Teleportation containing the same Teleport ID.
X Double Absolute or relative position, depending on Flags.
Y Double Absolute or relative position, depending on Flags.
Z Double Absolute or relative position, depending on Flags.
Velocity X Double
Velocity Y Double
Velocity Z Double
Yaw Float Absolute or relative rotation on the X axis, in degrees.
Pitch Float Absolute or relative rotation on the Y axis, in degrees.
Flags Byte Teleport Flags Reference the Flags table below. When the value of the this byte masked is zero the field is absolute, otherwise relative.
Teleport ID VarInt Client should confirm this packet with Confirm Teleportation containing the same Teleport ID.

Player Rotation

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x43

resource:
player_rotation
Play Client Yaw Float Rotation on the X axis, in degrees.
Pitch Float Rotation on the Y axis, in degrees.

Place Ghost Recipe

Response to the serverbound packet (Place Recipe), with the same recipe ID. Appears to be used to notify the UI.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x37 0x39

resource:
place_ghost_recipe
Play Client Window ID Byte VarInt
Recipe Identifier A recipe ID.
Recipe Display ID VarInt ID in the minecraft:recipe_display registry.
Recipe Data Varies Depends on Recipe Type; see below.

below

Recipe Book Add

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x44

resource:
recipe_book_add
Play Client Recipe Count VarInt Number of elements in the following array.
Recipes Recipe ID Array VarInt ID to assign to the recipe.
Display ID VarInt ID in the minecraft:recipe_display registry.
Group ID VarInt
Category ID VarInt ID in the minecraft:recipe_book_category registry.
Has Ingredients Boolean
Ingredient Count Optional VarInt Number of elements in the following array. Only present if Has Ingredients is true.
Ingredients Optional Array of ID Set IDs in the minecraft:item registry, or an inline definition. Only present if Has Ingredients is true.
Flags Byte 0x01: show notification; 0x02: highlight as new
Replace Boolean Replace or Add to known recipes

Recipe Book Remove

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x45

resource:
recipe_book_remove
Play Client Recipe Count VarInt Number of elements in the following array.
Recipes Array of VarInt IDs of recipes to remove.

Recipe Book Settings

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x46

resource:
recipe_book_settings
Play Client Crafting Recipe Book Open Boolean If true, then the crafting recipe book will be open when the player opens its inventory.
Crafting Recipe Book Filter Active Boolean If true, then the filtering option is active when the players opens its inventory.
Smelting Recipe Book Open Boolean If true, then the smelting recipe book will be open when the player opens its inventory.
Smelting Recipe Book Filter Active Boolean If true, then the filtering option is active when the players opens its inventory.
Blast Furnace Recipe Book Open Boolean If true, then the blast furnace recipe book will be open when the player opens its inventory.
Blast Furnace Recipe Book Filter Active Boolean If true, then the filtering option is active when the players opens its inventory.
Smoker Recipe Book Open Boolean If true, then the smoker recipe book will be open when the player opens its inventory.
Smoker Recipe Book Filter Active Boolean If true, then the filtering option is active when the players opens its inventory.

Respawn

Huh.png The following information needs to be added to this page:
Although the number of portal cooldown ticks is included in this packet, the whole portal usage process is still dictated entirely by the server. What kind of effect does this value have on the client, if any?

To change the player's dimension (overworld/nether/end), send them a respawn packet with the appropriate dimension, followed by prechunks/chunks for the new dimension, and finally a position and look packet. You do not need to unload chunks, the client will do it automatically.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x47 0x4C

resource:
respawn
Play Client Dimension Type VarInt The ID of type of dimension in the minecraft:dimension_type registry, defined by the Registry Data packet.
Dimension Name Identifier Name of the dimension 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
Game mode Unsigned Byte 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
Previous Game mode Byte -1: Undefined (null), 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. The previous game mode. Vanilla client uses this for the debug (F3 + N & F3 + F4) game mode switch. (More information needed)
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.
Has death location Boolean If true, then the next two fields are present.
Death dimension Name Optional Identifier Name of the dimension the player died in.
Death location Optional Position The location that the player died at.
Portal cooldown VarInt The number of ticks until the player can use the portal again.
Sea level VarInt
Data kept Byte Bit mask. 0x01: Keep attributes, 0x02: Keep metadata. Tells which data should be kept on the client side once the player has respawned.

In the Notchian implementation, this is context dependent:

  • normal respawns (after death) keep no data;
  • exiting the end poem/credits keeps the attributes;
  • other dimension changes (portals or teleports) keep all data.

Warning.png Avoid changing player's dimension to same dimension they were already in unless they are dead. If you change the dimension to one they are already in, weird bugs can occur, such as the player being unable to attack other players in new world (until they die and respawn).

Before 1.16, if you must respawn a player in the same dimension without killing them, send two respawn packets, one to a different world and then another to the world you want. You do not need to complete the first respawn; it only matters that you send two packets.

Set Cursor Item

Packet ID State Bound To Field Name Field Type Notes
0x5A Play Client Slot Data Slot

Update Time

Time is based on ticks, where 20 ticks happen every second. There are 24000 ticks in a day, making Minecraft days exactly 20 minutes long.

The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.

The default SMP server increments the time by 20 every second.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x64 0x6B

resource:
set_time
Play Client World Age Long In ticks; not changed by server commands.
Time of day Long The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time.
Time of day increasing Boolean If true, the client should automatically advance the time of day according to its ticking rate.

Set Player Inventory Slot

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x66

resource:
set_player_inventory
Play Client Slot VarInt
Slot Data Slot

Synchronize Vehicle Position

Teleports the entity on the client without changing the reference point of movement deltas in future Update Entity Position packets. Seems to be used to make relative adjustments to vehicle positions; more information needed.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x77

resource:
teleport_entity
Play Client Entity ID VarInt
X Double
Y Double
Z Double
Velocity X Double
Velocity Y Double
Velocity Z Double
Yaw Float Rotation on the Y axis, in degrees.
Pitch Float Rotation on the Y axis, in degrees.
Flags Teleport Flags
On Ground Boolean

Serverbound

Bundle Item Selected

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x02

resource:
bundle_item_selected
Play Server Slot of Bundle VarInt
Slot in Bundle VarInt

Client Tick End

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x0B

resource:
client_tick_end
Play Server no fields

Click Container

This packet is sent by the client when the player clicks on a slot in a window.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x0E 0x10

resource:
container_click
Play Server Window ID Unsigned Byte VarInt The ID of the window which was clicked. 0 for player inventory. The server ignores any packets targeting a Window ID other than the current one, including ignoring 0 when any other window is open.
State ID VarInt The last received State ID from either a Set Container Slot or a Set Container Content packet.
Slot Short The clicked slot number, see below.
Button Byte The button used in the click, see below.
Mode VarInt Enum Inventory operation mode, see below.
Length of the array VarInt Maximum value for Notchian server is 128 slots.
Array of changed slots Slot number Array (128) Short
Slot data Slot New data for this slot, in the client's opinion; see below.
Carried item Slot Item carried by the cursor. Has to be empty (item ID = -1) for drop mode, otherwise nothing will happen.

See Inventory for further information about how slots are indexed.

After performing the action, the server compares the results to the slot change information included in the packet, as applied on top of the server's view of the container's state prior to the action. For any slots that do not match, it sends Set Container Slot packets containing the correct results. If State ID does not match the last ID sent by the server, it will instead send a full Set Container Content to resynchronize the client.

When right-clicking on a stack of items, half the stack will be picked up and half left in the slot. If the stack is an odd number, the half left in the slot will be smaller of the amounts.

The distinct type of click performed by the client is determined by the combination of the Mode and Button fields.

Mode Button Slot Trigger
0 0 Normal Left mouse click
1 Normal Right mouse click
0 -999 Left click outside inventory (drop cursor stack)
1 -999 Right click outside inventory (drop cursor single item)
1 0 Normal Shift + left mouse click
1 Normal Shift + right mouse click (identical behavior)
2 0 Normal Number key 1
1 Normal Number key 2
2 Normal Number key 3
8 Normal Number key 9
Button is used as the slot index (impossible in vanilla clients)
40 Normal Offhand swap key F
3 2 Normal Middle click, only defined for creative players in non-player inventories.
4 0 Normal* Drop key (Q) (* Clicked item is always empty)
1 Normal* Control + Drop key (Q) (* Clicked item is always empty)
5 0 -999 Starting left mouse drag
4 -999 Starting right mouse drag
8 -999 Starting middle mouse drag, only defined for creative players in non-player inventories.
1 Normal Add slot for left-mouse drag
5 Normal Add slot for right-mouse drag
9 Normal Add slot for middle-mouse drag, only defined for creative players in non-player inventories.
2 -999 Ending left mouse drag
6 -999 Ending right mouse drag
10 -999 Ending middle mouse drag, only defined for creative players in non-player inventories.
6 0 Normal Double click
1 Normal Pickup all but check items in reverse order (impossible in vanilla clients)

Starting from version 1.5, “painting mode” is available for use in inventory windows. It is done by picking up stack of something (more than 1 item), then holding mouse button (left, right or middle) and dragging held stack over empty (or same type in case of right button) slots. In that case client sends the following to server after mouse button release (omitting first pickup packet which is sent as usual):

  1. packet with mode 5, slot -999, button (0 for left | 4 for right);
  2. packet for every slot painted on, mode is still 5, button (1 | 5);
  3. packet with mode 5, slot -999, button (2 | 6);

If any of the painting packets other than the “progress” ones are sent out of order (for example, a start, some slots, then another start; or a left-click in the middle) the painting status will be reset.

Close Container

This packet is sent by the client when closing a window.

Notchian clients send a Close Window packet with Window ID 0 to close their inventory even though there is never an Open Screen packet for the inventory.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x0F 0x11

resource:
container_close
Play Server Window ID Unsigned Byte VarInt This is the ID of the window that was closed. 0 for player inventory.

Edit Book

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x14 0x16

resource:
edit_book
Play Server Slot VarInt The hotbar slot where the written book is located
Count VarInt Number of elements in the following array. Maximum array size is 200 100.
Entries Array (200 100) of String (8192 1024) Text from each page. Maximum string length is 8192 1024 chars.
Has title Boolean If true, the next field is present. true if book is being signed, false if book is being edited.
Title Optional String (128 32) Title of book.

Set Player Position

Updates the player's XYZ position on the server.

If the player is in a vehicle, the position is ignored (but in case of Set Player Position and Rotation, the rotation is still used as normal). No validation steps other than value range clamping are performed in this case.

If the player is sleeping, the position (or rotation) is not changed, and a Synchronize Player Position is sent if the received position deviated from the server's view by more than a meter.

The Notchian server silently clamps the x and z coordinates between -30,000,000 and 30,000,000, and the y coordinate between -20,000,000 and 20,000,000. A similar condition has historically caused a kick for "Illegal position"; this is no longer the case. However, infinite or NaN coordinates (or angles) still result in a kick for multiplayer.disconnect.invalid_player_movement.

As of 1.20.6, checking for moving too fast is achieved like this (sic):

  • Each server tick, the player's current position is stored.
  • When the player moves, the offset from the stored position to the requested position is computed (Δx, Δy, Δz).
  • The requested movement distance squared is computed as Δx² + Δy² + Δz².
  • The baseline expected movement distance squared is computed based on the player's server-side velocity as Vx² + Vy² + Vz². The player's server-side velocity is a somewhat ill-defined quantity that includes among other things gravity, jump velocity and knockback, but not regular horizontal movement. A proper description would bring much of Minecraft's physics engine with it. It is accessible as the Motion NBT tag on the player entity.
  • The maximum permitted movement distance squared is computed as 100 (300 if the player is using an elytra), multiplied by the number of movement packets received since the last tick, including this one, unless that value is greater than 5, in which case no multiplier is applied.
  • If the requested movement distance squared minus the baseline distance squared is more than the maximum squared, the player is moving too fast.

If the player is moving too fast, it is logged that "<player> moved too quickly! " followed by the change in x, y, and z, and the player is teleported back to their current (before this packet) server-side position.

Checking for block collisions is achieved like this:

  • A temporary collision-checked move of the player is attempted from its current position to the requested one.
  • The offset from the resulting position to the requested position is computed. If the absolute value of the offset on the y axis is less than 0.5, it (only the y component) is rounded down to 0.
  • If the magnitude of the offset is greater than 0.25 and the player isn't in creative or spectator mode, it is logged that "<player> moved wrongly!", and the player is teleported back to their current (before this packet) server-side position.
  • In addition, if the player's hitbox stationary at the requested position would intersect with a block, and they aren't in spectator mode, they are teleported back without a log message.

Checking for illegal flight is achieved like this:

  • When a movement packet is received, a flag indicating whether or not the player is floating mid-air is updated. The flag is set if the move test described above detected no collision below the player and the y component of the offset from the player's current position to the requested one is greater than -0.5, unless any of various conditions permitting flight (creative mode, elytra, levitation effect, etc., but not jumping) are met.
  • Each server tick, it is checked if the flag has been set for more than 80 consecutive ticks. If so, and the player isn't currently sleeping, dead or riding a vehicle, they are kicked for multiplayer.disconnect.flying.
Packet ID State Bound To Field Name Field Type Notes
protocol:
0x1A 0x1C

resource:
move_player_pos
Play Server X Double Absolute position.
Feet Y Double Absolute feet position, normally Head Y - 1.62.
Z Double Absolute position.
On Ground Boolean True if the client is on the ground, false otherwise.
Flags Byte Bit field: 0x01: on ground, 0x02: pushing against wall.

Set Player Position and Rotation

A combination of Move Player Rotation and Move Player Position.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x1B 0x1D

resource:
move_player_pos_rot
Play Server X Double Absolute position.
Feet Y Double Absolute feet position, normally Head Y - 1.62.
Z Double Absolute position.
Yaw Float Absolute rotation on the X Axis, in degrees.
Pitch Float Absolute rotation on the Y Axis, in degrees.
On Ground Boolean True if the client is on the ground, false otherwise.
Flags Byte Bit field: 0x01: on ground, 0x02: pushing against wall.

Set Player Rotation

The unit circle for yaw
The unit circle of yaw, redrawn

Updates the direction the player is looking in.

Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0,-1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.

Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.

The yaw and pitch of player (in degrees), standing at point (x0, y0, z0) and looking towards point (x, y, z) can be calculated with:

dx = x-x0
dy = y-y0
dz = z-z0
r = sqrt( dx*dx + dy*dy + dz*dz )
yaw = -atan2(dx,dz)/PI*180
if yaw < 0 then
    yaw = 360 + yaw
pitch = -arcsin(dy/r)/PI*180

You can get a unit vector from a given yaw/pitch via:

x = -cos(pitch) * sin(yaw)
y = -sin(pitch)
z =  cos(pitch) * cos(yaw)
Packet ID State Bound To Field Name Field Type Notes
protocol:
0x1C 0x1E

resource:
move_player_rot
Play Server Yaw Float Absolute rotation on the X Axis, in degrees.
Pitch Float Absolute rotation on the Y Axis, in degrees.
On Ground Boolean True if the client is on the ground, false otherwise.
Flags Byte Bit field: 0x01: on ground, 0x02: pushing against wall.

Set Player On Ground Movement Flags

This packet as well as Set Player Position, Set Player Rotation, and Set Player Position and Rotation are called the “serverbound movement packets”. Vanilla clients will send Move Player Position once every 20 ticks even for a stationary player.

This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).

When dropping from sufficient height, fall damage is applied when this state goes from false to true. The amount of damage applied is based on the point where it last changed from true to false. Note that there are several movement related packets containing this state.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x1D 0x1F

resource:
move_player_status_only
Play Server On Ground Boolean True if the client is on the ground, false otherwise.
Flags Byte Bit field: 0x01: on ground, 0x02: pushing against wall.

Place Recipe

This packet is sent when a player clicks a recipe in the crafting book that is craftable (white border).

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x22 0x24

resource:
place_recipe
Play Server Window ID Byte
Recipe ID Identifier VarInt A recipe ID. ID of recipe previously defined in Recipe Book Add.
Make all Boolean Affects the amount of items processed; true if shift is down when clicked.

Player Input

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x26 0x28

resource:
player_input
Play Server Sideways Float Positive to the left of the player.
Forward Float Positive forward.
Flags Unsigned Byte Bit mask. 0x1: jump, 0x2: unmount. ; see below.

The flags are as follows:

Hex Mask Field
0x01 Forward
0x02 Backward
0x04 Left
0x08 Right
0x10 Jump
0x20 Sneak
0x40 Sprint

Set Seen Recipe

Sent when recipe is first seen in recipe book. Replaces Recipe Book Data, type 0.

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x29 0x2B

resource:
recipe_book_seen_recipe
Play Server Recipe ID Identifier VarInt ID of recipe previously defined in Recipe Book Add.

Use Item On

Packet ID State Bound To Field Name Field Type Notes
protocol:
0x38 0x3A

resource:
use_item_on
Play Server Hand VarInt Enum The hand from which the block is placed; 0: main hand, 1: off hand.
Location Position Block position.
Face VarInt Enum The face on which the block is placed (as documented at Player Action).
Cursor Position X Float The position of the crosshair on the block, from 0 to 1 increasing from west to east.
Cursor Position Y Float The position of the crosshair on the block, from 0 to 1 increasing from bottom to top.
Cursor Position Z Float The position of the crosshair on the block, from 0 to 1 increasing from north to south.
Inside block Boolean True when the player's head is inside of a block.
World border hit Boolean Seems to always be false, even when interacting with blocks around or outside the world border, or while the player is outside the border.
Sequence VarInt Block change sequence number (see #Acknowledge Block Change).

Upon placing a block, this packet is sent once.

The Cursor Position X/Y/Z fields (also known as in-block coordinates) are calculated using raytracing. The unit corresponds to sixteen pixels in the default resource pack. For example, let's say a slab is being placed against the south face of a full block. The Cursor Position X will be higher if the player was pointing near the right (east) edge of the face, lower if pointing near the left. The Cursor Position Y will be used to determine whether it will appear as a bottom slab (values 0.0–0.5) or as a top slab (values 0.5-1.0). The Cursor Position Z should be 1.0 since the player was looking at the southernmost part of the block.

Inside block is true when a player's head (specifically eyes) are inside of a block's collision. In 1.13 and later versions, collision is rather complicated and individual blocks can have multiple collision boxes. For instance, a ring of vines has a non-colliding hole in the middle. This value is only true when the player is directly in the box. In practice, though, this value is only used by scaffolding to place in front of the player when sneaking inside of it (other blocks will place behind when you intersect with them -- try with glass for instance).