Difference between revisions of "Pre-release protocol"

From wiki.vg
Jump to navigation Jump to search
(→‎Entity Metadata: Arrow and firework metadata meaning)
(Most 1.21.2 packet changes (with the exception of Update Recipes).)
(525 intermediate revisions by 44 users not shown)
Line 1: Line 1:
This page documents the changes from the [[Protocol|last stable Minecraft release]] (currently [[Protocol version numbers|1.13.2, protocol 404]]) to the current pre-release (currently [[Protocol version numbers|18w44a, protocol 443]]). Note that this page contains bleeding-edge information that may not be completely or correctly documented.
+
This page documents the changes from release 1.21.1 (protocol 767) to the current release (1.21.3, protocol 768). The stable protocol documentation is currently lagging behind, and the changes documented here will be merged soon, once they are complete. The current pre-release (snapshot 24w44a) is not yet documented.
  
 
One who wishes to commandeer the merging of this into [[Protocol]] when an update is made must be sure to respect any changes that may have occurred to the respective packets there.
 
One who wishes to commandeer the merging of this into [[Protocol]] when an update is made must be sure to respect any changes that may have occurred to the respective packets there.
Line 9: Line 9:
 
=== Data types ===
 
=== Data types ===
  
==== Position ====
+
{| class="wikitable"
 +
|-
 +
! Name
 +
! Size (bytes)
 +
! Encodes
 +
! Notes
 +
|- {{added}}
 +
! id=Type:Teleport_Flags | {{Type|Teleport Flags}}
 +
| 4
 +
| Bit field specifying how a teleportation is to be applied on each axis.
 +
| See [[#Teleport Flags]]
 +
|- {{added}}
 +
! id=Type:ID_Set | {{Type|ID Set}}
 +
| Varies
 +
| Set of registry IDs specified either inline or as a reference to a tag.
 +
| See [[#ID Set]]
 +
|}
  
64-bit value split in to three parts
+
==== Teleport Flags ====
  
* x: 26 MSBs
+
A bit field represented as an {{Type|Int}}, specifying how a teleportation is to be applied on each axis.
* z: 26 {{change|LSBs|middle bits}}
 
* y: 12 {{change|bits between them|LSBs}}
 
  
Encoded as followed:
+
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.
  
  ((x & 0x3FFFFFF) << 38) | {{change|((y & 0xFFF) << 26) {{!}} (z & 0x3FFFFFF)|((z & 0x3FFFFFF) << 12) {{!}} (y & 0xFFF)}}
+
{| 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.
 +
|}
  
And decoded as:
+
==== ID Set ====
  
val = read_unsigned_long();
+
Represents a set of IDs in a certain registry (implied by context), either directly (enumerated IDs) or indirectly (tag name).
x = val >> 38;
 
y = {{change|(val >> 26) & 0xFFF|val & 0xFFF}};
 
z = {{change|val << 38 >> 38|(val << 38 >> 38) >> 12}};
 
  
Note: The details of bit shifting are rather language dependent; the above may work in Java but probably won't in other languages without some tweaking. In particular, you will usually receive positive numbers even if the actual coordinates are negative. This can be fixed by adding something like the following:
+
{| class="wikitable" {{added}}
 
+
! Name
  if x >= 2^25 { x -= 2^26 }
+
! Type
  if y >= 2^11 { y -= 2^12 }
+
! Description
  if z >= 2^25 { z -= 2^26 }
+
|-
 +
| Type
 +
| {{Type|VarInt}}
 +
| Identifier used to determine the data that follows. It can be either:
 +
* 0 - Represents a named set of IDs defined by a tag.
 +
* Anything else - Represents an ad-hoc set of IDs enumerated inline.
 +
|-
 +
| Tag Name
 +
  | {{Type|Optional}} {{Type|Identifier}}
 +
  | The registry tag defining the ID set. Only present if Type is 0.
 +
|-
 +
| IDs
 +
| {{Type|Optional}} {{Type|Array}} of {{Type|VarInt}}
 +
  | An array of registry IDs. Only present if Type is not 0.<br>The size of the array is equal to <code>Type - 1</code>.
 +
|}
  
 
=== Packets ===
 
=== Packets ===
Line 41: Line 97:
 
  !colspan="2"| Documentation
 
  !colspan="2"| Documentation
 
  |-
 
  |-
!colspan="4"| Handshaking serverbound
+
!colspan="4"| Play clientbound
{{PacketList|0x00|Handshake}}
+
{{PacketList|0x12|Close Container}}
 +
{{PacketList|0x13|Set Container Content}}
 +
{{PacketList|0x14|Set Container Property}}
 +
{{PacketList|0x15|Set Container Slot}}
 +
{{PacketList|0x17|Set Cooldown}}
 +
{{PacketList|0x20|Synchronize Entity Position|rel=added}}
 +
{{PacketList|{{change|0x20|0x21}}|Explosion}}
 +
{{PacketList|{{change|0x23|0x24}}|Open Horse Screen}}
 +
{{PacketList|{{change|0x2B|0x2C}}|Login (play)}}
 +
{{PacketList|0x31|Move Minecart Along Track|rel=added}}
 +
{{PacketList|{{change|0x37|0x39}}|Place Ghost Recipe}}
 +
{{PacketList|{{change|0x3E|0x40}}|Player Info Update}}
 +
{{PacketList|{{change|0x40|0x42}}|Synchronize Player Position}}
 +
{{PacketList|0x41|Update Recipe Book|pre=removed}}
 +
{{PacketList|0x43|Player Rotation|rel=added}}
 +
{{PacketList|0x44|Recipe Book Add|rel=added}}
 +
{{PacketList|0x45|Recipe Book Remove|rel=added}}
 +
{{PacketList|0x46|Recipe Book Settings|rel=added}}
 +
{{PacketList|{{change|0x47|0x4C}}|Respawn}}
 +
{{PacketList|0x5a|Set Cursor Item|rel=added}}
 +
{{PacketList|{{change|0x53|0x63}}|Set Held Item|pre=unchanged}}
 +
{{PacketList|0x66|Set Player Inventory Slot|rel=added}}
 +
{{PacketList|{{change|0x64|0x6b}}|Update Time}}
 +
{{PacketList|{{change|0x70|0x77}}|Teleport Entity}}
 
  |-
 
  |-
!colspan="4"| Play clientbound
+
!colspan="4"| Play serverbound
{{PacketList|0x22|Chunk Data}}
+
{{PacketList|0x02|Bundle Item Selected|rel=added}}
{{PacketList|0x4E|Entity Sound Effect|rel=added}}
+
{{PacketList|0x0b|Client Tick End|rel=added}}
{{PacketList|{{change|0x4E|0x4F}}|Player List Header And Footer|pre=unchanged}}
+
{{PacketList|{{change|0x0E|0x10}}|Click Container}}
{{PacketList|{{change|0x4F|0x50}}|Collect Item|pre=unchanged}}
+
{{PacketList|{{change|0x0F|0x11}}|Close Container}}
{{PacketList|{{change|0x50|0x51}}|Entity Teleport|pre=unchanged}}
+
{{PacketList|{{change|0x14|0x16}}|Edit Book}}
{{PacketList|{{change|0x51|0x52}}|Advancements|pre=unchanged}}
+
{{PacketList|{{change|0x1A|0x1C}}|Set Player Position}}
{{PacketList|{{change|0x52|0x53}}|Entity Properties|pre=unchanged}}
+
{{PacketList|{{change|0x1B|0x1D}}|Set Player Position and Rotation}}
{{PacketList|{{change|0x53|0x54}}|Entity Effect|pre=unchanged}}
+
{{PacketList|{{change|0x1C|0x1E}}|Set Player Rotation}}
{{PacketList|{{change|0x54|0x55}}|Declare Recipes|pre=unchanged}}
+
{{PacketList|0x1D|Set Player On Ground|pre=removed}}
{{PacketList|{{change|0x55|0x56}}|Tags}}
+
{{PacketList|0x1F|Set Player Movement Flags|rel=added}}
{{PacketList|0x57|Update Light|rel=added}}
+
{{PacketList|{{change|0x22|0x24}}|Place Recipe}}
 +
{{PacketList|{{change|0x26|0x28}}|Player Input}}
 +
{{PacketList|{{change|0x29|0x2B}}|Set Seen Recipe}}
 
  |}
 
  |}
  
== New/modified data types ==
+
== Handshake ==
 +
 
 +
No changes so far.
 +
 
 +
== Status ==
  
 
No changes so far.
 
No changes so far.
  
== Entity Metadata ==
+
== Login ==
 +
 
 +
No changes so far.
  
=== Mobs ===
+
== Configuration ==
  
Entity IDs have shifted with the addition of some new mobs.
+
No changes so far.
  
=== Arrow ===
+
== Play ==
  
Extends [[#Entity|Entity]].
+
=== Clientbound ===
  
Abstract base class for [[#TippedArrow|TippedArrow]] (which is used for regular arrows as well as tipped ones) and Spectral Arrow.
+
==== 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.
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Index
+
  ! Packet ID
  ! Type
+
  ! State
  !style="width: 250px;" colspan="2"| Meaning
+
! Bound To
  ! Default
+
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| 0x12
 +
| Play
 +
| Client
 +
| Window ID
 +
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
 +
| This is the ID of the window that was closed. 0 for inventory.
 +
|}
 +
 
 +
==== Set Container Content ====
 +
[[File:Inventory-slots.png|thumb|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]]).
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
  ! Notes
 +
|-
 +
| rowspan="5"| 0x13
 +
| rowspan="5"| Play
 +
| rowspan="5"| Client
 +
| Window ID
 +
| {{change|{{Type|Unsigned Byte}}|{{Type|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
 +
| {{Type|VarInt}}
 +
  | A server-managed sequence number used to avoid desynchronization; see [[#Click Container]].
 
  |-
 
  |-
  | rowspan="2" | 6
+
  | Count
  | rowspan="2" | Byte
+
  | {{Type|VarInt}}
! Bit mask
+
  | Number of elements in the following array.
! Meaning
 
  | rowspan="2" | 0
 
 
  |-
 
  |-
  | 0x01
+
  | Slot Data
  | Is critical
+
  | {{Type|Array}} of [[Slot Data|Slot]]
 
  |-
 
  |-
  | 7
+
  | Carried Item
  | OptUUID
+
  | {{Type|Slot}}
|colspan="2"| Shooter UUID
+
  | Item being dragged with the mouse.
| Empty
 
|- {{added}}
 
  | 8
 
| Byte
 
|colspan="2"| Piercing level
 
| 0
 
 
  |}
 
  |}
  
=== TippedArrow ===
+
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.
  
Extends [[#Arrow|Arrow]].
+
==== Set Container Property ====
  
Used for both tipped and regular arrows.  If not tipped, then color is set to -1 and no tipped arrow particles are used.
+
This packet is used to inform the client that part of a GUI window should be updated.
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Index
+
  ! Packet ID
  ! Type
+
  ! State
  !style="width: 250px;" colspan="2"| Meaning
+
! Bound To
  ! Default
+
! Field Name
 +
! Field Type
 +
  ! Notes
 +
|-
 +
| rowspan="3"| 0x14
 +
| rowspan="3"| Play
 +
| rowspan="3"| Client
 +
| Window ID
 +
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
 +
  |
 +
|-
 +
| Property
 +
| {{Type|Short}}
 +
| The property to be updated, see below.
 
  |-
 
  |-
  | {{change|8|9}}
+
| Value
  | VarInt
+
  | {{Type|Short}}
|colspan="2"| Color (-1 for no particles)
+
  | The new value for the property, see below.
| -1
 
 
  |}
 
  |}
  
=== Trident ===
+
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.
 
 
Extends [[#Arrow|Arrow]].
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Index
 
! Type
 
!style="width: 250px;" colspan="2"| Meaning
 
! Default
 
 
  |-
 
  |-
  | {{change|8|9}}
+
! Window type
  | VarInt
+
! Property
  |colspan="2"| Loyalty level (enchantment)
+
! Value
  | 0
+
|-
 +
| 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.
 
  |}
 
  |}
  
=== Fireworks ===
+
For an enchanting table, the following numerical IDs are used:
 
 
Extends [[#Entity|Entity]].
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Index
+
  ! Numerical ID
  ! Type
+
  ! Enchantment ID
  !style="width: 250px;" colspan="2"| Meaning
+
  ! Enchantment Name
  ! Default
+
|-
 +
| 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
 
  | 6
  | [[Slot]]
+
  | minecraft:aqua_affinity
  |colspan="2"| Firework info
+
  | Aqua Affinity
| empty
 
 
  |-
 
  |-
 
  | 7
 
  | 7
  | VarInt
+
  | minecraft:thorns
  |colspan="2"| Entity ID of entity which used firework (for elytra boosting)
+
  | Thorns
| 0
+
  |-
  |- {{Added}}
 
 
  | 8
 
  | 8
  | Boolean
+
  | minecraft:depth_strider
  |colspan="2"| Shot at angle (from a crossbow)
+
| Depth Strider
  | false
+
  |-
  |}
+
| 9
 
+
  | minecraft:frost_walker
=== Panda ===
+
  | Frost Walker
 
+
|-
Extends [[#Animal|Animal]].
+
| 10
 
+
| minecraft:binding_curse
{| class="wikitable" {{added}}
+
| Curse of Binding
  ! Index
+
|-
  ! Type
+
| 11
  !style="width: 250px;" colspan="2"| Meaning
+
| minecraft:soul_speed
  ! Default
+
| Soul Speed
 +
  |-
 +
  | 12
 +
  | minecraft:swift_sneak
 +
  | Swift Sneak
 
  |-
 
  |-
 
  | 13
 
  | 13
  | Integer
+
  | minecraft:sharpness
  |colspan="2"| Unknown
+
  | Sharpness
| 0
 
 
  |-
 
  |-
 
  | 14
 
  | 14
  | Integer
+
  | minecraft:smite
  |colspan="2"| Unknown
+
  | Smite
| 0
 
 
  |-
 
  |-
 
  | 15
 
  | 15
  | Integer
+
  | minecraft:bane_of_arthropods
  |colspan="2"| Unknown
+
  | Bane of Arthropods
| 0
 
 
  |-
 
  |-
 
  | 16
 
  | 16
  | Byte
+
  | minecraft:knockback
  |colspan="2"| Unknown
+
  | Knockback
| 0
 
 
  |-
 
  |-
 
  | 17
 
  | 17
  | Byte
+
  | minecraft:fire_aspect
  |colspan="2"| Unknown
+
  | Fire Aspect
| 0
 
 
  |-
 
  |-
 
  | 18
 
  | 18
  | Byte
+
  | minecraft:looting
  |colspan="2"| Unknown
+
| Looting
  | 0
+
|-
 +
| 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="4"| 0x15
 +
| 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}}
 +
|
 
  |}
 
  |}
  
=== Pillager ===
+
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.
  
Extends [[#Abstract Illager|Abstract Illlager]].
+
==== 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).
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="2"| 0x17
 +
| rowspan="2"| Play
 +
| rowspan="2"| Client
 +
| {{change|Item ID|Cooldown Group}}
 +
| {{change|{{Type|VarInt}}|{{Type|Identifier}}}}
 +
| {{change|Numeric ID of the item|Group of items}} to apply a cooldown to.
 +
|-
 +
| Cooldown Ticks
 +
| {{Type|VarInt}}
 +
| Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
 +
|}
 +
 
 +
==== Synchronize Entity Position ====
  
 
{| class="wikitable" {{added}}
 
{| class="wikitable" {{added}}
  ! Index
+
  ! Packet ID
  ! Type
+
  ! State
  !style="width: 250px;" colspan="2"| Meaning
+
! Bound To
  ! Default
+
! Field Name
 +
! Field Type
 +
  ! Notes
 +
|-
 +
| rowspan="10"| 0x20
 +
| rowspan="10"| Play
 +
| rowspan="10"| 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 X axis, in degrees.
 +
|-
 +
| Pitch
 +
| {{Type|Float}}
 +
| Rotation on the Y axis, in degrees.
 
  |-
 
  |-
  | 13
+
  | On Ground
  | Boolean
+
  | {{Type|Boolean}}
  | colspan="2"| Unknown
+
  |
| false
+
|}
|}
+
 
 +
==== Explosion ====
  
=== Ocelot ===
+
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
  
Extends {{change|[[#TameableAnimal|TameableAnimal]]|[[#Ageable|Ageable]]}}.
+
{{change|Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x|}}
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Index
+
  ! Packet ID
  ! Type
+
  ! State
  !style="width: 250px;" colspan="2"| Meaning
+
! Bound To
  ! Default
+
! colspan="2" | Field Name
 +
! Field Type
 +
  ! Notes
 +
|-
 +
| rowspan="19"| {{change|0x20|0x21}}
 +
| rowspan="19"| Play
 +
| rowspan="19"| Client
 +
| colspan="2" | X
 +
| {{Type|Double}}
 +
|
 +
|-
 +
| colspan="2" | Y
 +
  | {{Type|Double}}
 +
|
 +
|-
 +
| colspan="2" | Z
 +
| {{Type|Double}}
 +
|
 +
|- {{removed}}
 +
| colspan="2" | Strength
 +
| {{Type|Float}}
 +
| If the strength is greater or equal to 2.0, or the block interaction is not 0 (keep), large explosion particles are used. Otherwise, small explosion particles are used.
 +
|- {{removed}}
 +
| colspan="2" | Record Count
 +
| {{Type|VarInt}}
 +
| Number of elements in the following array.
 
  |- {{removed}}
 
  |- {{removed}}
| 15
+
  | colspan="2" | Records
| VarInt
+
| {{Type|Array}} of ({{Type|Byte}}, {{Type|Byte}}, {{Type|Byte}})
  |colspan="2"| Type (0 = untamed, 1 = tuxedo, 2 = tabby, 3 = siamese). Used to render regardless as to whether it is tamed or not.
+
  | Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
| 0
 
 
  |- {{added}}
 
  |- {{added}}
  | 13
+
  | colspan="2" | Has Player Motion
  | Boolean
+
  | {{Type|Boolean}}
  |colspan="2"| Unknown
+
|
  | false
+
|-
 +
| colspan="2" | Player Motion X
 +
| {{change||{{Type|Optional}} }}{{Type|Float}}
 +
| X velocity of the player being pushed by the explosion.{{change|| Only present if Has Player Motion is true.}}
 +
|-
 +
| colspan="2" | Player Motion Y
 +
| {{change||{{Type|Optional}} }}{{Type|Float}}
 +
| Y velocity of the player being pushed by the explosion.{{change|| Only present if Has Player Motion is true.}}
 +
|-
 +
| colspan="2" | Player Motion Z
 +
| {{change||{{Type|Optional}} }}{{Type|Float}}
 +
| Z velocity of the player being pushed by the explosion.{{change|| Only present if Has Player Motion is true.}}
 +
|- {{removed}}
 +
| colspan="2" | Block Interaction
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| 0 = keep, 1 = destroy, 2 = destroy_with_decay, 3 = trigger_block.
 +
|-
 +
| colspan="2" | {{change|Small |}}Explosion Particle ID
 +
| {{Type|VarInt}}
 +
| The particle ID listed in [[Particles]].
 +
|-
 +
| colspan="2" | {{change|Small |}}Explosion Particle Data
 +
| Varies
 +
| Particle data as specified in [[Particles]].
 +
|- {{removed}}
 +
| colspan="2" | Large Explosion Particle ID
 +
| {{Type|VarInt}}
 +
| The particle ID listed in [[Particles]].
 +
|- {{removed}}
 +
  | colspan="2" | Large Explosion Particle Data
 +
| Varies
 +
| Particle data as specified in [[Particles]].
 +
|-
 +
| rowspan="4" | Explosion Sound
 +
| Sound ID
 +
| {{Type|VarInt}}
 +
| Represents the <code>Sound ID + 1</code>. If the value is 0, the packet contains a sound specified by Identifier.
 +
|-
 +
| Sound Name
 +
| {{Type|Optional}} {{Type|Identifier}}
 +
| The name of the sound played. Only present if Sound ID is 0.
 +
|-
 +
| Has Fixed Range
 +
| {{Type|Optional}} {{Type|Boolean}}
 +
| Whether is has fixed range. Only present if Sound ID is 0.
 +
|-
 +
| Range
 +
| {{Type|Optional}} {{Type|Float}}
 +
| The fixed range of the sound. Only present if previous boolean is true and Sound ID is 0.
 +
|}
 +
 
 +
==== Open Horse Screen ====
 +
 
 +
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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="3"| 0x23
 +
| rowspan="3"| Play
 +
| rowspan="3"| Client
 +
| Window ID
 +
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
 +
|
 +
|-
 +
| Slot count
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Entity ID
 +
| {{Type|Int}}
 +
  |
 
  |}
 
  |}
  
=== Cat ===
 
  
Extends [[#TameableAnimal|TameableAnimal]].
+
==== Login (play) ====
 +
 
 +
{{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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! 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}}
 
{| class="wikitable" {{added}}
  ! Index
+
  ! Packet ID
  ! Type
+
  ! State
  !style="width: 250px;" colspan="2"| Meaning
+
! Bound To
  ! Default
+
! colspan="2"| Field Name
 +
! colspan="2"| Field Type
 +
  ! colspan="2"| Notes
 +
|-
 +
| rowspan="11"| 0x31
 +
| 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}}
 +
|}
 +
 
 +
==== Player Info Update ====
 +
 
 +
Sent by the server to update the user list (<tab> in the client).
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! colspan="2"| Field Name
 +
! colspan="2"| Field Type
 +
! Notes
 +
|-
 +
| rowspan="4"| {{change|0x3E|0x40}}
 +
| rowspan="4"| Play
 +
| rowspan="4"| Client
 +
| colspan="2"| Actions
 +
| colspan="2"| {{Type|Byte}}
 +
| Determines what actions are present.
 +
|-
 +
| colspan="2"| Number Of Players
 +
| colspan="2"| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|-
 +
| rowspan="2" | Players
 +
| UUID
 +
| rowspan="2" | {{Type|Array}}
 +
| {{Type|UUID}}
 +
| The player UUID
 +
|-
 +
| Player Actions
 +
| {{Type|Array}} of [[#player-info:player-actions|Player&nbsp;Actions]]
 +
| The length of this array is determined by the number of [[#player-info:player-actions|Player Actions]] that give a non-zero value when applying its mask to the actions flag. For example given the decimal number 5, binary 00000101. The masks 0x01 and 0x04 would return a non-zero value, meaning the Player Actions array would include two actions: Add Player and Update Game Mode.
 +
|}
 +
 
 +
{| class="wikitable"
 +
|+ id="player-info:player-actions" | Player Actions
 +
! Action
 +
! Mask
 +
! colspan="2" | Field Name
 +
  ! 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}}
 
  |-
 
  |-
  | 15
+
  | Update Listed
  | VarInt
+
  | 0x08
  |colspan="2"| Type (0 = tabby, 1 = black, 2 = red, 3 = siamese, 4 = british_shorthair, 5 = calico, 6 = persian, 7 = ragdoll, 8 = white, 9 = all_black)
+
  | colspan="2" | Listed
  | 1
+
| colspan="2" | {{Type|Boolean}}
 +
  | Whether the player should be listed on the player list.
 
  |-
 
  |-
  | 16
+
  | Update Latency
  | Boolean
+
  | 0x10
  |colspan="2"| Unknown
+
  | colspan="2" | Ping
  | false
+
  | colspan="2" | {{Type|VarInt}}
 +
| Measured in milliseconds.
 
  |-
 
  |-
  | 17
+
  | rowspan="2" | Update Display Name
  | Boolean
+
  | rowspan="2" | 0x20
  |colspan="2"| Unknown
+
  | colspan="2" | Has Display Name
  | false
+
  | colspan="2" | {{Type|Boolean}}
 
  |-
 
  |-
  | 18
+
  | colspan="2" | Display Name
  | VarInt
+
| colspan="2" | {{Type|Optional}} {{Type|Text Component}}
  |colspan="2"| Unknown
+
| Only sent if Has Display Name is true.
  | unknown
+
|- {{added}}
 +
| Update List Priority
 +
  | 0x40
 +
| colspan="2" | Priority
 +
  | colspan="2" | {{Type|VarInt}}
 +
  | See below.
 
  |}
 
  |}
  
== Block Actions ==
+
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.
  
No changes so far.
+
==== Synchronize Player Position ====
  
== Play ==
+
Teleports the client, e.g. during login, when using an ender pearl, in response to invalid move packets, etc.
  
=== Clientbound ===
+
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.
  
==== Chunk Data ====
+
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]).
{{Main|Chunk Format}}
 
{{See also|#Unload Chunk}}
 
  
The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which dimenison the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent.  This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with [[#Update Block Entity|Update Block Entity]] later).
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 291: Line 1,077:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x22
+
  | rowspan="11"| ''protocol:''<br/><code>{{change|0x40|0x42}}</code><br/><br/>''resource:''<br/><code>player_position</code>
  |rowspan="9"| Play
+
  | rowspan="11"| Play
  |rowspan="9"| Client
+
  | rowspan="11"| Client
  | Chunk X
+
  | {{added}} | Teleport ID
  | Int
+
  | {{added}} | {{Type|VarInt}}
  | Chunk coordinate (block coordinate divided by 16, rounded down)
+
  | {{added}} | Client should confirm this packet with [[#Confirm Teleportation|Confirm Teleportation]] containing the same Teleport ID.
 
  |-
 
  |-
  | Chunk Z
+
  | X
  | Int
+
  | {{Type|Double}}
  | Chunk coordinate (block coordinate divided by 16, rounded down)
+
  | Absolute or relative position, depending on Flags.
 
  |-
 
  |-
  | Ground-Up Continuous
+
  | Y
  | Boolean
+
  | {{Type|Double}}
  | See [[Chunk Format#Ground-up continuous|Chunk Format]]
+
  | Absolute or relative position, depending on Flags.
 
  |-
 
  |-
  | Primary Bit Mask
+
  | Z
  | VarInt
+
  | {{Type|Double}}
  | Bitmask with bits set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
+
  | Absolute or relative position, depending on Flags.
  |- {{Added}}
+
  |- {{added}}
  | Unknown
+
  | Velocity X
  | [[NBT]]
+
| {{Type|Double}}
  | Possibly heightmap-related?
+
  |
  |-  
+
  |- {{added}}
  | Size
+
| Velocity Y
  | VarInt
+
| {{Type|Double}}
  | Size of Data in bytes
+
|
 +
  |- {{added}}
 +
  | Velocity Z
 +
  | {{Type|Double}}
 +
  |
 
  |-
 
  |-
  | Data
+
  | Yaw
  | Byte array
+
  | {{Type|Float}}
  | See [[Chunk Format#Data structure|data structure]] in Chunk Format
+
  | Absolute or relative rotation on the X axis, in degrees.
 
  |-
 
  |-
  | Number of block entities
+
  | Pitch
  | VarInt
+
  | {{Type|Float}}
  | Number of elements in the following array
+
  | Absolute or relative rotation on the Y axis, in degrees.
 
  |-
 
  |-
  | Block entities
+
  | Flags
  | Array of [[NBT]]
+
  | {{change|{{Type|Byte}}|{{Type|Teleport Flags}}}}
  | All block entities in the chunk. Use the x, y, and z tags in the NBT to determine their positions.
+
  | {{change|Reference the Flags table below. When the value of the this byte masked is zero the field is absolute, otherwise relative.|}}
 +
|- {{removed}}
 +
| Teleport ID
 +
| {{Type|VarInt}}
 +
| Client should confirm this packet with [[#Confirm Teleportation|Confirm Teleportation]] containing the same Teleport ID.
 
  |}
 
  |}
  
===== Data structure =====
+
==== Player Rotation ====
  
The data section of the packet contains most of the useful data for the chunk.
+
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="2"| 0x43
 +
| 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.
 +
|}
 +
 
 +
==== Place Ghost Recipe ====
 +
 
 +
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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="4"| {{change|0x37|0x39}}
 +
| rowspan="4"| Play
 +
| rowspan="4"| Client
 +
| Window ID
 +
| {{change|{{Type|Byte}}|{{Type|VarInt}}}}
 +
|
 +
|- {{removed}}
 +
| Recipe
 +
| {{Type|Identifier}}
 +
| A recipe ID.
 +
|- {{added}}
 +
| Recipe Display ID
 +
| {{Type|VarInt}}
 +
| ID in the <code>minecraft:recipe_display</code> registry.
 +
|- {{added}}
 +
| Recipe Data
 +
| Varies
 +
| Depends on Recipe Type; see below.
 +
|}
 +
 +
''below''
 +
 +
==== Recipe Book Add ====
 +
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! colspan="2"| Field Name
 +
! colspan="2"| Field Type
 +
! colspan="2"| Notes
 +
|-
 +
| rowspan="9"| 0x44
 +
| rowspan="9"| Play
 +
| rowspan="9"| Client
 +
| colspan="2"| Recipe Count
 +
| colspan="2"| {{Type|VarInt}}
 +
| Number of elements in the following array.
 +
|-
 +
| rowspan="7"| Recipes
 +
| Recipe ID
 +
| rowspan="7"| {{Type|Array}}
 +
| {{Type|VarInt}}
 +
| ID to assign to the recipe.
 +
|-
 +
| Display ID
 +
| {{Type|VarInt}}
 +
| ID in the <code>minecraft:recipe_display</code> registry.
 +
|-
 +
| Group ID
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Category ID
 +
| {{Type|VarInt}}
 +
| ID in the <code>minecraft:recipe_book_category</code> registry.
 +
|-
 +
| Has Ingredients
 +
| {{Type|Boolean}}
 +
|
 +
|-
 +
| 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}}
 +
| Only present if Has Ingredients is true.
 +
|-
 +
| colspan="2"| Flags
 +
| colspan="2"| {{Type|Byte}}
 +
| 0x01: show notification; 0x02: highlight as new
 +
|}
 +
 +
==== Recipe Book Remove ====
 +
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 
  ! Field Name
 
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | Data
+
  | rowspan="2"| 0x45
  | Array of [[#Chunk Section structure|Chunk Section]]
+
| rowspan="2"| Play
  | The number of elements in the array is equal to the number of bits set in Primary Bit Mask. Sections are sent bottom-to-top, i.e. the first section, if sent, extends from Y=0 to Y=15.
+
| 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"| 0x46
 +
| 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.
 
  |-
 
  |-
  | Biomes
+
  | Smoker Recipe Book Filter Active
  | Optional Int Array
+
  | {{Type|Boolean}}
  | Only sent if Ground-Up Continuous is true; 256 entries if present
+
  | If true, then the filtering option is active when the players opens its inventory.
 
  |}
 
  |}
  
===== Chunk Section structure =====
+
==== Respawn ====
  
A Chunk Section is defined in terms of other [[data types]]. A Chunk Section consists of the following fields:
+
{{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?}}
 +
 
 +
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"
  |-
+
  ! Packet ID
 +
! State
 +
! Bound To
 
  ! Field Name
 
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 +
|-
 +
| rowspan="13"| {{change|0x47|0x4C}}
 +
| rowspan="13"| Play
 +
| rowspan="13"| Client
 +
| Dimension Type
 +
| {{Type|VarInt}}
 +
| The ID of type of dimension in the <code>minecraft:dimension_type</code> registry, defined by the [[Protocol#Registry_Data|Registry Data]] packet.
 +
|-
 +
| Dimension Name
 +
| {{Type|Identifier}}
 +
| Name of the dimension being spawned into.
 +
|-
 +
| Hashed seed
 +
| {{Type|Long}}
 +
| First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
 +
|-
 +
| Game mode
 +
| {{Type|Unsigned Byte}}
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
 +
|-
 +
| Previous Game mode
 +
| {{Type|Byte}}
 +
| -1: Undefined (null), 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. The previous game mode. Vanilla client uses this for the debug (F3 + N & F3 + F4) game mode switch. (More information needed)
 +
|-
 +
| Is Debug
 +
| {{Type|Boolean}}
 +
| True if the world is a {{Minecraft Wiki|debug mode}} world; debug mode worlds cannot be modified and have predefined blocks.
 +
|-
 +
| Is Flat
 +
| {{Type|Boolean}}
 +
| True if the world is a {{Minecraft Wiki|superflat}} world; flat worlds have different void fog and a horizon at y=0 instead of y=63.
 +
|-
 +
| Has death location
 +
| {{Type|Boolean}}
 +
| If true, then the next two fields are present.
 +
|-
 +
| Death dimension Name
 +
| {{Type|Optional}} {{Type|Identifier}}
 +
| Name of the dimension the player died in.
 +
|-
 +
| Death location
 +
| {{Type|Optional}} {{Type|Position}}
 +
| The location that the player died at.
 +
|-
 +
| Portal cooldown
 +
| {{Type|VarInt}}
 +
| The number of ticks until the player can use the portal again.
 
  |- {{added}}
 
  |- {{added}}
  | Block count
+
  | Sea level
  | Short
+
  | {{Type|VarInt}}
  | Number of non-air blocks present in the chunk section, for lighting purposes.  "Non-air" is defined as any block other than air, cave air, and void air (in particular, note that fluids such as water are still counted).
+
  |
 
  |-
 
  |-
  | Bits Per Block
+
  | Data kept
  | Unsigned Byte
+
  | {{Type|Byte}}
  | Determines how many bits are used to encode a block. Note that not all numbers are valid here.
+
  | 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
 
  |-
 
  |-
  | Palette
+
  | 0x5A
  | Varies
+
  | Play
  | See below for the format.
+
  | Client
 +
| Slot Data
 +
| {{Type|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 <code>20</code> every second.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Data Array Length
+
  | rowspan="3"| {{change|0x64|0x6b}}
  | VarInt
+
| rowspan="3"| Play
  | Number of longs in the following array
+
  | rowspan="3"| Client
 +
| World Age
 +
| {{Type|Long}}
 +
  | In ticks; not changed by server commands.
 
  |-
 
  |-
  | Data Array
+
  | Time of day
  | Array of Long
+
  | {{Type|Long}}
  | Compacted list of 4096 indices pointing to state IDs in the Palette
+
  | The world (or region) time, in ticks. {{change|If negative the sun will stop moving at the Math.abs of the time.|}}
  |- {{removed}}
+
  |- {{added}}
  | Block Light
+
  | Time of day increasing
  | Byte Array
+
  | {{Type|Boolean}}
| Half byte per block
+
  | If true, the client should automatically advance the time of day according to its ticking rate.
|- {{removed}}
 
  | Sky Light
 
| Optional Byte Array
 
| Only if in the Overworld; half byte per block
 
 
  |}
 
  |}
  
Data Array{{change|, Block Light, and Sky Light are|is}} given for each block with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates.  {{change|For the half-byte light arrays, even-indexed items (those with an even x coordinate, starting at 0) are packed into the ''low bits'', odd-indexed into the ''high bits''.}}
+
==== Set Player Inventory Slot ====
  
==== Entity Sound Effect ====
+
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="2"| 0x66
 +
| rowspan="2"| Play
 +
| rowspan="2"| Client
 +
| Slot
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Slot Data
 +
| {{Type|Slot}}
 +
|
 +
|}
  
Plays a sound effect from an entity.
+
==== Teleport Entity ====
 +
 
 +
This packet is sent by the server when an entity moves more than 8 blocks.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 403: Line 1,463:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x4E
+
  | rowspan="11"| {{change|0x70|0x77}}
  |rowspan="5"| Play
+
  | rowspan="11"| Play
  |rowspan="5"| Client
+
  | rowspan="11"| Client
  | Sound ID
+
  | Entity ID
  | VarInt
+
  | {{Type|VarInt}}
  | ID of hardcoded sound event ([https://pokechu22.github.io/Burger/1.13.2.html#sounds events] as of 1.13.2)
+
|
 +
|-
 +
| X
 +
| {{Type|Double}}
 +
  |
 
  |-
 
  |-
  | Sound Category
+
  | Y
  | VarInt Enum
+
  | {{Type|Double}}
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
+
  |
 
  |-
 
  |-
  | Entity ID
+
  | Z
  | VarInt
+
  | {{Type|Double}}
 +
|
 +
|- {{added}}
 +
| Velocity X
 +
| {{Type|Double}}
 +
|
 +
|- {{added}}
 +
| Velocity Y
 +
| {{Type|Double}}
 +
|
 +
|- {{added}}
 +
| Velocity Z
 +
| {{Type|Double}}
 
  |
 
  |
 
  |-
 
  |-
  | Volume
+
  | Yaw
  | Float
+
  | {{Type|Angle}}
  | 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients
+
  | (Y Rot)New angle, not a delta.
 
  |-
 
  |-
 
  | Pitch
 
  | Pitch
  | Float
+
  | {{Type|Angle}}
  | Float between 0.5 and 2.0 by Notchian clients
+
| (X Rot)New angle, not a delta.
 +
|- {{added}}
 +
| Flags
 +
| {{Type|Teleport Flags}}
 +
|
 +
|-
 +
| On Ground
 +
| {{Type|Boolean}}
 +
|
 +
|}
 +
 
 +
=== Serverbound ===
 +
 
 +
==== Bundle Item Selected ====
 +
 
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="2"| 0x02
 +
  | rowspan="2"| Play
 +
| rowspan="2"| Server
 +
| Slot of Bundle
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Slot in Bundle
 +
| {{Type|VarInt}}
 +
|
 +
|}
 +
 
 +
==== Client Tick End ====
 +
 
 +
{| class="wikitable" {{added}}
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| 0x0B
 +
| Play
 +
| Server
 +
| colspan="3"| ''no fields''
 +
|}
 +
 
 +
==== Click Container ====
 +
 
 +
This packet is sent by the client when the player clicks on a slot in a window.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! colspan="2"| Field Name
 +
! colspan="2"| Field Type
 +
! Notes
 +
|-
 +
| rowspan="9"| {{change|0x0E|0x10}}
 +
| rowspan="9"| Play
 +
| rowspan="9"| Server
 +
| colspan="2"| Window ID
 +
| colspan="2"| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
 +
| colspan="2"| The ID of the window which was clicked. 0 for player inventory. The server ignores any packets targeting a Window ID other than the current one, including ignoring 0 when any other window is open.
 +
|-
 +
| colspan="2"| State ID
 +
| colspan="2"| {{Type|VarInt}}
 +
| colspan="2"| The last received State ID from either a [[#Set Container Slot|Set Container Slot]] or a [[#Set Container Content|Set Container Content]] packet.
 +
|-
 +
| colspan="2"| Slot
 +
| colspan="2"| {{Type|Short}}
 +
| colspan="2"| The clicked slot number, see below.
 +
|-
 +
| colspan="2"| Button
 +
| colspan="2"| {{Type|Byte}}
 +
| colspan="2"| The button used in the click, see below.
 +
|-
 +
| colspan="2"| Mode
 +
| colspan="2"| {{Type|VarInt}} {{Type|Enum}}
 +
| colspan="2"| Inventory operation mode, see below.
 +
|-
 +
| colspan="2"| Length of the array
 +
| colspan="2"| {{Type|VarInt}}
 +
| colspan="2"| Maximum value for Notchian server is 128 slots.
 +
|-
 +
| rowspan="2"| Array of changed slots
 +
| Slot number
 +
| rowspan="2"| {{Type|Array}} (128)
 +
| {{Type|Short}}
 +
|
 +
|-
 +
| Slot data
 +
| {{Type|Slot}}
 +
| New data for this slot, in the client's opinion; see below.
 +
|-
 +
| 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.
 +
 
 +
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.
 +
 
 +
{| class="wikitable"
 +
! Mode
 +
! Button
 +
! Slot
 +
! Trigger
 +
|-
 +
! rowspan="4"| 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)
 +
|-
 +
! rowspan="2"| 1
 +
| 0
 +
| Normal
 +
| Shift + left mouse click
 +
|-
 +
| 1
 +
| Normal
 +
| Shift + right mouse click ''(identical behavior)''
 +
|-
 +
! rowspan="7"| 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.
 +
|-
 +
! 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.
 +
 
 +
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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| {{change|0x0F|0x11}}
 +
| Play
 +
| Server
 +
| Window ID
 +
| {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}}
 +
| This is the ID of the window that was closed. 0 for player inventory.
 
  |}
 
  |}
  
==== Tags ====
+
==== Edit Book ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 437: Line 1,775:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| {{Change|0x55|0x56}}
+
  | rowspan="5"| {{change|0x14|0x16}}
  |rowspan="4"| Play
+
  | rowspan="5"| Play
  |rowspan="4"| Client
+
  | rowspan="5"| Server
  | Block Tags
+
  | Slot
  | (See below)
+
  | {{Type|VarInt}}
  | IDs are block IDs
+
  | The hotbar slot where the written book is located
 
  |-
 
  |-
  | Item Tags
+
  | Count
  | (See below)
+
  | {{Type|VarInt}}
  | IDs are item IDs
+
  | Number of elements in the following array. Maximum array size is {{change|200|100}}.
 
  |-
 
  |-
  | Fluid Tags
+
  | Entries
  | (See below)
+
  | {{Type|Array}} ({{change|200|100}}) of {{Type|String}} ({{change|8192|1024}})
  | IDs are fluid IDs
+
  | Text from each page. Maximum string length is {{change|8192|1024}} chars.
  |- {{added}}
+
  |-
  | Entity Tags
+
| Has title
  | (See below)
+
| {{Type|Boolean}}
  | IDs are entity type IDs
+
  | If true, the next field is present. true if book is being signed, false if book is being edited.
 +
  |-
 +
| Title
 +
| {{Type|Optional}} {{Type|String}} ({{change|128|32}})
 +
  | Title of book.
 
  |}
 
  |}
  
==== Update Light ====
+
==== Set Player Position ====
 +
 
 +
Updates the player's XYZ position on the server.
 +
 
 +
If the player is in a vehicle, the position is ignored (but in case of [[#Set Player Position and Rotation|Set Player Position and Rotation]], the rotation is still used as normal). No validation steps other than value range clamping are performed in this case.
 +
 
 +
If the player is sleeping, the position (or rotation) is not changed, and a [[#Synchronize Player Position|Synchronize Player Position]] is sent if the received position deviated from the server's view by more than a meter.
 +
 
 +
The Notchian server silently clamps the x and z coordinates between -30,000,000 and 30,000,000, and the y coordinate between -20,000,000 and 20,000,000. A similar condition has historically caused a kick for "Illegal position"; this is no longer the case. However, infinite or NaN coordinates (or angles) still result in a kick for <code>multiplayer.disconnect.invalid_player_movement</code>.
 +
 
 +
As of 1.20.6, checking for moving too fast is achieved like this (sic):
 +
 
 +
* Each server tick, the player's current position is stored.
 +
* When the player moves, the offset from the stored position to the requested position is computed (&Delta;x, &Delta;y, &Delta;z).
 +
* The requested movement distance squared is computed as &Delta;x&sup2; + &Delta;y&sup2; + &Delta;z&sup2;.
 +
* The baseline expected movement distance squared is computed based on  the player's server-side velocity as Vx&sup2; + Vy&sup2; + Vz&sup2;. The player's server-side velocity is a somewhat ill-defined quantity that includes among other things gravity, jump velocity and knockback, but ''not'' regular horizontal movement. A proper description would bring much of Minecraft's physics engine with it. It is accessible as the <code>Motion</code> NBT tag on the player entity.
 +
* The maximum permitted movement distance squared is computed as 100 (300 if the player is using an elytra), multiplied by the number of movement packets received since the last tick, including this one, unless that value is greater than 5, in which case no multiplier is applied.
 +
* If the requested movement distance squared minus the baseline distance squared is more than the maximum squared, the player is moving too fast.
 +
 
 +
If the player is moving too fast, it is logged that "<player> moved too quickly! " followed by the change in x, y, and z, and the player is teleported back to their current (before this packet) server-side position.
 +
 
 +
Checking for block collisions is achieved like this:
 +
 
 +
* A temporary collision-checked move of the player is attempted from its current position to the requested one.
 +
* The offset from the resulting position to the requested position is computed. If the absolute value of the offset on the y axis is less than 0.5, it (only the y component) is rounded down to 0.
 +
* If the magnitude of the offset is greater than 0.25 and the player isn't in creative or spectator mode, it is logged that "<player> moved wrongly!", and the player is teleported back to their current (before this packet) server-side position.
 +
* In addition, if the player's hitbox stationary at the requested position would intersect with a block, and they aren't in spectator mode, they are teleported back without a log message.
 +
 
 +
Checking for illegal flight is achieved like this:
  
Updates light levels for a chunk.
+
* When a movement packet is received, a flag indicating whether or not the player is floating mid-air is updated. The flag is set if the move test described above detected no collision below the player ''and'' the y component of the offset from the player's current position to the requested one is greater than -0.5, unless any of various conditions permitting flight (creative mode, elytra, levitation effect, etc., but not jumping) are met.
 +
* Each server tick, it is checked if the flag has been set for more than 80 consecutive ticks. If so, and the player isn't currently sleeping, dead or riding a vehicle, they are kicked for <code>multiplayer.disconnect.flying</code>.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 469: Line 1,840:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x57
+
  | rowspan="5"| {{change|0x1A|0x1C}}
  |rowspan="8"| Play
+
  | rowspan="5"| Play
  |rowspan="8"| Client
+
  | rowspan="5"| Server
  | Chunk X
+
  | X
  | VarInt
+
  | {{Type|Double}}
  | Chunk coordinate (block coordinate divided by 16, rounded down)
+
  | Absolute position.
 
  |-
 
  |-
  | Chunk Z
+
  | Feet Y
  | VarInt
+
  | {{Type|Double}}
  | Chunk coordinate (block coordinate divided by 16, rounded down)
+
  | Absolute feet position, normally Head Y - 1.62.
 
  |-
 
  |-
  | Sky Light Mask
+
  | Z
  | VarInt
+
  | {{Type|Double}}
  | Mask containing 18 bits, with the lowest bit corresponding to chunk section -1 (in the void, y=-16 to y=-1) and the highest bit for chunk section 16 (above the world, y=256 to y=271)
+
  | 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: 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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Block Light Mask
+
  | rowspan="7"| {{change|0x1B|0x1D}}
  | VarInt
+
| rowspan="7"| Play
  | Mask containing 18 bits, with the same order as sky light
+
  | rowspan="7"| Server
 +
| X
 +
| {{Type|Double}}
 +
  | Absolute position.
 
  |-
 
  |-
  | Empty Sky Light Mask
+
  | Feet Y
  | VarInt
+
  | {{Type|Double}}
  | Mask containing 18 bits, which indicates sections that have 0 for all their sky light values.  If a section is set in both this mask and the main sky light mask, it is ignored for this mask and it is included in the sky light arrays. If it is only set in this mask, it is _not_ included in the sky light arrays.
+
  | Absolute feet position, normally Head Y - 1.62.
 
  |-
 
  |-
  | Empty Block Light Mask
+
  | Z
  | VarInt
+
  | {{Type|Double}}
  | Mask containing 18 bits.  However, this seems to be written into incorrectly, and is always 0; instead block light values are put into the sky light mask. ([https://bugs.mojang.com/browse/MC-138918 MC-138918])
+
  | Absolute position.
 
  |-
 
  |-
  | Sky Light arrays
+
  | Yaw
  | Array of arrays of 2048 bytes
+
  | {{Type|Float}}
  | There is 1 array for each bit set to true in the sky light mask, starting with the lowest value.  Half a byte per light value.
+
  | Absolute rotation on the X Axis, in degrees.
 
  |-
 
  |-
  | Block Light arrays
+
  | Pitch
  | Array of arrays of 2048 bytes
+
  | {{Type|Float}}
  | There is 1 array for each bit set to true in the block light mask, starting with the lowest valueHalf a byte per light value.
+
| Absolute rotation on the Y Axis, in degrees.
 +
|- {{removed}}
 +
| On Ground
 +
| {{Type|Boolean}}
 +
  | True if the client is on the ground, false otherwise.
 +
  |- {{added}}
 +
| Flags
 +
| {{Type|Byte}}
 +
| Bit field: 0x01: on ground, 0x02: against wall.
 
  |}
 
  |}
  
Individual block or sky light arrays are is given for each block with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates. Even-indexed items (those with an even x coordinate, starting at 0) are packed into the low bits, odd-indexed into the high bits.
+
==== Set Player Rotation ====
 +
[[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]]
 +
[[File:Yaw.png|thumb|The unit circle of yaw, redrawn]]
  
=== Serverbound ===
+
Updates the direction the player is looking in.
  
No changes so far.
+
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.
  
== Handshaking ==
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
=== Clientbound ===
+
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:
  
There are no clientbound packets in the Handshaking state, since the protocol immediately switches to a different state after the client sends the first packet.
+
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
  
=== Serverbound ===
+
You can get a unit vector from a given yaw/pitch via:
  
==== Handshake ====
+
x = -cos(pitch) * sin(yaw)
 
+
y = -sin(pitch)
This causes the server to switch into the target state.
+
z = cos(pitch) * cos(yaw)
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 531: Line 1,943:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x00
+
  | rowspan="4"| {{change|0x1C|0x1E}}
  |rowspan="4"| Handshaking
+
  | rowspan="4"| Play
  |rowspan="4"| Server
+
  | rowspan="4"| Server
  | Protocol Version
+
  | Yaw
  | VarInt
+
  | {{Type|Float}}
| See [[protocol version numbers]] (currently {{change|404|443}})
+
| Absolute rotation on the X Axis, in degrees.
 
  |-
 
  |-
  | Server Address
+
  | Pitch
  | String
+
  | {{Type|Float}}
  | Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect.  The Notchian server does not use this information.
+
  | Absolute rotation on the Y Axis, in degrees.
  |-  
+
|- {{removed}}
  | Server Port
+
| On Ground
  | Unsigned Short
+
| {{Type|Boolean}}
  | Default is 25565. The Notchian server does not use this information.
+
| True if the client is on the ground, false otherwise.
 +
  |- {{added}}
 +
  | Flags
 +
  | {{Type|Byte}}
 +
  | Bit field: 0x01: on ground, 0x02: against wall.
 +
|}
 +
{{Anchor|Set Player Movement Flags}}
 +
==== Set Player {{change|On Ground|Movement Flags}} ====
 +
 
 +
This packet as well as [[#Set Player Position|Set Player Position]], [[#Set Player Rotation|Set Player Rotation]], and [[#Set Player Position and Rotation|Set Player Position and Rotation]] are called the “serverbound movement packets”. Vanilla clients will send Move Player Position once every 20 ticks even for a stationary player.
 +
 
 +
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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Next State
+
  | rowspan="2"| {{change|0x1D|0x1F}}
  | VarInt Enum
+
| rowspan="2"| Play
  | 1 for [[#Status|status]], 2 for [[#Login|login]]
+
| rowspan="2"| Server
 +
| {{removed}} | On Ground
 +
  | {{removed}} | {{Type|Boolean}}
 +
  | {{removed}} | True if the client is on the ground, false otherwise.
 +
|- {{added}}
 +
| Flags
 +
| {{Type|Byte}}
 +
| Bit field: 0x01: on ground, 0x02: against wall.
 
  |}
 
  |}
  
== Status ==
+
==== Place Recipe ====
  
=== Clientbound ===
+
This packet is sent when a player clicks a recipe in the crafting book that is craftable (white border).
  
No changes so far.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="3"| {{change|0x22|0x24}}
 +
| 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.
 +
|}
  
=== Serverbound ===
+
==== Player Input ====
  
No changes so far.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| rowspan="3"| {{change|0x26|0x28}}
 +
| 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.}}
 +
|}
  
== Login ==
+
The flags are as follows:
  
=== Clientbound ===
+
{| class="wikitable" {{added}}
 +
|-
 +
! Hex Mask
 +
! Field
 +
|-
 +
| 0x01
 +
| Forward
 +
|-
 +
| 0x02
 +
| Backward
 +
|-
 +
| 0x04
 +
| Left
 +
|-
 +
| 0x08
 +
| Right
 +
|-
 +
| 0x10
 +
| Jump
 +
|-
 +
| 0x20
 +
| Sneak
 +
|-
 +
| 0x40
 +
| Sprint
 +
|}
  
No changes so far.
+
==== Set Seen Recipe ====
  
=== Serverbound ===
+
Sent when recipe is first seen in recipe book. Replaces Recipe Book Data, type 0.
 
 
No changes so far.
 
  
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| {{change|0x29|0x2B}}
 +
| Play
 +
| Server
 +
| Recipe ID
 +
| {{change|{{Type|Identifier}}|{{Type|VarInt}}}}
 +
| ID of recipe previously defined in [[#Recipe Book Add|Recipe Book Add]].
 +
|}
  
 
[[Category:Minecraft Modern]]
 
[[Category:Minecraft Modern]]

Revision as of 07:38, 4 November 2024

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

One who wishes to commandeer the merging of this into Protocol when an update is made must be sure to respect any changes that may have occurred to the respective packets there.

Contents

Data types

Name Size (bytes) Encodes Notes
Teleport Flags 4 Bit field specifying how a teleportation is to be applied on each axis. See #Teleport Flags
ID Set Varies Set of registry IDs specified either inline or as a reference to a tag. See #ID Set

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.

ID Set

Represents a set of IDs in a certain registry (implied by context), either directly (enumerated IDs) or indirectly (tag name).

Name Type Description
Type VarInt Identifier used to determine the data that follows. It can be either:
  • 0 - Represents a named set of IDs defined by a tag.
  • Anything else - Represents an ad-hoc set of IDs enumerated inline.
Tag Name Optional Identifier The registry tag defining the ID set. Only present if Type is 0.
IDs Optional Array of VarInt An array of registry IDs. Only present if Type is not 0.
The size of the array is equal to Type - 1.

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
0x20 Synchronize Entity Position 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
0x70 0x77 Teleport Entity 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

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
0x12 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
0x13 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
0x14 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
0x15 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
0x17 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.

Synchronize Entity Position

Packet ID State Bound To Field Name Field Type Notes
0x20 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 X axis, in degrees.
Pitch 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
0x20 0x21 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 Optional Float X velocity of the player being pushed by the explosion. Only present if Has Player Motion is true.
Player Motion Y Optional Float Y velocity of the player being pushed by the explosion. Only present if Has Player Motion is true.
Player Motion Z Optional Float 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 Sound ID VarInt Represents the Sound ID + 1. If the value is 0, the packet contains a sound specified by Identifier.
Sound Name Optional Identifier The name of the sound played. Only present if Sound ID is 0.
Has Fixed Range Optional Boolean Whether is has fixed range. Only present if Sound ID is 0.
Range Optional Float The fixed range of the sound. Only present if previous boolean is true and Sound ID is 0.

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
0x23 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
0x31 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
0x3E 0x40 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
0x43 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
0x37 0x39 Play Client Window ID Byte VarInt
Recipe Identifier A recipe ID.
Recipe Display ID VarInt ID in the minecraft:recipe_display registry.
Recipe Data Varies Depends on Recipe Type; see below.

below

Recipe Book Add

Packet ID State Bound To Field Name Field Type Notes
0x44 Play Client Recipe Count VarInt Number of elements in the following array.
Recipes Recipe ID Array VarInt ID to assign to the recipe.
Display ID VarInt ID in the minecraft:recipe_display registry.
Group ID VarInt
Category ID VarInt ID in the minecraft:recipe_book_category registry.
Has Ingredients Boolean
Ingredient Count Optional VarInt Number of elements in the following array. Only present if Has Ingredients is true.
Ingredients Optional Array of ID Set Only present if Has Ingredients is true.
Flags Byte 0x01: show notification; 0x02: highlight as new

Recipe Book Remove

Packet ID State Bound To Field Name Field Type Notes
0x45 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
0x46 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
0x47 0x4C 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
0x64 0x6b 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
0x66 Play Client Slot VarInt
Slot Data Slot

Teleport Entity

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
0x70 0x77 Play Client Entity ID VarInt
X Double
Y Double
Z Double
Velocity X Double
Velocity Y Double
Velocity Z Double
Yaw Angle (Y Rot)New angle, not a delta.
Pitch Angle (X Rot)New angle, not a delta.
Flags Teleport Flags
On Ground Boolean

Serverbound

Bundle Item Selected

Packet ID State Bound To Field Name Field Type Notes
0x02 Play Server Slot of Bundle VarInt
Slot in Bundle VarInt

Client Tick End

Packet ID State Bound To Field Name Field Type Notes
0x0B 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
0x0E 0x10 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
0x0F 0x11 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
0x14 0x16 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
0x1A 0x1C 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: 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
0x1B 0x1D 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: 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
0x1C 0x1E 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: 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
0x1D 0x1F Play Server On Ground Boolean True if the client is on the ground, false otherwise.
Flags Byte Bit field: 0x01: on ground, 0x02: 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
0x22 0x24 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
0x26 0x28 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
0x29 0x2B Play Server Recipe ID Identifier VarInt ID of recipe previously defined in Recipe Book Add.