Difference between revisions of "Pre-release protocol"

From wiki.vg
Jump to navigation Jump to search
(→‎Item Meta Data: tried to make this section a lot clearer)
 
 
Line 1: Line 1:
This page documents the changes from the [[Protocol|last stable Minecraft release]] (currently 1.2.5) to the current pre-release (or weekly release).
+
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.
  
== New packets ==
+
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.
  
=== Map Chunk Bulk (0x38) ===
+
== Contents ==
  
To reduce the number of bytes this packet is used to send chunk columns together for better compression results. The packet contains up to 100 chunk columns (later this might be reduced to 50).
+
<div style="float:right;">__TOC__</div>
  
The data part is a zlib compressed byte array containing the chunk data. The meta data part specifies which chunks in which order the data part exists of.
+
=== Data types ===
  
To split this packet into chunks you need to uncompress the data array. Then you can iterate through the data part. Each part is 10240 * n + 256 bytes. n is the number of chunks in the current chunk column(this is the number of flags set in the primary bitmap). 10240 is the amount of bytes for each chunk without add bitmap, 256 bytes are used for biomes. The second short in the meta data part is not yet in use. It could specify if the chunk uses the add bitmap part, because it has very high block ids, but not in the current snapshot.  
+
{| class="wikitable"
 +
|-
 +
! Name
 +
! Size (bytes)
 +
! Encodes
 +
! Notes
 +
|- {{added}}
 +
! id=Type:Teleport_Flags | {{Type|Teleport Flags}}
 +
| 4
 +
| See [[#Teleport Flags]]
 +
| Bit field specifying how a teleportation is to be applied on each axis.
 +
|- {{added}}
 +
! id=Type:Recipe_Display | {{Type|Recipe Display}}
 +
| Varies
 +
| See [[Recipes#Recipe Display structure]]
 +
| Description of a recipe for use for use by the client.
 +
|}
 +
 
 +
==== Teleport Flags ====
 +
 
 +
A bit field represented as an {{Type|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.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Hex Mask
 +
! Field
 +
|-
 +
| 0x0001
 +
| Relative X
 +
|-
 +
| 0x0002
 +
| Relative Y
 +
|-
 +
| 0x0004
 +
| Relative Z
 +
|-
 +
| 0x0008
 +
| Relative Yaw
 +
|-
 +
| 0x0010
 +
| Relative Pitch
 +
|- {{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"
 
{| class="wikitable"
|- class="row0"
+
! ID
! class="col0" | Packet ID
+
! Packet name
! class="col1" | Field Name
+
!colspan="2"| Documentation
! class="col2" | Field Type
+
|-
! class="col3" | Example
+
!colspan="4"| Play clientbound
! class="col4" | Notes
+
{{PacketList|0x12|Close Container}}
|- class="row1"
+
{{PacketList|0x13|Set Container Content}}
| class="col0 centeralign" rowspan=5 | 0x38
+
{{PacketList|0x14|Set Container Property}}
| class="col1 centeralign" | Chunk Column Count
+
{{PacketList|0x15|Set Container Slot}}
| class="col2 centeralign" | short
+
{{PacketList|0x17|Set Cooldown}}
| class="col3 centeralign" |  
+
{{PacketList|{{change|0x70|0x20}}|Teleport Entity}}
| class="col4" | The number of chunk columns in this packet
+
{{PacketList|{{change|0x20|0x21}}|Explosion}}
|- class="row2"
+
{{PacketList|{{change|0x23|0x24}}|Open Horse Screen}}
| class="col1 centeralign" | Chunk data size
+
{{PacketList|{{change|0x2B|0x2C}}|Login (play)}}
| class="col2 centeralign" | int
+
{{PacketList|0x31|Move Minecart Along Track|rel=added}}
| class="col3 centeralign" |  
+
{{PacketList|{{change|0x37|0x39}}|Place Ghost Recipe}}
| class="col4" | the size of the data field
+
{{PacketList|{{change|0x3E|0x40}}|Player Info Update}}
|- class="row3"
+
{{PacketList|{{change|0x40|0x42}}|Synchronize Player Position}}
| class="col1 centeralign" | Data
+
{{PacketList|0x41|Update Recipe Book|pre=removed}}
| class="col2 centeralign" | byte array
+
{{PacketList|0x43|Player Rotation|rel=added}}
| class="col3 centeralign" |  
+
{{PacketList|0x44|Recipe Book Add|rel=added}}
| class="col4" | compressed chunk data
+
{{PacketList|0x45|Recipe Book Remove|rel=added}}
|- class="row4"
+
{{PacketList|0x46|Recipe Book Settings|rel=added}}
| class="col1 centeralign" | meta information
+
{{PacketList|{{change|0x47|0x4C}}|Respawn}}
| class="col2 centeralign" | chunk bulk meta information
+
{{PacketList|0x5a|Set Cursor Item|rel=added}}
| class="col3 centeralign" |
+
{{PacketList|{{change|0x53|0x63}}|Set Held Item|pre=unchanged}}
| class="col4 centeralign" | Chunk column count times the Meta information structure (See notes for details)
+
{{PacketList|0x66|Set Player Inventory Slot|rel=added}}
|- class="row5"
+
{{PacketList|{{change|0x64|0x6b}}|Update Time}}
! class="col0" | Total Size:
+
{{PacketList|0x77|Synchronize Vehicle Position|rel=added}}
| class="col1 rightalign" colspan="4" | 7 + (Chunk data size) + 12 * (Chunk Column Count) bytes
+
{{PacketList|{{change|0x77|0x7e}}|Update Recipes}}
|}
+
|-
 +
!colspan="4"| Play serverbound
 +
{{PacketList|0x02|Bundle Item Selected|rel=added}}
 +
{{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}}
 +
|}
 +
 
 +
== Entity Metadata ==
 +
 
 +
=== Entity Metadata Format ===
 +
 
 +
==== Painting Variant ====
 +
 
 +
{{See also|Registry Data#Painting Variant}}
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Meaning
 +
|-
 +
| Width
 +
| {{Type|Int}}
 +
| The width of the painting, in blocks.
 +
|-
 +
| Height
 +
| {{Type|Int}}
 +
| The height of the painting, in blocks.
 +
|-
 +
| Asset ID
 +
| {{Type|Identifier}}
 +
| The texture for the painting.
 +
The Notchian client uses the corresponding asset located at
 +
<code>textures/painting</code>.
 +
|- {{added}}
 +
| Has title
 +
| {{Type|Boolean}}
 +
|
 +
|- {{added}}
 +
| Title
 +
| {{Type|Optional}} {{Type|Text Component}}
 +
| The displayed title of the painting. Only present if Has title is true.
 +
|- {{added}}
 +
| Has author
 +
| {{Type|Boolean}}
 +
|
 +
|- {{added}}
 +
| Author
 +
| {{Type|Optional}} {{Type|Text Component}}
 +
| The displayed author of the painting. Only present if Has author is true.
 +
|}
 +
 
 +
== Registry Data ==
 +
 
 +
=== Painting Variant ===
 +
 
 +
The <code>minecraft:painting_variant</code> registry. It defines the textures and dimensions for the game's paintings.
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Meaning
 +
! Values
 +
|-
 +
| asset_id
 +
| [[NBT#Specification:string_tag|String Tag]]
 +
| The texture for the painting.
 +
The Notchian client uses the corresponding asset located at
 +
<code>textures/painting</code>.
 +
| Example: "minecraft:backyard".
 +
|-
 +
| height
 +
| [[NBT#Specification:int_tag|Int Tag]]
 +
| The height of the painting, in blocks.
 +
| Example: <code>2</code>
 +
|-
 +
| width
 +
| [[NBT#Specification:int_tag|Int Tag]]
 +
| 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"
 +
! Type
 +
! Name
 +
! Description
 +
! style="width: 50%" | Data
 +
|- {{added}}
 +
| 6
 +
| <code>minecraft:item_model</code>
 +
| Item's model.
 +
| As follows:
 +
  {| class="wikitable" {{added}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Model
 +
    | {{Type|Identifier}}
 +
    |
 +
    |}
 +
|-
 +
| {{change|20|21}}
 +
| <code>minecraft:food</code>
 +
| Makes the item {{change|consumable|restore the player's hunger bar when consumed}}.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Nutrition
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Non-negative
 +
    |-
 +
    | 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.
 +
    |}
 +
|-
 +
| {{change|21|25}}
 +
| <code>minecraft:{{change|fire|damage}}_resistant</code>
 +
| 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]].
 +
    |}
 +
|-
 +
| {{change|31|41}}
 +
| <code>minecraft:potion_contents</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"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Sound Event
 +
| {{Type|Id or}} {{Type|Sound Event}}
 +
| The sound to be played.
 +
|-
 +
| Use duration
 +
| {{change|{{Type|VarInt}}|{{Type|Float}}}}
 +
| The maximum range of the sound.
 +
|-
 +
| Range
 +
| {{Type|Float}}
 +
| The range of the instrument.
 +
|- {{added}}
 +
| Description
 +
| {{Type|Text Component}}
 +
| Description shown in the item tooltip.
 +
|}
 +
 
 +
== Particles ==
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Particle Name
 +
! Particle ID
 +
! Data
 +
|-
 +
| <code>minecraft:dust</code>
 +
| 13
 +
|
 +
{| 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
 +
|
 +
{| class="wikitable"
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Meaning
 +
  |- {{removed}}
 +
  | From Red
 +
  | {{Type|Float}}
 +
  | The start red RGB value, between 0 and 1. Divide actual RGB value by 255.
 +
  |- {{removed}}
 +
  | From Green
 +
  | {{Type|Float}}
 +
  | The start green RGB value, between 0 and 1. Divide actual RGB value by 255.
 +
  |- {{removed}}
 +
  | From Blue
 +
  | {{Type|Float}}
 +
  | The start blue RGB value, between 0 and 1. Divide actual RGB value by 255.
 +
  |- {{added}}
 +
  | From Color
 +
  | {{Type|Int}}
 +
  | The start color, encoded as 0xRRGGBB; top bits are ignored.
 +
  |- {{removed}}
 +
  | To Red
 +
  | {{Type|Float}}
 +
  | The end red RGB value, between 0 and 1. Divide actual RGB value by 255.
 +
  |- {{removed}}
 +
  | To Green
 +
  | {{Type|Float}}
 +
  | The end green RGB value, between 0 and 1. Divide actual RGB value by 255.
 +
  |- {{removed}}
 +
  | To Blue
 +
  | {{Type|Float}}
 +
  | The end blue RGB value, between 0 and 1. Divide actual RGB value by 255.
 +
  |- {{added}}
 +
  | To Color
 +
  | {{Type|Int}}
 +
  | The end color, encoded as 0xRRGGBB; top bits are ignored.
 +
  |-
 +
  | Scale
 +
  | {{Type|Float}}
 +
  | The scale, will be clamped between 0.01 and 4.
 +
  |}
 +
|}
 +
 
 +
== Recipes ==
 +
 
 +
(this is meant to become a new page.)
 +
 
 +
=== Recipe Display structure ===
  
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Recipe Display Type
 +
| {{Type|VarInt}}
 +
| ID in the <code>minecraft:recipe_display</code> registry.
 +
|-
 +
| Data
 +
| Varies
 +
| See [[#Recipe Display types]] below.
 +
|}
  
====Chunk Bulk Meta Information Structure====
+
==== Recipe Display types ====
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! ID
! class="col1" | Field Name
+
! Name
! class="col2" | Field Type
+
! Data
! class="col3" | Example
+
|-
! class="col4" | Notes
+
| 0
|- class="row1"
+
| <code>minecraft:crafting_shapeless</code>
| class="col1 centeralign" | Chunk Column X
+
| [[#minecraft:crafting_shapeless|data]]
| class="col2 centeralign" | int
+
|-
| class="col3 centeralign" | 10
+
| 1
| class="col4" | The X coordinate of the specific chunk column
+
| <code>minecraft:crafting_shaped</code>
|- class="row2"
+
| [[#minecraft:crafting_shaped|data]]
| class="col1 centeralign" | Chunk Column Z
+
|-
| class="col2 centeralign" | int
+
| 2
| class="col3 centeralign" | 10
+
| <code>minecraft:furnace</code>
| class="col4" | The Z coordinate of the specific chunk column
+
| [[#minecraft:furnace|data]]
|- class="row3"
+
|-
| class="col1 centeralign" | Chunk Primary bitmap
+
| 3
| class="col2 centeralign" | short
+
| <code>minecraft:stonecutter</code>
| class="col3 centeralign" | 15
+
| [[#minecraft:stonecutter|data]]
| class="col4" | A bitmap which specifies which chunk is not empty in this chunk column
+
|-
|- class="row4"
+
| 4
| class="col1 centeralign" | Chunk Add bitmap?
+
| <code>minecraft:smithing</code>
| class="col2 centeralign" | short
+
| [[#minecraft:smithing|data]]
| class="col3 centeralign" | 0
+
|}
| class="col4" | A bitmap which specifies which chunk need add information because of very high block ids. not yet used. needs verification
+
 
|- class="row5"
+
===== <code>minecraft:crafting_shapeless</code> =====
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="3" | 12 bytes
 
|}
 
  
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Ingredient Count
 +
| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|-
 +
| Ingredients
 +
| {{Type|Array}} of [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Result
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Crafting Station
 +
| [[#Slot Display structure|Slot Display]]
 +
| Crafting station icon to display in the recipe notification.
 +
|}
  
=== Tab-complete (0xCB) ===
+
===== <code>minecraft:crafting_shaped</code> =====
  
''Two-way''
+
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Width
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Height
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Ingredient Count
 +
| {{Type|VarInt}}
 +
| Number of elements in the following array. Always equal to Width * Height.
 +
|-
 +
| Ingredients
 +
| {{Type|Array}} of [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Result
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Crafting Station
 +
| [[#Slot Display structure|Slot Display]]
 +
| Crafting station icon to display in the recipe notification.
 +
|}
  
Sent C->S when the user presses [tab] while writing text. The payload contains all text behind the cursor.
+
===== <code>minecraft:furnace</code> =====
  
The server responds with an auto-completion of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported.
+
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Ingredient
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Fuel
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Result
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Crafting Station
 +
| [[#Slot Display structure|Slot Display]]
 +
| Crafting station icon to display in the recipe notification.
 +
|-
 +
| Cooking Time
 +
| {{Type|VarInt}}
 +
| Time to smelt in a regular furnace, in ticks.
 +
|-
 +
| Experience
 +
| {{Type|Float}}
 +
|
 +
|}
  
In the event of more than one possible completion, the server responds with the options packed into the single string field, separated by a null character. Note that as strings are UTF-16, this is two bytes wide.
+
===== <code>minecraft:stonecutter</code> =====
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Name
! class="col0" | Packet ID
+
! Type
! class="col1" | Field Name
+
! Description
! class="col2" | Field Type
+
|-
! class="col3" | Example
+
| Ingredient
! class="col4" | Notes
+
| [[#Slot Display structure|Slot Display]]
|- class="row1"
+
|
| class="col0 centeralign" | 0xCB
+
|-
| class="col1 centeralign" | Text
+
| Result
| class="col2 centeralign" | string
+
| [[#Slot Display structure|Slot Display]]
| class="col3 centeralign" |  
+
|
| class="col4" |  
+
|-
|- class="row3"
+
| Crafting Station
! class="col0" | Total Size:
+
| [[#Slot Display structure|Slot Display]]
| class="col1 rightalign" colspan="4" | 3 bytes + length of string
+
| Crafting station icon to display in the recipe notification.
|}
+
|}
  
=== Locale and View Distance (0xCC) ===
+
===== <code>minecraft:smithing</code> =====
  
''Client to server''
+
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Template
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Base
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Addition
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Result
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Crafting Station
 +
| [[#Slot Display structure|Slot Display]]
 +
| Crafting station icon to display in the recipe notification.
 +
|}
  
Sent when the player connects, or when settings are changed.
+
=== Slot Display structure ===
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Name
! class="col0" | Packet ID
+
! Type
! class="col1" | Field Name
+
! Description
! class="col2" | Field Type
+
|-
! class="col3" | Example
+
| Slot Display Type
! class="col4" | Notes
+
| {{Type|VarInt}}
|- class="row1"
+
| ID in the <code>minecraft:slot_display</code> registry.
| class="col0 centeralign" rowspan="4" | 0xCC
+
|-
| class="col1 centeralign" | Locale
+
| Data
| class="col2 centeralign" | string
+
| Varies
| class="col3 centeralign" | en_GB
+
| See [[#Slot Display types]] below.
|- class="row2"
+
|}
| class="col1 centeralign" | View distance
 
| class="col2 centeralign" | byte
 
| class="col3 centeralign" | 0
 
| class="col4" | 0-3 for 'far', 'normal', 'short', 'tiny'.
 
|- class="row3"
 
| class="col1 centeralign" | Chat flags
 
| class="col2 centeralign" | byte
 
| class="col3 centeralign" | 8
 
| class="col4" | Chat settings. See notes below.
 
|- class="row4"
 
| class="col1 centeralign" | Difficulty
 
| class="col2 centeralign" | byte
 
| class="col3 centeralign" | 0
 
| class="col4 centeralign" | Client-side difficulty from options.txt
 
|- class="row5"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 8 bytes + length of string
 
|}
 
  
Chat flags has several values packed into one byte.
+
==== Slot Display types ====
  
'''Chat Enabled:''' Bits 0-1. 00: Enabled. 01: Commands only. 10: Hidden.
+
{| class="wikitable"
 +
! ID
 +
! Name
 +
! Data
 +
|-
 +
| 0
 +
| <code>minecraft:empty</code>
 +
| no data
 +
|-
 +
| 1
 +
| <code>minecraft:any_fuel</code>
 +
  | no data
 +
|-
 +
| 2
 +
| <code>minecraft:item</code>
 +
  | [[#minecraft:item|data]]
 +
|-
 +
| 3
 +
| <code>minecraft:item_stack</code>
 +
| [[#minecraft:item_stack|data]]
 +
|-
 +
| 4
 +
| <code>minecraft:tag</code>
 +
| [[#minecraft:tag|data]]
 +
|-
 +
| 5
 +
| <code>minecraft:smithing_trim</code>
 +
| [[#minecraft:smithing_trim|data]]
 +
|-
 +
| 6
 +
| <code>minecraft:with_remainder</code>
 +
| [[#minecraft:with_remainder|data]]
 +
|-
 +
| 7
 +
| <code>minecraft:composite</code>
 +
| [[#minecraft:composite|data]]
 +
|}
  
'''Colors Enabled:''' Bit 3.  0: Disabled.  1: Enabled.
+
===== <code>minecraft:item</code> =====
  
=== Client Statuses (0xCD) ===
 
  
''Client to server''
+
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Item Type
 +
| {{Type|VarInt}}
 +
| ID in the <code>minecraft:item</code> registry.
 +
|}
  
Sent when the client is ready to complete login and when the client is ready to respawn after death.
+
===== <code>minecraft:item_stack</code> =====
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Name
! class="col0" | Packet ID
+
! Type
! class="col1" | Field Name
+
! Description
! class="col2" | Field Type
+
|-
! class="col3" | Example
+
| Item Stack
! class="col4" | Notes
+
| {{Type|Slot}}
|- class="row1"
+
|
| class="col0 centeralign" rowspan="1" | 0xCD
+
|}
| class="col1 centeralign" | Payload
 
| class="col2 centeralign" | byte
 
| class="col3 centeralign" | 0
 
| class="col4" | Bit field. 0: Initial spawn, 1: Respawn after death
 
|- class="row2"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="5" | 2 bytes
 
|}
 
  
=== Encryption Key Response (0xFC) ===
+
===== <code>minecraft:tag</code> =====
  
''Two-Way''
+
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Tag
 +
| {{Type|Identifier}}
 +
| Tag in the <code>minecraft:item</code> registry. Not prefixed by '#'!.
 +
|}
  
See [[Protocol Encryption]] for information on this packet.
+
===== <code>minecraft:smithing_trim</code> =====
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Name
! class="col0" | Packet ID
+
! Type
! class="col1" | Field Name
+
! Description
! class="col2" | Field Type
+
|-
! class="col3" | Example
+
| Base
! class="col4" | Notes
+
| [[#Slot Display structure|Slot Display]]
|- class="row1"
+
|
| class="col0 centeralign" rowspan="4" | 0xFC
+
|-
| class="col1 centeralign" | Shared secret length
+
| Material
| class="col2 centeralign" | short
+
| [[#Slot Display structure|Slot Display]]
| class="col3 centeralign" |
+
|
| class="col4 centeralign" |  
+
|-
|- class="row2"
+
| Pattern
| class="col1 centeralign" | Shared secret
+
| [[#Slot Display structure|Slot Display]]
| class="col2 centeralign" | byte array
+
|
| class="col3 centeralign" |
+
  |}
| class="col4 centeralign" |
 
|- class="row3"
 
| class="col1 centeralign" | Verify token length
 
| class="col2 centeralign" | short
 
| class="col3 centeralign" |  
 
| class="col4 centeralign" |  
 
|- class="row4"
 
| class="col1 centeralign" | Verify token response
 
| class="col2 centeralign" | byte array
 
| class="col3 centeralign" |
 
| class="col4 centeralign" |
 
|- class="row5"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 5 bytes + length of shared secret + length of token
 
|}
 
  
=== Encryption Key Request (0xFD) ===
+
===== <code>minecraft:with_remainder</code> =====
  
''Server to client''
+
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Ingredient
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|-
 +
| Remainder
 +
| [[#Slot Display structure|Slot Display]]
 +
|
 +
|}
  
See [[Protocol Encryption]] for information on this packet.
+
===== <code>minecraft:composite</code> =====
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Name
! class="col0" | Packet ID
+
! Type
! class="col1" | Field Name
+
! Description
! class="col2" | Field Type
+
|-
! class="col3" | Example
+
| Option Count
! class="col4" | Notes
+
| {{Type|VarInt}}
|- class="row1"
+
| Number of elements in the following array.
| class="col0 centeralign" rowspan="5" | 0xFD
+
|-
| class="col1 centeralign" | Server id
+
| Options
| class="col2 centeralign" | string
+
| {{Type|Array}} of [[#Slot Display structure|Slot Display]]
| class="col3 centeralign" |
+
|
| class="col4 centeralign" |
+
|}
|- class="row2"
+
 
| class="col1 centeralign" | Public key length
+
== Handshake ==
| class="col2 centeralign" | short
+
 
| class="col3 centeralign" |
+
No changes so far.
| class="col4 centeralign" |
+
 
|- class="row3"
+
== Status ==
| class="col1 centeralign" | Public key
+
 
| class="col2 centeralign" | byte array
+
No changes so far.
| class="col3 centeralign" |
+
 
| class="col4 centeralign" |
+
== Login ==
|- class="row4"
 
| class="col1 centeralign" | Verify token length
 
| class="col2 centeralign" | short
 
| class="col3 centeralign" |
 
| class="col4 centeralign" |
 
|- class="row4"
 
| class="col1 centeralign" | Verify token
 
| class="col2 centeralign" | byte array
 
| class="col3 centeralign" |
 
| class="col4 centeralign" |
 
|- class="row5"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 7 bytes + length of string + length of key + length of token
 
|}
 
  
 +
No changes so far.
  
 +
== Configuration ==
  
 +
No changes so far.
  
 +
== Play ==
  
=== Named Sound Effect (0x3E) ===
+
=== Clientbound ===
  
''Server to client''
+
==== Close Container ====
  
Used to play a sound effect on the client.
+
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"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="6" | 0x3E
+
| ''protocol:''<br/><code>0x12</code><br/><br/>''resource:''<br/><code>container_close</code>
| class="col1 centeralign" | Sound name
+
| Play
| class="col2 centeralign" | string
+
| Client
| class="col3 centeralign" | step.grass
+
| Window ID
| class="col4 centeralign" | 250
+
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
|- class="row2"
+
| This is the ID of the window that was closed. 0 for inventory.
| class="col1 centeralign" | Effect position X
+
|}
| class="col2 centeralign" | int
+
 
| class="col3 centeralign" | 250
+
==== Set Container Content ====
| class="col4 centeralign" | effect X multiplied by 8
+
[[File:Inventory-slots.png|thumb|The inventory slots]]
|- class="row3"
 
| class="col1 centeralign" | Effect position Y
 
| class="col2 centeralign" | int
 
| class="col3 centeralign" | 250
 
| class="col4 centeralign" | effect Y multiplied with 8
 
|- class="row4"
 
| class="col1 centeralign" | Effect position Z
 
| class="col2 centeralign" | int
 
| class="col3 centeralign" | 250
 
| class="col4 centeralign" | effect Z multiplied with 8
 
|- class="row5"
 
| class="col1 centeralign" | Volume
 
| class="col2 centeralign" | float
 
| class="col3 centeralign" | 9
 
| class="col4 centeralign" | 1 is 100%, can be more
 
|- class="row6"
 
| class="col1 centeralign" | Pitch
 
| class="col2 centeralign" | byte
 
| class="col3 centeralign" | 1
 
| class="col4 centeralign" | 63 is 100%, can be more
 
|- class="row7"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 20 bytes + length of string
 
|}
 
  
=== Block Break Animation (0x37) ===
+
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"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan=5 | 0x37
+
| rowspan="5"| ''protocol:''<br/><code>0x13</code><br/><br/>''resource:''<br/><code>container_set_content</code>
| class="col1 centeralign" | EID?
+
| rowspan="5"| Play
| class="col2 centeralign" | int
+
| rowspan="5"| Client
| class="col3 centeralign" |  
+
| Window ID
| class="col4" | Entity breaking the block?
+
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
|- class="row2"
+
| 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.)
| class="col1 centeralign" | X
+
|-
| class="col2 centeralign" | int
+
| State ID
| class="col3 centeralign" |
+
| {{Type|VarInt}}
| class="col4" rowspan=3 | Block position
+
| A server-managed sequence number used to avoid desynchronization; see [[#Click Container]].
|- class="row2"
+
|-
| class="col1 centeralign" | Y
+
| Count
| class="col2 centeralign" | int
+
| {{Type|VarInt}}
| class="col3 centeralign" |
+
| Number of elements in the following array.
|- class="row2"
+
|-
| class="col1 centeralign" | Z
+
| Slot Data
| class="col2 centeralign" | int
+
| {{Type|Array}} of [[Slot Data|Slot]]
| class="col3 centeralign" |
+
|-
|- class="row3"
+
| Carried Item
| class="col1 centeralign" | Unknown
+
| {{Type|Slot}}
| class="col2 centeralign" | byte
+
| Item being dragged with the mouse.
| class="col3 centeralign" | 1
+
|}
| class="col4" | ?
 
|- class="row2"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 4 bytes
 
|}
 
  
== Changed Data Type ==
+
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.
  
=== Item Meta Data for slots ===
+
==== Set Container Property ====
  
Parsing or encoding of [[Slot Data]] no longer requires a list of all enchantable item IDs.  Every slot transmitted now includes a short that indicates the length of the NBT data.  As before, a length of -1 means there is no NBT data.
+
This packet is used to inform the client that part of a GUI window should be updated.
  
This change affects any packets with [[Slot Data]], including:
+
{| class="wikitable"
* 0x0F (Player Block Placement)
+
! Packet ID
* 0x66 (Window click codec)
+
! State
* 0x6B (Creative Inventory Action)
+
! Bound To
* 0x68 (Set Window Items)
+
! Field Name
* 0x05 (Entity Equipment)
+
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="3"| ''protocol:''<br/><code>0x14</code><br/><br/>''resource:''<br/><code>container_set_data</code>
 +
| rowspan="3"| Play
 +
| rowspan="3"| Client
 +
| Window ID
 +
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
 +
|
 +
|-
 +
| Property
 +
| {{Type|Short}}
 +
| The property to be updated, see below.
 +
|-
 +
| Value
 +
| {{Type|Short}}
 +
| The new value for the property, see below.
 +
|}
  
== Changed packets ==
+
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.
  
=== Login Request (0x01) ===
+
{| class="wikitable"
 +
|-
 +
! Window type
 +
! Property
 +
! Value
 +
|-
 +
| rowspan="4"| 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
 +
|-
 +
| rowspan="10"| Enchantment Table
 +
| 0: Level requirement for top enchantment slot
 +
| rowspan="3"| 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 [[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>).
 +
|-
 +
| 4: Enchantment ID shown on mouse hover over top enchantment slot
 +
| rowspan="3"| 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
 +
| rowspan="3"| 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
 +
|-
 +
| rowspan="3"| Beacon
 +
| 0: Power level
 +
| 0-4, controls what effect buttons are enabled
 +
|-
 +
| 1: First potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
 +
|-
 +
| 2: Second potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
 +
|-
 +
| Anvil
 +
| 0: Repair cost
 +
| The repair's cost in xp levels
 +
|-
 +
| rowspan="2"| 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.
 +
|}
  
''Two-Way''
+
For an enchanting table, the following numerical IDs are used:
  
See [[Protocol Encryption]] for information on logging in.
+
{| class="wikitable"
 +
! 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
 +
|}
  
'''Client to Server'''
+
==== Set Container Slot ====
  
Just 1 byte C->S
+
Sent by the server when an item in a slot (in a window) is added/removed.
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
|- class="row1"
+
! Bound To
| class="col0 centeralign" | 0x01
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="4"| ''protocol:''<br/><code>0x15</code><br/><br/>''resource:''<br/><code>container_set_slot</code>
 +
| rowspan="4"| Play
 +
| rowspan="4"| Client
 +
| Window ID
 +
| {{change|{{Type|Unsigned Byte}}|{{Type|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{{change|; see below for exceptions|, unless it is 0 (see below)}}.
 +
|-
 +
| State ID
 +
| {{Type|VarInt}}
 +
| A server-managed sequence number used to avoid desynchronization; see [[#Click Container]].
 +
|-
 +
| Slot
 +
| {{Type|Short}}
 +
| The slot that should be updated.
 +
|-
 +
| Slot Data
 +
| {{Type|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 [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 ====
  
'''Server to Client'''
+
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"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-  
| class="col0 centeralign" rowspan="7" | 0x01
+
| rowspan="2"| ''protocol:''<br/><code>0x17</code><br/><br/>''resource:''<br/><code>cooldown</code>
| class="col1 centeralign" | Entity ID
+
| rowspan="2"| Play
| class="col2 centeralign" | int
+
| rowspan="2"| Client
| class="col3 centeralign" | <code>1298</code>
+
| {{change|Item ID|Cooldown Group}}
| class="col4" | The Players Entity ID
+
| {{change|{{Type|VarInt}}|{{Type|Identifier}}}}
|- class="row2"
+
| {{change|Numeric ID of the item|Group of items}} to apply a cooldown to.
| class="col0 centeralign" | Level Type
+
|-
| class="col1 centeralign" | string
+
| Cooldown Ticks
| class="col2 centeralign" | default
+
| {{Type|VarInt}}
| class="col3" | default or SUPERFLAT; level-type in server.properties
+
| Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
|- class="row3"
+
|}
| class="col0 centeralign" | Server mode
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" | <code>0</code>
 
| class="col3" | 0 for survival, 1 for creative
 
|- class="row4"
 
| class="col0 centeralign" | Dimension
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" | <code>0</code>
 
| class="col3" | <code>-1</code>: The Nether, <code>0</code>: The Overworld, <code>1</code>: The End
 
|- class="row5"
 
| class="col0 centeralign" | Difficulty
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" | <code>1</code>
 
| class="col3" | <code>0</code> thru <code>3</code> for Peaceful, Easy, Normal, Hard
 
|- class="row6"
 
| class="col0 centeralign" | Not used
 
| class="col1 centeralign" | unsigned byte
 
| class="col2 centeralign" | <code>0</code>
 
| class="col3" | Only 0 observed from vanilla server, was previously world height
 
|- class="row7"
 
| class="col0 centeralign" | Max players
 
| class="col1 centeralign" | unsigned byte
 
| class="col2 centeralign" | <code>8</code>
 
| class="col3" | Used by the client to draw the player list
 
|- class="row8"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 12 bytes + length of strings
 
|}
 
  
=== Handshake (0x02) ===
+
==== Teleport Entity ====
  
''Client to server''
+
{{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.}}}}
  
See [[Protocol Encryption]] for information on logging in.
+
This packet is sent by the server when an entity moves more than 8 blocks.
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="4" | 0x02
+
| rowspan="10"| ''protocol:''<br/><code>{{change|0x70|0x20}}</code><br/><br/>''resource:''<br/><code>{{change|teleport_entity|entity_position_sync}}</code>
| class="col1 centeralign" | Protocol Version
+
| rowspan="10"| Play
| class="col2 centeralign" | byte
+
| rowspan="10"| Client
| class="col3 centeralign" | <code>38</code>
+
| Entity ID
| class="col4" |  
+
| {{Type|VarInt}}
|- class="row2"
+
|
| class="col1 centeralign" | Username
+
|-
| class="col2 centeralign" | string
+
| X
| class="col3 centeralign" | <code>TkTech</code>
+
| {{Type|Double}}
| class="col4" | The username of the player attempting to connect
+
|  
|- class="row3"
+
|-
| class="col1 centeralign" | Server Host
+
| Y
| class="col2 centeralign" | string
+
| {{Type|Double}}
| class="col3 centeralign" | <code>localhost</code>
+
|
| class="col4" |  
+
|-
|- class="row4"
+
| Z
| class="col1 centeralign" | Server Port
+
| {{Type|Double}}
| class="col2 centeralign" | int
+
|
| class="col3 centeralign" | <code>25565</code>
+
|- {{added}}
| class="col4" |  
+
| Velocity X
|- class="row5"
+
| {{Type|Double}}
! class="col0" | Total Size:
+
|
| class="col1 rightalign" colspan="4" | 10 bytes + length of strings
+
|- {{added}}
 +
| Velocity Y
 +
| {{Type|Double}}
 +
|
 +
|- {{added}}
 +
| Velocity Z
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Yaw
 +
| {{change|{{Type|Angle}}|{{Type|Float}}}}
 +
| Rotation on the X axis, in degrees.
 +
|-
 +
| Pitch
 +
| {{change|{{Type|Angle}}|{{Type|Float}}}}
 +
| Rotation on the Y axis, in degrees.
 +
|-
 +
| On Ground
 +
| {{Type|Boolean}}
 +
|
 
|}
 
|}
  
=== Entity Equipment (0x05) ===
+
==== Explosion ====
 +
 
 +
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
  
''Server to Client''
+
{{change|Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x|}}
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! colspan="2" | Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="3" | 0x05
+
| rowspan="16"| ''protocol:''<br/><code>{{change|0x20|0x21}}</code><br/><br/>''resource:''<br/><code>explode</code>
| class="col1 centeralign" | Entity ID
+
| rowspan="16"| Play
| class="col2 centeralign" | int
+
| rowspan="16"| Client
| class="col3 centeralign" | 0x00010643
+
| X
| class="col4" | Named Entity ID
+
| {{Type|Double}}
|- class="row2"
+
|
| class="col0 centeralign" | Slot
+
|-
| class="col1 centeralign" | short
+
| Y
| class="col2 centeralign" | 4
+
| {{Type|Double}}
| class="col3" | Equipment slot: 0=held, 1-4=armor slot
+
|
|- class="row3"
+
|-
| class="col0 centeralign" | Item
+
| Z
| class="col1 centeralign" | slot
+
| {{Type|Double}}
| class="col2 centeralign" |  
+
|
| class="col3" | Item in slot format
+
|- {{removed}}
|- class="row5"
+
| Strength
! class="col0" | Total Size:
+
| {{Type|Float}}
| class="col1 rightalign" colspan="4" | 11 bytes
+
| 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]].
 +
|-
 +
| Explosion Sound
 +
| {{Type|ID or}} {{Type|Sound Event}}
 +
| ID in the <code>minecraft:sound_event</code> registry, or an inline definition.
 +
|}
  
=== Respawn (0x09) ===
+
==== Open Horse Screen ====
  
''Two-Way''
+
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.
  
Sent by the client when the player presses the "Respawn" button after dying. The server then teleports the user to the spawn point, and sends a respawn packet in response. The client will not leave the respawn screen until it receives a respawn packet.
+
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="3"| ''protocol:''<br/><code>0x23</code><br/><br/>''resource:''<br/><code>horse_screen_open</code>
 +
| rowspan="3"| Play
 +
| rowspan="3"| Client
 +
| Window ID
 +
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
 +
|
 +
|-
 +
| Slot count
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Entity ID
 +
| {{Type|Int}}
 +
|
 +
|}
  
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.
+
==== Login (play) ====
  
'''Client to Server'''
+
{{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?}}
 +
 
 +
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
|- class="row1"
+
! Bound To
| class="col0 centeralign" | 0x09
+
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="23"| ''protocol:''<br/><code>{{change|0x2B|0x2C}}</code><br/><br/>''resource:''<br/><code>login</code>
 +
| rowspan="23"| Play
 +
| rowspan="23"| Client
 +
| Entity ID
 +
| {{Type|Int}}
 +
| The player's Entity ID (EID).
 +
|-
 +
| Is hardcore
 +
| {{Type|Boolean}}
 +
|
 +
|-
 +
| Dimension Count
 +
| {{Type|VarInt}}
 +
| Size of the following array.
 +
|-
 +
| Dimension Names
 +
| {{Type|Array}} of {{Type|Identifier}}
 +
| Identifiers for all dimensions on the server.
 +
|-
 +
| Max Players
 +
| {{Type|VarInt}}
 +
| Was once used by the client to draw the player list, but now is ignored.
 +
|-
 +
| View Distance
 +
| {{Type|VarInt}}
 +
| Render distance (2-32).
 +
|-
 +
| Simulation Distance
 +
| {{Type|VarInt}}
 +
| The distance that the client will process specific things, such as entities.
 +
|-
 +
| Reduced Debug Info
 +
| {{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.
 +
|-
 +
| Enable respawn screen
 +
| {{Type|Boolean}}
 +
| Set to false when the doImmediateRespawn gamerule is true.
 +
|-
 +
| Do limited crafting
 +
| {{Type|Boolean}}
 +
| Whether players can only craft recipes they have already unlocked. Currently unused by the client.
 +
|-
 +
| Dimension Type
 +
| {{Type|VarInt}}
 +
| The ID of the type of dimension in the <code>minecraft:dimension_type</code> registry, defined by the 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}}
 +
|
 +
|-
 +
| Enforces Secure Chat
 +
| {{Type|Boolean}}
 +
|
 +
|}
 +
 
 +
==== Move Minecart Along Track ====
 +
 
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! colspan="2"| Field Name
 +
! colspan="2"| Field Type
 +
! colspan="2"| Notes
 +
|-
 +
| rowspan="11"| ''protocol:''<br/><code>0x31</code><br/><br/>''resource:''<br/><code>move_minecart_along_track</code>
 +
| rowspan="11"| Play
 +
| rowspan="11"| Client
 +
| colspan="2"| Entity ID
 +
| colspan="2"| {{Type|VarInt}}
 +
|
 +
|-
 +
| colspan="2"| Step Count
 +
| colspan="2"| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|-
 +
| rowspan="9"| Steps
 +
| X
 +
| rowspan="9"| {{Type|Array}}
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Y
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Z
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Velocity X
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Velocity Y
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Velocity Z
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Yaw
 +
| {{Type|Angle}}
 +
|
 +
|-
 +
| Pitch
 +
| {{Type|Angle}}
 +
|
 +
|-
 +
| Weight
 +
| {{Type|Float}}
 
|}
 
|}
  
'''Server to Client'''
+
==== Player Info Update ====
  
 +
Sent by the server to update the user list (<tab> in the client).
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! colspan="2"| Field Name
! class="col3" | Example
+
! colspan="2"| Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="5" | 0x09
+
| rowspan="4"| ''protocol:''<br/><code>{{change|0x3E|0x40}}</code><br/><br/>''resource:''<br/><code>player_info_update</code>
| class="col1 centeralign" | Dimension
+
| rowspan="4"| Play
| class="col2 centeralign" | int
+
| rowspan="4"| Client
| class="col3 centeralign" | <code>1</code>
+
| colspan="2"| Actions
| class="col4" | <code>-1</code>: The Nether, <code>0</code>: The Overworld, <code>1</code>: The End
+
| colspan="2"| {{Type|Byte}}
|- class="row2"
+
| Determines what actions are present.
| class="col1 centeralign" | Difficulty
+
|-
| class="col2 centeralign" | byte
+
| colspan="2"| Number Of Players
| class="col3 centeralign" | <code>1</code>
+
| colspan="2"| {{Type|VarInt}}
| class="col4" | <code>0</code> thru <code>3</code> for Peaceful, Easy, Normal, Hard. <code>1</code> is always sent c->s
+
| Number of elements in the following array.
|- class="row3"
+
|-
| class="col1 centeralign" | Creative mode
+
| rowspan="2" | Players
| class="col2 centeralign" | byte
+
| UUID
| class="col3 centeralign" | <code>1</code>
+
| rowspan="2" | {{Type|Array}}
| class="col4" | <code>0</code> for survival, <code>1</code> for creative.
+
| {{Type|UUID}}
|- class="row4"
+
| The player UUID
| class="col1 centeralign" | World height
+
|-
| class="col2 centeralign" | short
+
| Player Actions
| class="col3 centeralign" | <code>256</code>
+
| {{Type|Array}} of [[#player-info:player-actions|Player&nbsp;Actions]]
| class="col4" | Defaults to <code>256</code>
+
| 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="row5"
+
|}
| class="col1 centeralign" | Level Type
+
 
| class="col2 centeralign" | string
+
{| class="wikitable"
| class="col3 centeralign" | default
+
|+ id="player-info:player-actions" | Player Actions
| class="col4" | See [[#0x01|0x01 login]]
+
! Action
|- class="row6"
+
! Mask
! class="col0" | Total Size:
+
! colspan="2" | Field Name
| class="col1 rightalign" colspan="4" | 11 bytes + length of string
+
! colspan="2" | Type
|}
+
! Notes
 +
|-
 +
| rowspan="6" | Add Player
 +
| rowspan="6" | 0x01
 +
| colspan="2" | Name
 +
| colspan="2" | {{Type|String}} (16)
 +
|-
 +
| colspan="2" | Number Of Properties
 +
| colspan="2" | {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|-
 +
| rowspan="4" | Property
 +
| Name
 +
| rowspan="4"| {{Type|Array}}
 +
| {{Type|String}} (32767)
 +
|
 +
|-
 +
| Value
 +
| {{Type|String}} (32767)
 +
|
 +
|-
 +
| Is Signed
 +
| {{Type|Boolean}}
 +
|
 +
|-
 +
| Signature
 +
| {{Type|Optional}} {{Type|String}} (32767)
 +
| Only if Is Signed is true.
 +
|-
 +
| rowspan="7" | Initialize Chat
 +
| rowspan="7" | 0x02
 +
| colspan="2" | Has Signature Data
 +
| colspan="2" | {{Type|Boolean}}
 +
|-
 +
| colspan="2" | Chat session ID
 +
| colspan="2" | {{Type|UUID}}
 +
| Only sent if Has Signature Data is true.
 +
|-
 +
| colspan="2" | Public key expiry time
 +
| colspan="2" | {{Type|Long}}
 +
| Key expiry time, as a UNIX timestamp in milliseconds. Only sent if Has Signature Data is true.
 +
|-
 +
| colspan="2" | Encoded public key size
 +
| colspan="2" | {{Type|VarInt}}
 +
| Size of the following array. Only sent if Has Signature Data is true. Maximum length is 512 bytes.
 +
|-
 +
| colspan="2" | Encoded public key
 +
| colspan="2" | {{Type|Byte Array}} (512)
 +
| The player's public key, in bytes. Only sent if Has Signature Data is true.
 +
|-
 +
| colspan="2" | Public key signature size
 +
| colspan="2" | {{Type|VarInt}}
 +
| Size of the following array. Only sent if Has Signature Data is true. Maximum length is 4096 bytes.
 +
|-
 +
| colspan="2" | Public key signature
 +
| colspan="2" | {{Type|Byte Array}} (4096)
 +
| The public key's digital signature. Only sent if Has Signature Data is true.
 +
|-
 +
| Update Game Mode
 +
| 0x04
 +
| colspan="2" | Game Mode
 +
| colspan="2" | {{Type|VarInt}}
 +
|-
 +
| Update Listed
 +
| 0x08
 +
| colspan="2" | Listed
 +
| colspan="2" | {{Type|Boolean}}
 +
| Whether the player should be listed on the player list.
 +
|-
 +
| Update Latency
 +
| 0x10
 +
| colspan="2" | Ping
 +
| colspan="2" | {{Type|VarInt}}
 +
| Measured in milliseconds.
 +
|-
 +
| rowspan="2" | Update Display Name
 +
| rowspan="2" | 0x20
 +
| colspan="2" | Has Display Name
 +
| colspan="2" | {{Type|Boolean}}
 +
|-
 +
| colspan="2" | Display Name
 +
| 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.
 +
|}
 +
 
 +
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.
 +
 
 +
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.
  
=== Player Block Placement (0x0F) ===
+
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]).
  
''Client to Server''
+
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"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="8" | 0x0F
+
| rowspan="11"| ''protocol:''<br/><code>{{change|0x40|0x42}}</code><br/><br/>''resource:''<br/><code>player_position</code>
| class="col1 centeralign" | X
+
| rowspan="11"| Play
| class="col2 centeralign" | int
+
| rowspan="11"| Client
| class="col3 centeralign" | <code>32</code>
+
| {{added}} | Teleport ID
| class="col4" | Block position
+
| {{added}} | {{Type|VarInt}}
|- class="row2"
+
| {{added}} | Client should confirm this packet with [[#Confirm Teleportation|Confirm Teleportation]] containing the same Teleport ID.
| class="col0 centeralign" | Y
+
|-
| class="col1 centeralign" | unsigned byte
+
| X
| class="col2 centeralign" | <code>64</code>
+
| {{Type|Double}}
| class="col3" | Block position
+
| Absolute or relative position, depending on Flags.
|- class="row3"
+
|-
| class="col0 centeralign" | Z
+
| Y
| class="col1 centeralign" | int
+
| {{Type|Double}}
| class="col2 centeralign" | <code>32</code>
+
| Absolute or relative position, depending on Flags.
| class="col3 leftalign" | Block position
+
|-
|- class="row4"
+
| Z
| class="col0 centeralign" | Direction
+
| {{Type|Double}}
| class="col1 centeralign" | byte
+
| Absolute or relative position, depending on Flags.
| class="col2 centeralign" | <code>3</code>
+
|- {{added}}
| class="col3" | The offset to use for block/item placement (see below)
+
| Velocity X
|- class="row5"
+
| {{Type|Double}}
| class="col0 centeralign" | Held item
+
|
| class="col1 centeralign" | [[Slot_Data|slot]]
+
|- {{added}}
| class="col2 centeralign" |  
+
| Velocity Y
| class="col3" |  
+
| {{Type|Double}}
|- class="row6"
+
|
| class="col0 centeralign" | Cursor position X
+
|- {{added}}
| class="col1 centeralign" | byte
+
| Velocity Z
| class="col2 centeralign" | 0 - 16
+
| {{Type|Double}}
| class="col3" | The position of the crosshair on the block
+
|
|- class="row7"
+
|-
| class="col0 centeralign" | Cursor position Y
+
| Yaw
| class="col1 centeralign" | byte
+
| {{Type|Float}}
| class="col2 centeralign" | 0 - 16
+
| Absolute or relative rotation on the X axis, in degrees.
| class="col3" |
+
|-
|- class="row8"
+
| Pitch
| class="col0 centeralign" | Cursor position Z
+
| {{Type|Float}}
| class="col1 centeralign" | byte
+
| Absolute or relative rotation on the Y axis, in degrees.
| class="col2 centeralign" | 0 - 16
+
|-
| class="col3" |  
+
| Flags
|- class="row9"
+
| {{change|{{Type|Byte}}|{{Type|Teleport Flags}}}}
! class="col0" | Total Size:
+
| {{change|Reference the Flags table below. When the value of the this byte masked is zero the field is absolute, otherwise relative.|}}
| class="col1 rightalign" colspan="4" | 11 bytes + slot data
+
|- {{removed}}
|}
+
| Teleport ID
 +
| {{Type|VarInt}}
 +
| Client should confirm this packet with [[#Confirm Teleportation|Confirm Teleportation]] containing the same Teleport ID.
 +
|}
 +
 
 +
==== Player Rotation ====
 +
 
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="2"| ''protocol:''<br/><code>0x43</code><br/><br/>''resource:''<br/><code>player_rotation</code>
 +
| rowspan="2"| Play
 +
| rowspan="2"| Client
 +
| Yaw
 +
| {{Type|Float}}
 +
| Rotation on the X axis, in degrees.
 +
|-
 +
| Pitch
 +
| {{Type|Float}}
 +
| Rotation on the Y axis, in degrees.
 +
|}
  
=== Spawn Named Entity (0x14) ===
+
==== Place Ghost Recipe ====
  
''Server to Client''
+
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"
|- class="row0"
+
! Packet ID
! class="col0 centeralign" | Packet ID
+
! State
! class="col1 rightalign" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="9" | 0x14
+
| rowspan="4"| ''protocol:''<br/><code>{{change|0x37|0x39}}</code><br/><br/>''resource:''<br/><code>place_ghost_recipe</code>
| class="col1" | EID
+
| rowspan="4"| Play
| class="col2" | int
+
| rowspan="4"| Client
| class="col3" | <code>94453</code>
+
| Window ID
| class="col4" | Player ID
+
| {{change|{{Type|Byte}}|{{Type|VarInt}}}}
|- class="row2"
+
|
| class="col0" | Player Name
+
|- {{removed}}
| class="col1" | string
+
| Recipe
| class="col2" | <code>Twdtwd</code>
+
| {{Type|Identifier}}
| class="col3" | Max length of 16
+
| A recipe ID.
|- class="row3"
+
|- {{added}}
| class="col0" | X
+
| Recipe Display
| class="col1" | int
+
| {{Type|Recipe Display}}
| class="col2" | <code>784</code>
+
|
| class="col3" | Player X as Absolute Integer
+
|}
|- class="row4"
+
 
| class="col0" | Y
+
==== Recipe Book Add ====
| class="col1" | int
+
 
| class="col2" | <code>2131</code>
+
{| class="wikitable" {{added}}
| class="col3" | Player Y as Absolute Integer
+
! Packet ID
|- class="row5"
+
! State
| class="col0" | Z
+
! Bound To
| class="col1" | int
+
! colspan="2"| Field Name
| class="col2" | <code>-752</code>
+
! colspan="2"| Field Type
| class="col3" | Player Z as Absolute Integer
+
! colspan="2"| Notes
|- class="row6"
+
|-
| class="col0" | Yaw
+
| rowspan="10"| ''protocol:''<br/><code>0x44</code><br/><br/>''resource:''<br/><code>recipe_book_add</code>
| class="col1" | byte
+
| rowspan="10"| Play
| class="col2" | <code>0</code>
+
| rowspan="10"| Client
| class="col3" | Player rotation as a packed byte
+
| colspan="2"| Recipe Count
|- class="row7"
+
| colspan="2"| {{Type|VarInt}}
| class="col0" | Pitch
+
| Number of elements in the following array.
| class="col1" | byte
+
|-
| class="col2" | <code>0</code>
+
| rowspan="8"| Recipes
| class="col3" | Player rotation as a packed byte
+
| Recipe ID
|- class="row8"
+
| rowspan="8"| {{Type|Array}}
| class="col0" | Current Item
+
| {{Type|VarInt}}
| class="col1" | short
+
| ID to assign to the recipe.
| class="col2" | <code>0</code>
+
|-
| class="col3" | The item the player is currently holding. Note that this should be 0 for "no item", unlike -1 used in other packets. A negative value crashes clients.
+
| Display
|- class="row9"
+
| {{Type|Recipe Display}}
| class="col0" | Metadata
+
|
| class="col1" | Metadata
+
|-
| class="col2" | <code>127</code>
+
| Group ID
| class="col3" |
+
| {{Type|VarInt}}
|- class="row10"
+
|
! class="col0" | Total Size:
+
|-
| class="col1 rightalign" colspan="4" | 22 bytes + length of strings + metadata (at least 1)
+
| Category ID
|}
+
| {{Type|VarInt}}
 +
| ID in the <code>minecraft:recipe_book_category</code> registry.
 +
|-
 +
| Has Ingredients
 +
| {{Type|Boolean}}
 +
|
 +
|-
 +
| Ingredient Count
 +
| {{Type|Optional}} {{Type|VarInt}}
 +
| Number of elements in the following array. Only present if Has Ingredients is true.
 +
|-
 +
| Ingredients
 +
| {{Type|Optional}} {{Type|Array}} of {{Type|ID Set}}
 +
| IDs in the <code>minecraft:item</code> registry, or an inline definition. Only present if Has Ingredients is true.
 +
|-
 +
| Flags
 +
| {{Type|Byte}}
 +
| 0x01: show notification; 0x02: highlight as new
 +
|-
 +
| colspan="2"| Replace
 +
| colspan="2"| {{Type|Boolean}}
 +
| Replace or Add to known recipes
 +
|}
 +
 
 +
==== Recipe Book Remove ====
 +
 
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="2"| ''protocol:''<br/><code>0x45</code><br/><br/>''resource:''<br/><code>recipe_book_remove</code>
 +
| rowspan="2"| Play
 +
| rowspan="2"| Client
 +
| Recipe Count
 +
| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|-
 +
| Recipes
 +
| {{Type|Array}} of {{Type|VarInt}}
 +
| IDs of recipes to remove.
 +
|}
 +
 
 +
==== Recipe Book Settings ====
 +
 
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="8"| ''protocol:''<br/><code>0x46</code><br/><br/>''resource:''<br/><code>recipe_book_settings</code>
 +
| rowspan="8"| Play
 +
| 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.
 +
|-
 +
| Crafting Recipe Book Filter Active
 +
| {{Type|Boolean}}
 +
| If true, then the filtering option is active when the players opens its inventory.
 +
|-
 +
| Smelting Recipe Book Open
 +
| {{Type|Boolean}}
 +
| If true, then the smelting recipe book will be open when the player opens its inventory.
 +
|-
 +
| Smelting Recipe Book Filter Active
 +
| {{Type|Boolean}}
 +
| If true, then the filtering option is active when the players opens its inventory.
 +
|-
 +
| Blast Furnace Recipe Book Open
 +
| {{Type|Boolean}}
 +
| If true, then the blast furnace recipe book will be open when the player opens its inventory.
 +
|-
 +
| Blast Furnace Recipe Book Filter Active
 +
| {{Type|Boolean}}
 +
| If true, then the filtering option is active when the players opens its inventory.
 +
|-
 +
| Smoker Recipe Book Open
 +
| {{Type|Boolean}}
 +
| If true, then the smoker recipe book will be open when the player opens its inventory.
 +
|-
 +
| Smoker Recipe Book Filter Active
 +
| {{Type|Boolean}}
 +
| If true, then the filtering option is active when the players opens its inventory.
 +
|}
  
=== Spawn Object/Vehicle (0x17) ===
+
==== Respawn ====
  
''Server to Client''
+
{{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 by the server when an Object/Vehicle is created. The throwers entity id is now used for fishing floats too.
+
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"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="9" | 0x17
+
| rowspan="13"| ''protocol:''<br/><code>{{change|0x47|0x4C}}</code><br/><br/>''resource:''<br/><code>respawn</code>
| class="col1 centeralign" | EID
+
| rowspan="13"| Play
| class="col2 centeralign" | int
+
| rowspan="13"| Client
| class="col3 centeralign" | <code>62</code>
+
| Dimension Type
| class="col4" | Entity ID of the Object
+
| {{Type|VarInt}}
|- class="row2"
+
| The ID of type of dimension in the <code>minecraft:dimension_type</code> registry, defined by the [[Protocol#Registry_Data|Registry Data]] packet.
| class="col0 centeralign" | Type
+
|-
| class="col1 centeralign" | byte
+
| Dimension Name
| class="col2 centeralign" | <code>11</code>
+
| {{Type|Identifier}}
| class="col3" | The type of object (see [[Entities#Objects]])
+
| Name of the dimension being spawned into.
|- class="row3"
+
|-
| class="col0 centeralign" | X
+
| Hashed seed
| class="col1 centeralign" | int
+
| {{Type|Long}}
| class="col2 centeralign" | <code>16080</code>
+
| First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
| class="col3" | The Absolute Integer X Position of the object
+
|-
|- class="row4"
+
| Game mode
| class="col0 centeralign" | Y
+
| {{Type|Unsigned Byte}}
| class="col1 centeralign" | int
+
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
| class="col2 centeralign" | <code>2299</code>
+
|-
| class="col3" | The Absolute Integer Y Position of the object
+
| Previous Game mode
|- class="row5"
+
| {{Type|Byte}}
| class="col0 centeralign" | Z
+
| -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)
| class="col1 centeralign" | int
+
|-
| class="col2 centeralign" | <code>592</code>
+
| Is Debug
| class="col3" | The Absolute Integer Z Position of the object
+
| {{Type|Boolean}}
|- class="row6"
+
| True if the world is a {{Minecraft Wiki|debug mode}} world; debug mode worlds cannot be modified and have predefined blocks.
| class="col0 centeralign" | thrower's entity ID
+
|-
| class="col1 centeralign" | int
+
| Is Flat
| class="col2 centeralign" | <code>0</code>
+
| {{Type|Boolean}}
| class="col3" | If this is bigger than 0, this is a entity trown by a other entity and the next 3 fields are sent.
+
| 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.
|- class="row7"
+
|-
| class="col0 centeralign" | Speed X
+
| Has death location
| class="col1 centeralign" | short
+
| {{Type|Boolean}}
| class="col2 centeralign" | <code>0</code>
+
| If true, then the next two fields are present.
| class="col3" | Not sent if the thrower entity ID is 0. The speed of this entity along the X axis.
+
|-
|- class="row5"
+
| Death dimension Name
| class="col0 centeralign" | Speed Y
+
| {{Type|Optional}} {{Type|Identifier}}
| class="col1 centeralign" | short
+
| Name of the dimension the player died in.
| class="col2 centeralign" | <code>0</code>
+
|-
| class="col3" | Not sent if the thrower entity ID is 0. The speed of this entity along the Y axis.
+
| Death location
|- class="row5"
+
| {{Type|Optional}} {{Type|Position}}
| class="col0 centeralign" | Speed Z
+
| The location that the player died at.
| class="col1 centeralign" | short
+
|-
| class="col2 centeralign" | <code>0</code>
+
| Portal cooldown
| class="col3" | Not sent if the thrower entity ID is 0. The speed of this entity along the Z axis.
+
| {{Type|VarInt}}
|- class="row6"
+
| The number of ticks until the player can use the portal again.
! class="col0" | Total Size:
+
|- {{added}}
| class="col1 rightalign" colspan="4" | 22 or 28 bytes
+
| 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.
 +
|}
 +
 
 +
{{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" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| 0x5A
 +
| Play
 +
| Client
 +
| Slot Data
 +
| {{Type|Slot}}
 +
|
 +
|}
  
{{anchor|0x18}}
+
==== Update Time ====
  
=== Spawn Mob (0x18) ===
+
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.
  
''Server to Client''
+
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 by the server when a Mob Entity is Spawned
+
The default SMP server increments the time by <code>20</code> every second.
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="12" | 0x18
+
| rowspan="3"| ''protocol:''<br/><code>{{change|0x64|0x6B}}</code><br/><br/>''resource:''<br/><code>set_time</code>
| class="col1 centeralign" | EID
+
| rowspan="3"| Play
| class="col2 centeralign" | int
+
| rowspan="3"| Client
| class="col3 centeralign" | <code>446</code>
+
| World Age
| class="col4" | Entity ID
+
| {{Type|Long}}
|- class="row2"
+
| In ticks; not changed by server commands.
| class="col0 centeralign" | Type
+
|-
| class="col1 centeralign" | byte
+
| Time of day
| class="col2 centeralign" | <code>91</code>
+
| {{Type|Long}}
| class="col3" | The type of mob. See [[Entities#Mobs]]
+
| The world (or region) time, in ticks. {{change|If negative the sun will stop moving at the Math.abs of the time.|}}
|- class="row3"
+
|- {{added}}
| class="col0 centeralign" | X
+
| Time of day increasing
| class="col1 centeralign" | int
+
| {{Type|Boolean}}
| class="col2 centeralign" | <code>13366</code>
+
| If true, the client should automatically advance the time of day according to its ticking rate.
| class="col3" | The Absolute Integer X Position of the object
+
|}
|- class="row4"
+
 
| class="col0 centeralign" | Y
+
==== Set Player Inventory Slot ====
| class="col1 centeralign" | int
 
| class="col2 centeralign" | <code>2176</code>
 
| class="col3" | The Absolute Integer Y Position of the object
 
|- class="row5"
 
| class="col0 centeralign" | Z
 
| class="col1 centeralign" | int
 
| class="col2 centeralign" | <code>1680</code>
 
| class="col3" | The Absolute Integer Z Position of the object
 
|- class="row6"
 
| class="col0 centeralign" | Yaw
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" | <code>-27</code>
 
| class="col3" | The yaw in steps of 2p/256
 
|- class="row7"
 
| class="col0 centeralign" | Pitch
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" | <code>0</code>
 
| class="col3" | The pitch in steps of 2p/256
 
|- class="row8"
 
| class="col0 centeralign" | Head Yaw
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" |
 
| class="col3" | Head yaw in steps of 2p/256
 
|- class="row9"
 
| class="col0 centeralign" | Velocity Z
 
| class="col1 centeralign" | short
 
| class="col2 centeralign" | <code>0</code>
 
| class="col3" |  
 
|- class="row10"
 
| class="col0 centeralign" | Velocity X
 
| class="col1 centeralign" | short
 
| class="col2 centeralign" | <code>0</code>
 
| class="col3" |
 
|- class="row11"
 
| class="col0 centeralign" | Velocity Y
 
| class="col1 centeralign" | short
 
| class="col2 centeralign" | <code>0</code>
 
| class="col3" |
 
|- class="row12"
 
| class="col0 centeralign" | Metadata
 
| class="col1 centeralign" | Metadata
 
| class="col2 centeralign" | <code>127</code>
 
| class="col3" | Varies by mob, see [[Entities]]
 
|- class="row13"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 27 bytes + Metadata (at least 1)
 
|}
 
  
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="2"| ''protocol:''<br/><code>0x66</code><br/><br/>''resource:''<br/><code>set_player_inventory</code>
 +
| rowspan="2"| Play
 +
| rowspan="2"| Client
 +
| Slot
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Slot Data
 +
| {{Type|Slot}}
 +
|
 +
|}
  
{{anchor|0x19}}
+
==== Synchronize Vehicle Position ====
  
=== Destroy Entity (0x1D) ===
+
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.
  
''Server to Client''
+
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="11"| ''protocol:''<br/><code>0x77</code><br/><br/>''resource:''<br/><code>teleport_entity</code>
 +
| rowspan="11"| Play
 +
| rowspan="11"| Client
 +
| Entity ID
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| X
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Y
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Z
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Velocity X
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Velocity Y
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Velocity Z
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| Yaw
 +
| {{Type|Float}}
 +
| Rotation on the Y axis, in degrees.
 +
|-
 +
| Pitch
 +
| {{Type|Float}}
 +
| Rotation on the Y axis, in degrees.
 +
|- {{added}}
 +
| Flags
 +
| {{Type|Teleport Flags}}
 +
|
 +
|-
 +
| On Ground
 +
| {{Type|Boolean}}
 +
|
 +
|}
  
Sent by the server when an list of Entities is to be destroyed on the client.
+
==== Update Recipes ====
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! colspan="2"| Field Name
! class="col3" | Example
+
! colspan="2"| Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 " rowspan="2" | 0x1D
+
| rowspan="8"| ''protocol:''<br/><code>{{change|0x77|0x7e}}</code><br/><br/>''resource:''<br/><code>update_recipes</code>
| class="col1 centeralign" | Entity Count
+
| rowspan="8"| Play
| class="col2 centeralign" | byte
+
| rowspan="8"| Client
| class="col3 centeralign" | <code>3</code>
+
| {{removed}} colspan="2"| Num Recipes
| class="col4 centeralign" | The amount of entities which should be destroyed
+
| {{removed}} colspan="2"| {{Type|VarInt}}
|- class="row21"
+
| {{removed}}| Number of elements in the following array.
| class="col1 centeralign" | Entity IDs
+
|- {{removed}}
| class="col2 centeralign" | array of int
+
| rowspan="3"| Recipe
| class="col3 centeralign" | <code>452, 546, 123</code>
+
| Recipe ID
| class="col4 centeralign" | The list of entity ids which should be destroyed
+
| rowspan="3"| {{Type|Array}}
|- class="row32"
+
| {{Type|Identifier}}
! class="col0" | Total Size:
+
|
| class="col1 rightalign" colspan="4" | 2 + (entity count * 4) bytes
+
|- {{removed}}
|}
+
| Type ID
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| The recipe type, see below.
 +
|- {{removed}}
 +
| Data
 +
| Varies
 +
| Additional data for the recipe.
 +
|- {{added}}
 +
| colspan="2"| Property Set Count
 +
| colspan="2"| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|- {{added}}
 +
| rowspan="3"| Property Sets
 +
| Property Set ID
 +
| rowspan="3"| {{Type|Array}}
 +
| {{Type|Identifier}}
 +
|
 +
|- {{added}}
 +
| Item Count
 +
| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|- {{added}}
 +
| Items
 +
| {{Type|Array}} of {{Type|VarInt}}
 +
| IDs in the <code>minecraft:item</code> registry.
 +
|}
 +
 
 +
{{change|Recipe types:|}}
 +
 
 +
{| class="wikitable" {{removed}}
 +
! ID
 +
! Type
 +
! Description
 +
! Data
 +
|-
 +
| 0
 +
| <code>minecraft:crafting_shaped</code>
 +
| Shaped crafting recipe. All items must be present in the same pattern (which may be flipped horizontally or translated).
 +
| As follows:
 +
  {| class="wikitable" {{removed}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Group
 +
    | {{Type|String}} (32767)
 +
    | Used to group similar recipes together in the recipe book. Tag is present in recipe JSON.
 +
    |-
 +
    |Category
 +
    |{{Type|VarInt}} {{Type|Enum}}
 +
    |Building = 0, Redstone = 1, Equipment = 2, Misc = 3
 +
    |-
 +
    | Width
 +
    | {{Type|VarInt}}
 +
    |
 +
    |-
 +
    | Height
 +
    | {{Type|VarInt}}
 +
    |
 +
    |-
 +
    | Ingredients
 +
    | {{Type|Array}} of Ingredient
 +
    | Length is <code>width * height</code>. Indexed by <code>x + (y * width)</code>.
 +
    |-
 +
    | Result
 +
    | {{Type|Slot}}
 +
    |-
 +
    | Show notification
 +
    | {{Type|Boolean}}
 +
    | Show a toast when the recipe is [[Protocol#Update_Recipe_Book|added]].
 +
    |}
 +
|-
 +
| 1
 +
| <code>minecraft:crafting_shapeless</code>
 +
| Shapeless crafting recipe. All items in the ingredient list must be present, but in any order/slot.
 +
| As follows:
 +
  {| class="wikitable" {{removed}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Group
 +
    | {{Type|String}} (32767)
 +
    | Used to group similar recipes together in the recipe book. Tag is present in recipe JSON.
 +
    |-
 +
    |Category
 +
    |{{Type|VarInt}} {{Type|Enum}}
 +
    |Building = 0, Redstone = 1, Equipment = 2, Misc = 3
 +
    |-
 +
    | Ingredient count
 +
    | {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | Ingredients
 +
    | {{Type|Array}} of Ingredient.
 +
    |
 +
    |-
 +
    | Result
 +
    | {{Type|Slot}}
 +
    |
 +
    |}
 +
|-
 +
| 2
 +
| <code>minecraft:crafting_special_armordye</code>
 +
| Recipe for dying leather armor
 +
| rowspan="14" | As follows:
 +
  {| class="wikitable" {{removed}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    |Category
 +
    |{{Type|VarInt}} {{Type|Enum}}
 +
    |Building = 0, Redstone = 1, Equipment = 2, Misc = 3
 +
    |}
 +
|-
 +
| 3
 +
| <code>minecraft:crafting_special_bookcloning</code>
 +
| Recipe for copying contents of written books
 +
|-
 +
| 4
 +
| <code>minecraft:crafting_special_mapcloning</code>
 +
| Recipe for copying maps
 +
|-
 +
| 5
 +
| <code>minecraft:crafting_special_mapextending</code>
 +
| Recipe for adding paper to maps
 +
|-
 +
| 6
 +
| <code>minecraft:crafting_special_firework_rocket</code>
 +
| Recipe for making firework rockets
 +
|-
 +
| 7
 +
| <code>minecraft:crafting_special_firework_star</code>
 +
| Recipe for making firework stars
 +
|-
 +
| 8
 +
| <code>minecraft:crafting_special_firework_star_fade</code>
 +
| Recipe for making firework stars fade between multiple colors
 +
|-
 +
| 9
 +
| <code>minecraft:crafting_special_tippedarrow</code>
 +
| Recipe for crafting tipped arrows
 +
|-
 +
| 10
 +
| <code>minecraft:crafting_special_bannerduplicate</code>
 +
| Recipe for copying banner patterns
 +
|-
 +
| 11
 +
| <code>minecraft:crafting_special_shielddecoration</code>
 +
| Recipe for applying a banner's pattern to a shield
 +
|-
 +
| 12
 +
| <code>minecraft:crafting_special_shulkerboxcoloring</code>
 +
| Recipe for recoloring a shulker box
 +
|-
 +
| 13
 +
| <code>minecraft:crafting_special_suspiciousstew</code>
 +
| Recipe for crafting suspicious stews
 +
|-
 +
| 14
 +
| <code>minecraft:crafting_special_repairitem</code>
 +
| Recipe for repairing items via crafting
 +
|-
 +
| 22
 +
| <code>minecraft:crafting_decorated_pot</code>
 +
| Recipe for crafting decorated pots
 +
|-
 +
| 15
 +
| <code>minecraft:smelting</code>
 +
| Smelting recipe
 +
| rowspan="4"| As follows:
 +
  {| class="wikitable" {{removed}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Group
 +
    | {{Type|String}} (32767)
 +
    | Used to group similar recipes together in the recipe book.
 +
    |-
 +
    |Category
 +
    |{{Type|VarInt}} {{Type|Enum}}
 +
    |Food = 0, Blocks = 1, Misc = 2
 +
    |-
 +
    | Ingredient
 +
    | Ingredient
 +
    |
 +
    |-
 +
    | Result
 +
    | {{Type|Slot}}
 +
    |
 +
    |-
 +
    | Experience
 +
    | {{Type|Float}}
 +
    |
 +
    |-
 +
    | Cooking time
 +
    | {{Type|VarInt}}
 +
    |
 +
    |}
 +
|-
 +
| 16
 +
| <code>minecraft:blasting</code>
 +
| Blast furnace recipe
 +
|-
 +
| 17
 +
| <code>minecraft:smoking</code>
 +
| Smoker recipe
 +
|-
 +
| 18
 +
| <code>minecraft:campfire_cooking</code>
 +
| Campfire recipe
 +
|-
 +
| 19
 +
| <code>minecraft:stonecutting</code>
 +
| Stonecutter recipe
 +
| As follows:
 +
  {| class="wikitable" {{removed}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Group
 +
    | {{Type|String}} (32767)
 +
    | Used to group similar recipes together in the recipe book.  Tag is present in recipe JSON.
 +
    |-
 +
    | Ingredient
 +
    | Ingredient
 +
    |
 +
    |-
 +
    | Result
 +
    | {{Type|Slot}}
 +
    |
 +
    |}
 +
|-
 +
| 20
 +
| <code>minecraft:smithing_transform</code>
 +
| Recipe for smithing netherite gear
 +
| As follows:
 +
  {| class="wikitable" {{removed}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Template
 +
    | Ingredient
 +
    | The smithing template.
 +
    |-
 +
    | Base
 +
    | Ingredient
 +
    | The base item.
 +
    |-
 +
    | Addition
 +
    | Ingredient
 +
    | The additional ingredient.
 +
    |-
 +
    | Result
 +
    | {{Type|Slot}}
 +
    |
 +
    |}
 +
|-
 +
| 21
 +
| <code>minecraft:smithing_trim</code>
 +
| Recipe for applying armor trims
 +
| As follows:
 +
  {| class="wikitable" {{removed}}
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Template
 +
    | Ingredient
 +
    | The smithing template.
 +
    |-
 +
    | Base
 +
    | Ingredient
 +
    | The base item.
 +
    |-
 +
    | Addition
 +
    | Ingredient
 +
    | The additional ingredient.
 +
    |}
 +
|}
 +
 
 +
{{change|Ingredient is defined as:|}}
 +
 
 +
{| class="wikitable" {{removed}}
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Count
 +
| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|-
 +
| Items
 +
| {{Type|Array}} of {{Type|Slot}}
 +
| Any item in this array may be used for the recipe.  The count of each item should be 1.
 +
|}
 +
 
 +
=== Serverbound ===
  
 +
==== Bundle Item Selected ====
  
{{anchor|0x1E}}
+
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="2"| ''protocol:''<br/><code>0x02</code><br/><br/>''resource:''<br/><code>bundle_item_selected</code>
 +
| rowspan="2"| Play
 +
| rowspan="2"| Server
 +
| Slot of Bundle
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Slot in Bundle
 +
| {{Type|VarInt}}
 +
|
 +
|}
  
=== Chunk Data (0x33) ===
+
==== Client Tick End ====
  
''Server to Client''
+
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| ''protocol:''<br/><code>0x0B</code><br/><br/>''resource:''<br/><code>client_tick_end</code>
 +
| Play
 +
| Server
 +
| colspan="3"| ''no fields''
 +
|}
  
See also: [[Map Format]]
+
==== Click Container ====
  
Chunks are sent a column at a time, with some sections optionally missing from each packet (those consisting only of air).
+
This packet is sent by the client when the player clicks on a slot in a window.
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! colspan="2"| Field Name
! class="col3" | Example
+
! colspan="2"| Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="7" | 0x33
+
| rowspan="9"| ''protocol:''<br/><code>{{change|0x0E|0x10}}</code><br/><br/>''resource:''<br/><code>container_click</code>
| class="col1 centeralign" | X
+
| rowspan="9"| Play
| class="col2 centeralign" | int
+
| rowspan="9"| Server
| class="col3 centeralign" |  
+
| colspan="2"| Window ID
| class="col4" | Chunk X Coordinate (*16 to get true X)
+
| colspan="2"| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
|- class="row2"
+
| 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.
| class="col0 centeralign" | Z
+
|-
| class="col1 centeralign" | int
+
| colspan="2"| State ID
| class="col2 centeralign" |
+
| colspan="2"| {{Type|VarInt}}
| class="col3" | Chunk Z Coordinate (*16 to get true Z)
+
| 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.
|- class="row3"
+
|-
| class="col0 centeralign" | Ground-up continuous
+
| colspan="2"| Slot
| class="col1 centeralign" | boolean
+
| colspan="2"| {{Type|Short}}
| class="col2 centeralign" |  
+
| colspan="2"| The clicked slot number, see below.
| class="col3" | This is True if the packet represents all sections in this vertical column, where the primary bit map specifies exactly which sections are included, and which are air.
+
|-
|- class="row4"
+
| colspan="2"| Button
| class="col0 centeralign" | Primary bit map
+
| colspan="2"| {{Type|Byte}}
| class="col1 centeralign" | unsigned short
+
| colspan="2"| The button used in the click, see below.
| class="col2 centeralign" | 15
+
|-
| class="col3" | Bitmask with 1 for every 16x16x16 section which data follows in the compressed data.
+
| colspan="2"| Mode
|- class="row5"
+
| colspan="2"| {{Type|VarInt}} {{Type|Enum}}
| class="col0 centeralign" | Add bit map
+
| colspan="2"| Inventory operation mode, see below.
| class="col1 centeralign" | unsigned short
+
|-
| class="col2 centeralign" | 0
+
| colspan="2"| Length of the array
| class="col3" | Same as above, but this is used exclusively for the 'add' portion of the payload
+
| colspan="2"| {{Type|VarInt}}
|- class="row6"
+
| colspan="2"| Maximum value for Notchian server is 128 slots.
| class="col0 centeralign" | Compressed size
+
|-
| class="col1 centeralign" | int
+
| rowspan="2"| Array of changed slots
| class="col2 centeralign" |  
+
| Slot number
| class="col3" | Size of compressed chunk data.
+
| rowspan="2"| {{Type|Array}} (128)
|- class="row78"
+
| {{Type|Short}}
| class="col0 centeralign" | Compressed data
+
|
| class="col1 centeralign" | unsigned byte array
+
|-
| class="col2 centeralign" | <code>…</code>
+
| Slot data
| class="col3" | The chunk data is compressed using ZLib Deflate function.
+
| {{Type|Slot}}
|- class="row8"
+
| New data for this slot, in the client's opinion; see below.
! class="col0" | Total Size:
+
|-
| class="col1 rightalign" colspan="4" | 22 bytes + Compressed chunk size
+
| colspan="2"| Carried item
|}
+
| colspan="2"| [[Slot Data|Slot]]
 +
| 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.
  
 +
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.
  
=== Block Change (0x35) ===
+
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.
  
''Server to Client''
+
The distinct type of click performed by the client is determined by the combination of the Mode and Button fields.
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Mode
! class="col0" | Packet ID
+
! Button
! class="col1" | Field Name
+
! Slot
! class="col2" | Field Type
+
! Trigger
! class="col3" | Example
+
|-
! class="col4" | Notes
+
! rowspan="4"| 0
|- class="row1"
+
| 0
| class="col0 centeralign" rowspan="5" | 0x35
+
| Normal
| class="col1 centeralign" | X
+
| Left mouse click
| class="col2 centeralign" | int
+
|-
| class="col3 centeralign" | <code>502</code>
+
| 1
| class="col4" | Block X Coordinate
+
| Normal
|- class="row2"
+
| Right mouse click
| class="col0 centeralign" | Y
+
|-
| class="col1 centeralign" | byte
+
| 0
| class="col2 centeralign" | <code>71</code>
+
| -999
| class="col3" | Block Y Coordinate
+
| Left click outside inventory (drop cursor stack)
|- class="row3"
+
|-
| class="col0 centeralign" | Z
+
| 1
| class="col1 centeralign" | int
+
| -999
| class="col2 centeralign" | <code>18</code>
+
| Right click outside inventory (drop cursor single item)
| class="col3" | Block Z Coordinate
+
|-
|- class="row4"
+
! rowspan="2"| 1
| class="col0 centeralign" | Block Type
+
| 0
| class="col1 centeralign" | short
+
| Normal
| class="col2 centeralign" | <code>78</code>
+
| Shift + left mouse click
| class="col3" | The new block type for the block
+
|-
|- class="row5"
+
| 1
| class="col0 centeralign" | Block Metadata
+
| Normal
| class="col1 centeralign" | byte
+
| Shift + right mouse click ''(identical behavior)''
| class="col2 centeralign" | <code>0</code>
+
|-
| class="col3" | The new Metadata for the block
+
! rowspan="7"| 2
|- class="row6"
+
| 0
! class="col0" | Total Size:
+
| Normal
| class="col1 rightalign" colspan="4" | 13 bytes
+
| 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.
 +
|-
 +
! rowspan="2"| 4
 +
| 0
 +
| Normal*
 +
| Drop key (Q) (* Clicked item is always empty)
 +
|-
 +
| 1
 +
| Normal*
 +
| Control + Drop key (Q) (* Clicked item is always empty)
 +
|-
 +
! rowspan="9"| 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.
 +
|-
 +
! rowspan="2"| 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):
 +
 
 +
# packet with mode 5, slot -999, button (0 for left | 4 for right);
 +
# packet for every slot painted on, mode is still 5, button (1 | 5);
 +
# 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.
  
=== Block Action (0x36) ===
+
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.
  
''Server to Client''
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| ''protocol:''<br/><code>{{change|0x0F|0x11}}</code><br/><br/>''resource:''<br/><code>container_close</code>
 +
| Play
 +
| Server
 +
| Window ID
 +
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
 +
| This is the ID of the window that was closed. 0 for player inventory.
 +
|}
  
This packet is used for a number of things:
+
==== Edit Book ====
* <div class="li">Chests opening and closing
 
* Pistons pushing and pulling
 
* Note blocks playing
 
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="6" | 0x36
+
| rowspan="5"| ''protocol:''<br/><code>{{change|0x14|0x16}}</code><br/><br/>''resource:''<br/><code>edit_book</code>
| class="col1 centeralign" | X
+
| rowspan="5"| Play
| class="col2 centeralign" | int
+
| rowspan="5"| Server
| class="col3 centeralign" | <code>502</code>
+
| Slot
| class="col4" | Block X Coordinate
+
| {{Type|VarInt}}
|- class="row2"
+
| The hotbar slot where the written book is located
| class="col0 centeralign" | Y
+
|-
| class="col1 centeralign" | short
+
| Count
| class="col2 centeralign" | <code>71</code>
+
| {{Type|VarInt}}
| class="col3" | Block Y Coordinate
+
| Number of elements in the following array. Maximum array size is {{change|200|100}}.
|- class="row3"
+
|-
| class="col0 centeralign" | Z
+
| Entries
| class="col1 centeralign" | int
+
| {{Type|Array}} ({{change|200|100}}) of {{Type|String}} ({{change|8192|1024}})
| class="col2 centeralign" | <code>18</code>
+
| Text from each page. Maximum string length is {{change|8192|1024}} chars.
| class="col3" | Block Z Coordinate
+
|-
|- class="row4"
+
| Has title
| class="col0 centeralign" | Byte 1
+
| {{Type|Boolean}}
| class="col1 centeralign" | byte
+
| If true, the next field is present. true if book is being signed, false if book is being edited.
| class="col2 centeralign" | <code>3</code>
+
|-
| class="col3" | Varies depending on block - see below
+
| Title
|- class="row5"
+
| {{Type|Optional}} {{Type|String}} ({{change|128|32}})
| class="col0 centeralign" | Byte 2
+
| Title of book.
| class="col1 centeralign" | byte
+
|}
| class="col2 centeralign" | <code>17</code>
+
 
| class="col3" | Varies depending on block - see below
+
==== Set Player Position ====
|- class="row6"
+
 
| class="col0 centeralign" | Block ID
+
Updates the player's XYZ position on the server.
| class="col1 centeralign" | byte
+
 
| class="col2 centeralign" | <code>29</code>
+
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.
| class="col3" | The block id this action is set for
+
 
|- class="row7"
+
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.
! class="col0" | Total Size:
+
 
| class="col1 rightalign" colspan="4" | 13 bytes
+
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:
  
See Also: [[Block Actions]]
+
* 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.
  
=== Update Tile Entity (0x84) ===
+
Checking for illegal flight is achieved like this:
  
''Server to Client''
+
* 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>.
  
Essentially a block update on a tile entity.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="5"| ''protocol:''<br/><code>{{change|0x1A|0x1C}}</code><br/><br/>''resource:''<br/><code>move_player_pos</code>
 +
| rowspan="5"| Play
 +
| rowspan="5"| Server
 +
| X
 +
| {{Type|Double}}
 +
| Absolute position.
 +
|-
 +
| Feet Y
 +
| {{Type|Double}}
 +
| Absolute feet position, normally Head Y - 1.62.
 +
|-
 +
| Z
 +
| {{Type|Double}}
 +
| 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.
 +
|}
 +
 
 +
==== Set Player Position and Rotation ====
 +
 
 +
A combination of [[#Set Player Rotation|Move Player Rotation]] and [[#Set Player Position|Move Player Position]].
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan="6" | 0x84
+
| rowspan="7"| ''protocol:''<br/><code>{{change|0x1B|0x1D}}</code><br/><br/>''resource:''<br/><code>move_player_pos_rot</code>
| class="col1 centeralign" | X
+
| rowspan="7"| Play
| class="col2 centeralign" | int
+
| rowspan="7"| Server
| class="col3 centeralign" |  
+
| X
| class="col4" |
+
| {{Type|Double}}
|- class="row2"
+
| Absolute position.
| class="col0 centeralign" | Y
+
|-
| class="col1 centeralign" | short
+
| Feet Y
| class="col2 centeralign" |
+
| {{Type|Double}}
| class="col3" |
+
| Absolute feet position, normally Head Y - 1.62.
|- class="row3"
+
|-
| class="col0 centeralign" | Z
+
| Z
| class="col1 centeralign" | int
+
| {{Type|Double}}
| class="col2 centeralign" |
+
| Absolute position.
| class="col3" |
+
|-
|- class="row4"
+
| Yaw
| class="col0 centeralign" | Action
+
| {{Type|Float}}
| class="col1 centeralign" | byte
+
| Absolute rotation on the X Axis, in degrees.
| class="col2 centeralign" |
+
|-
| class="col3" | The type of update to perform
+
| Pitch
|- class="row5"
+
| {{Type|Float}}
| class="col0 centeralign" | Data length
+
| Absolute rotation on the Y Axis, in degrees.
| class="col1 centeralign" | Short
+
|- {{removed}}
| class="col2 centeralign" |  
+
| On Ground
| class="col3" | Varies
+
| {{Type|Boolean}}
|- class="row6"
+
| True if the client is on the ground, false otherwise.
| class="col0 centeralign" | NBT Data
+
|- {{added}}
| class="col1 centeralign" | Byte Array - Present if data length > 0
+
| Flags
| class="col2 centeralign" |  
+
| {{Type|Byte}}
| class="col3" | Varies
+
| Bit field: 0x01: on ground, 0x02: pushing against wall.
|- class="row7"
+
|}
! class="col0" | Total Size:
+
 
| class="col1 rightalign" colspan="4" | 12 + itemstack bytes
+
==== 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.
  
'''Actions'''
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
* '''1''': Set mob displayed inside a mob spawner. Custom 1 contains the [[Entities#Mobs|mob type]]
+
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:
  
=== Explosion (0x3C) ===
+
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
  
''Server to Client''
+
You can get a unit vector from a given yaw/pitch via:
  
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
+
x = -cos(pitch) * sin(yaw)
 +
y = -sin(pitch)
 +
z =  cos(pitch) * cos(yaw)
  
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan=9 | 0x3C
+
| rowspan="4"| ''protocol:''<br/><code>{{change|0x1C|0x1E}}</code><br/><br/>''resource:''<br/><code>move_player_rot</code>
| class="col1 centeralign" | X
+
| rowspan="4"| Play
| class="col2 centeralign" | double
+
| rowspan="4"| Server
| class="col3 centeralign" |  
+
| Yaw
| class="col4" |  
+
| {{Type|Float}}
|- class="row1"
+
| Absolute rotation on the X Axis, in degrees.
| class="col1 centeralign" | Y
+
|-
| class="col2 centeralign" | double
+
| Pitch
| class="col3 centeralign" |
+
| {{Type|Float}}
| class="col4" |
+
| Absolute rotation on the Y Axis, in degrees.
|- class="row1"
+
|- {{removed}}
| class="col1 centeralign" | Z
+
| On Ground
| class="col2 centeralign" | double
+
| {{Type|Boolean}}
| class="col3 centeralign" |
+
| True if the client is on the ground, false otherwise.
| class="col4" |
+
|- {{added}}
|- class="row1"
+
| Flags
| class="col1 centeralign" | Radius
+
| {{Type|Byte}}
| class="col2 centeralign" | float
+
| Bit field: 0x01: on ground, 0x02: pushing against wall.
| class="col3 centeralign" | 3.0
+
|}
| class="col4" | Currently unused in the client
+
{{Anchor|Set Player Movement Flags}}
|- class="row2"
+
==== Set Player {{change|On Ground|Movement Flags}} ====
| class="col1 centeralign" | Record count
+
 
| class="col2 centeralign" | int
+
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.
| class="col3 centeralign" |
+
 
| class="col4" | This is the count, not the size. The size is 3 times this value.
+
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
|- class="row3"
+
 
| class="col1 centeralign" | Records
+
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="col2 centeralign" | (byte, byte, byte) × count
 
| class="col3 centeralign" |
 
| class="col4" | Each record is 3 bytes, which seem to be XYZ offsets of affected blocks.
 
|- class="row4"
 
| class="col1 centeralign" | Unknown
 
| class="col2 centeralign" | float
 
| class="col3 centeralign" |
 
| class="col4" |
 
|- class="row5"
 
| class="col1 centeralign" | Unknown
 
| class="col2 centeralign" | float
 
| class="col3 centeralign" |
 
| class="col4" |
 
|- class="row6"
 
| class="col1 centeralign" | Unknown
 
| class="col2 centeralign" | float
 
| class="col3 centeralign" |  
 
| class="col4" |  
 
|- class="row7"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 45 bytes + 3*(Record count) bytes
 
|}
 
  
=== Player Abilities (0xCA) ===
 
This packet has now been compressed into 3 bytes. The latter 2 bytes are used to indicate the walking and flying sppeds respectively, while the first byte is used to determine the value of 4 booleans.
 
 
These booleans are whether damage is disabled (god mode), whether the player is flying, whether the player can fly, and whether the player is in creative mode.
 
 
To get the values of these booleans, simply AND (&) the byte with 1,2,4 and 8 respectively, to get the 0 or 1 bitwise value. To set them OR (|) them with their repspective masks.
 
 
{| class="wikitable"
 
{| class="wikitable"
|- class="row0"
+
! Packet ID
! class="col0" | Packet ID
+
! State
! class="col1" | Field Name
+
! Bound To
! class="col2" | Field Type
+
! Field Name
! class="col3" | Example
+
! Field Type
! class="col4" | Notes
+
! Notes
|- class="row1"
+
|-
| class="col0 centeralign" rowspan=4 | 0xCA
+
| rowspan="2"| ''protocol:''<br/><code>{{change|0x1D|0x1F}}</code><br/><br/>''resource:''<br/><code>move_player_status_only</code>
| class="col1 centeralign" | Flags
+
| rowspan="2"| Play
| class="col2 centeralign" | byte
+
| rowspan="2"| Server
| class="col3 centeralign" | 5
+
| {{removed}} | On Ground
| class="col4" |  
+
| {{removed}} | {{Type|Boolean}}
|- class="row2"
+
| {{removed}} | True if the client is on the ground, false otherwise.
| class="col1 centeralign" | Flying speed
+
|- {{added}}
| class="col2 centeralign" | byte
+
| Flags
| class="col3 centeralign" | 12
+
| {{Type|Byte}}
| class="col4" |  
+
| Bit field: 0x01: on ground, 0x02: pushing against wall.
|- class="row3"
+
|}
| class="col1 centeralign" | Walking speed
 
| class="col2 centeralign" | byte
 
| class="col3 centeralign" | 25
 
| class="col4" |
 
|- class="row2"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 4 bytes
 
|}
 
  
== Removed packets ==
+
==== Place Recipe ====
  
=== Chunk Allocation Packet (0x32) ===
+
This packet is sent when a player clicks a recipe in the crafting book that is craftable (white border).
The chunk Allocation Packet is not longer in use. Memory will automatically allocated with a incoming Map Chunk packet. To deallocate memory you need to send a MapChunk packet, which only contains biome data for plains(all biome bytes set to 1). So the Add and Primary bitmap must set to 0, and Ground-up continuous to true. Because the payload of this packet is compressed and static you can use a hardcoded value for it, so you don't need to compress it each time.
 
  
This is the payload which is used in the Compressed Data part to deallocate a chunk column:
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="3"| ''protocol:''<br/><code>{{change|0x22|0x24}}</code><br/><br/>''resource:''<br/><code>place_recipe</code>
 +
| rowspan="3"| Play
 +
| rowspan="3"| Server
 +
| Window ID
 +
| {{Type|Byte}}
 +
|
 +
|-
 +
| Recipe{{change|| ID}}
 +
| {{change|{{Type|Identifier}}|{{Type|VarInt}}}}
 +
| {{change|A recipe ID.|ID of recipe previously defined in [[#Recipe Book Add|Recipe Book Add]].}}
 +
|-
 +
| Make all
 +
| {{Type|Boolean}}
 +
| Affects the amount of items processed; true if shift is down when clicked.
 +
|}
  
0x78, 0x9C, 0x63, 0x64, 0x1C, 0xD9, 0x00, 0x00, 0x81, 0x80, 0x01, 0x01
+
==== Player Input ====
  
== Protocol History ==
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="3"| ''protocol:''<br/><code>{{change|0x26|0x28}}</code><br/><br/>''resource:''<br/><code>player_input</code>
 +
| rowspan="3"| Play
 +
| rowspan="3"| Server
 +
| {{removed}} | Sideways
 +
| {{removed}} | {{Type|Float}}
 +
| {{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.}}
 +
|}
  
=== 2012-07-24 ===
+
The flags are as follows:
* 12w30c
 
* Protocol version 39
 
* Changed packets 0x84
 
  
=== 2012-07-23 ===
+
{| class="wikitable" {{added}}
* 12w30a
+
|-
* Protocol version is still 38
+
! Hex Mask
* Changed packets 0x14 and 0x35
+
! Field
 +
|-
 +
| 0x01
 +
| Forward
 +
|-
 +
| 0x02
 +
| Backward
 +
|-
 +
| 0x04
 +
| Left
 +
|-
 +
| 0x08
 +
| Right
 +
|-
 +
| 0x10
 +
| Jump
 +
|-
 +
| 0x20
 +
| Sneak
 +
|-
 +
| 0x40
 +
| Sprint
 +
|}
  
=== 2012-07-05 ===
+
==== Set Seen Recipe ====
* 12w27a
 
* Protocol version is now 38
 
* Added packet 0x38
 
  
=== 2012-06-21 ===
+
Sent when recipe is first seen in recipe book. Replaces Recipe Book Data, type 0.
* 12w25a
 
* Packet 0xFC and 0xFD include a 4 byte long byte array. This is hashed with the public RSA key and sent back. See [[Protocol Encryption]] for further info.
 
* Packet 0x3E changed to include float rather than byte.
 
  
=== 2012-06-14 ===
+
{| class="wikitable"
* 12w24a
+
! Packet ID
* Protocol version is now 36
+
! State
* Changed Packet 0x01(Login Request), only used as Login Reply
+
! Bound To
* New Packet 0xCD used for Login Request and Respawn (1 byte payload)
+
! Field Name
* All items (except the empty hand) now send enchantment data
+
! Field Type
 +
! Notes
 +
|-
 +
| ''protocol:''<br/><code>{{change|0x29|0x2B}}</code><br/><br/>''resource:''<br/><code>recipe_book_seen_recipe</code>
 +
| Play
 +
| Server
 +
| Recipe ID
 +
| {{change|{{Type|Identifier}}|{{Type|VarInt}}}}
 +
| ID of recipe previously defined in [[#Recipe Book Add|Recipe Book Add]].
 +
|}
  
=== 2012-06-07 ===
+
==== Use Item On ====
* 12w23b
 
* Protocol version is now 35
 
* Change packet: Player Block Placement
 
* New Packet: Block breaking animation
 
  
=== 2012-05-24 ===
+
{| class="wikitable"
* 12w21a
+
|-
* No packet changes but the algorithm was changed to AES128 with the shared key as the IV, will be described in [[Protocol Encryption]]
+
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="9"| ''protocol:''<br/><code>{{change|0x38|0x3A}}</code><br/><br/>''resource:''<br/><code>use_item_on</code>
 +
| rowspan="9"| Play
 +
| rowspan="9"| Server
 +
| Hand
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| The hand from which the block is placed; 0: main hand, 1: off hand.
 +
|-
 +
| Location
 +
| {{Type|Position}}
 +
| Block position.
 +
|-
 +
| Face
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| The face on which the block is placed (as documented at [[#Player Action|Player Action]]).
 +
|-
 +
| Cursor Position X
 +
| {{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.
 +
|-
 +
| Inside block
 +
| {{Type|Boolean}}
 +
| True when the player's head is inside of a block.
 +
|- {{added}}
 +
| World border hit
 +
| {{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.
 +
|-
 +
| Sequence
 +
| {{Type|VarInt}}
 +
| Block change sequence number (see [[#Acknowledge Block Change]]).
 +
|}
  
=== 2012-05-10 ===
+
Upon placing a block, this packet is sent once.
* 12w19a
 
* No packet changes, but an other encryption algorythm is used, described in [[Protocol Encryption]]
 
* The items which are not enchantable in 12w18a are now readded
 
* Fishing floats, spawned by a 0x17 packet do now use the extra fields
 
  
=== 2012-05-03 ===
+
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.
* 12w18a
 
* Protocol version is now 32
 
* New packet: 0x3D Name Sound Effect
 
* Changed packet: 0x01 Login Request
 
* Changed packet: 0x02 Handshake
 
* Changed packet: 0xCA Player Abilities
 
* Changed packet: 0xCC Locale and View Distance
 
* Changed packet: 0x09 Respawn
 
* Removed packet: 0x32 Map Column Allocation
 
* This items are not enchantable in this version: 0x103, 0x105, 0x15A, 0x167, 0x10C, 0x10D, 0x10E, 0x10F, 0x122, 0x110, 0x111, 0x112, 0x113, 0x123, 0x10B, 0x100, 0x101, 0x102, 0x124, 0x114, 0x115, 0x116, 0x117, 0x125, 0x11B, 0x11C, 0x11D, 0x11E, 0x126
 
  
=== 2012-04-26 ===
+
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).
* 12w17a
 
* Protocol version is now 31
 
* RC4 based encryption, described in [[Protocol Encryption]]
 
* Changed packet: 0x01 Login Request
 
* Changed packet: 0x02 Handshake
 
* Changed packet: 0xCC Locale and View Distance
 
* Changed packet: 0xCA Player Abilities
 
* New packet: 0xFC Encryption Key Response
 
* New packet: 0xFD Encryption Key Request
 
* New Item: Book & Quills (0x182) is enchantable
 
* New Item: Written Book (0x183) is enchantable
 
  
=== 2012-04-19 ===
+
[[Category:Minecraft Modern]]
* 12w16a
 
* Protocol version is now 30
 
* New packet: 0xCB Tab-complete
 
* New packet: 0xCC Locale and View Distance
 

Latest revision as of 04:42, 24 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

Contents

Data types

Name Size (bytes) Encodes Notes
Teleport Flags 4 See #Teleport Flags Bit field specifying how a teleportation is to be applied on each axis.
Recipe Display Varies See Recipes#Recipe Display structure Description of a recipe for use for use by the client.

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
0x77 0x7e Update Recipes Current 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.

Recipes

(this is meant to become a new page.)

Recipe Display structure

Name Type Description
Recipe Display Type VarInt ID in the minecraft:recipe_display registry.
Data Varies See #Recipe Display types below.

Recipe Display types

ID Name Data
0 minecraft:crafting_shapeless data
1 minecraft:crafting_shaped data
2 minecraft:furnace data
3 minecraft:stonecutter data
4 minecraft:smithing data
minecraft:crafting_shapeless
Name Type Description
Ingredient Count VarInt Number of elements in the following array.
Ingredients Array of Slot Display
Result Slot Display
Crafting Station Slot Display Crafting station icon to display in the recipe notification.
minecraft:crafting_shaped
Name Type Description
Width VarInt
Height VarInt
Ingredient Count VarInt Number of elements in the following array. Always equal to Width * Height.
Ingredients Array of Slot Display
Result Slot Display
Crafting Station Slot Display Crafting station icon to display in the recipe notification.
minecraft:furnace
Name Type Description
Ingredient Slot Display
Fuel Slot Display
Result Slot Display
Crafting Station Slot Display Crafting station icon to display in the recipe notification.
Cooking Time VarInt Time to smelt in a regular furnace, in ticks.
Experience Float
minecraft:stonecutter
Name Type Description
Ingredient Slot Display
Result Slot Display
Crafting Station Slot Display Crafting station icon to display in the recipe notification.
minecraft:smithing
Name Type Description
Template Slot Display
Base Slot Display
Addition Slot Display
Result Slot Display
Crafting Station Slot Display Crafting station icon to display in the recipe notification.

Slot Display structure

Name Type Description
Slot Display Type VarInt ID in the minecraft:slot_display registry.
Data Varies See #Slot Display types below.

Slot Display types

ID Name Data
0 minecraft:empty no data
1 minecraft:any_fuel no data
2 minecraft:item data
3 minecraft:item_stack data
4 minecraft:tag data
5 minecraft:smithing_trim data
6 minecraft:with_remainder data
7 minecraft:composite data
minecraft:item
Name Type Description
Item Type VarInt ID in the minecraft:item registry.
minecraft:item_stack
Name Type Description
Item Stack Slot
minecraft:tag
Name Type Description
Tag Identifier Tag in the minecraft:item registry. Not prefixed by '#'!.
minecraft:smithing_trim
Name Type Description
Base Slot Display
Material Slot Display
Pattern Slot Display
minecraft:with_remainder
Name Type Description
Ingredient Slot Display
Remainder Slot Display
minecraft:composite
Name Type Description
Option Count VarInt Number of elements in the following array.
Options Array of Slot Display

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 Recipe Display

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 Recipe Display
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

Update Recipes

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

resource:
update_recipes
Play Client Num Recipes VarInt Number of elements in the following array.
Recipe Recipe ID Array Identifier
Type ID VarInt Enum The recipe type, see below.
Data Varies Additional data for the recipe.
Property Set Count VarInt Number of elements in the following array.
Property Sets Property Set ID Array Identifier
Item Count VarInt Number of elements in the following array.
Items Array of VarInt IDs in the minecraft:item registry.

Recipe types:

ID Type Description Data
0 minecraft:crafting_shaped Shaped crafting recipe. All items must be present in the same pattern (which may be flipped horizontally or translated). As follows:
Name Type Description
Group String (32767) Used to group similar recipes together in the recipe book. Tag is present in recipe JSON.
Category VarInt Enum Building = 0, Redstone = 1, Equipment = 2, Misc = 3
Width VarInt
Height VarInt
Ingredients Array of Ingredient Length is width * height. Indexed by x + (y * width).
Result Slot
Show notification Boolean Show a toast when the recipe is added.
1 minecraft:crafting_shapeless Shapeless crafting recipe. All items in the ingredient list must be present, but in any order/slot. As follows:
Name Type Description
Group String (32767) Used to group similar recipes together in the recipe book. Tag is present in recipe JSON.
Category VarInt Enum Building = 0, Redstone = 1, Equipment = 2, Misc = 3
Ingredient count VarInt Number of elements in the following array.
Ingredients Array of Ingredient.
Result Slot
2 minecraft:crafting_special_armordye Recipe for dying leather armor As follows:
Name Type Description
Category VarInt Enum Building = 0, Redstone = 1, Equipment = 2, Misc = 3
3 minecraft:crafting_special_bookcloning Recipe for copying contents of written books
4 minecraft:crafting_special_mapcloning Recipe for copying maps
5 minecraft:crafting_special_mapextending Recipe for adding paper to maps
6 minecraft:crafting_special_firework_rocket Recipe for making firework rockets
7 minecraft:crafting_special_firework_star Recipe for making firework stars
8 minecraft:crafting_special_firework_star_fade Recipe for making firework stars fade between multiple colors
9 minecraft:crafting_special_tippedarrow Recipe for crafting tipped arrows
10 minecraft:crafting_special_bannerduplicate Recipe for copying banner patterns
11 minecraft:crafting_special_shielddecoration Recipe for applying a banner's pattern to a shield
12 minecraft:crafting_special_shulkerboxcoloring Recipe for recoloring a shulker box
13 minecraft:crafting_special_suspiciousstew Recipe for crafting suspicious stews
14 minecraft:crafting_special_repairitem Recipe for repairing items via crafting
22 minecraft:crafting_decorated_pot Recipe for crafting decorated pots
15 minecraft:smelting Smelting recipe As follows:
Name Type Description
Group String (32767) Used to group similar recipes together in the recipe book.
Category VarInt Enum Food = 0, Blocks = 1, Misc = 2
Ingredient Ingredient
Result Slot
Experience Float
Cooking time VarInt
16 minecraft:blasting Blast furnace recipe
17 minecraft:smoking Smoker recipe
18 minecraft:campfire_cooking Campfire recipe
19 minecraft:stonecutting Stonecutter recipe As follows:
Name Type Description
Group String (32767) Used to group similar recipes together in the recipe book. Tag is present in recipe JSON.
Ingredient Ingredient
Result Slot
20 minecraft:smithing_transform Recipe for smithing netherite gear As follows:
Name Type Description
Template Ingredient The smithing template.
Base Ingredient The base item.
Addition Ingredient The additional ingredient.
Result Slot
21 minecraft:smithing_trim Recipe for applying armor trims As follows:
Name Type Description
Template Ingredient The smithing template.
Base Ingredient The base item.
Addition Ingredient The additional ingredient.

Ingredient is defined as:

Name Type Description
Count VarInt Number of elements in the following array.
Items Array of Slot Any item in this array may be used for the recipe. The count of each item should be 1.

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).