Difference between revisions of "Pre-release protocol"
(Document 1.13.2-pre1. (Thanks dinnerbone for mentioning that items changed)) |
(Most 1.21.2 packet changes (with the exception of Update Recipes).) |
||
(553 intermediate revisions by 45 users not shown) | |||
Line 1: | Line 1: | ||
− | This page documents the changes from | + | 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 === | ||
− | + | {| 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]] | ||
+ | |} | ||
+ | |||
+ | ==== Teleport Flags ==== | ||
+ | |||
+ | A bit field represented as an {{Type|Int}}, specifying how a teleportation is to be applied on each axis. | ||
− | + | In the lower 8 bits of the bit field, a set bit means the teleportation on the corresponding axis is relative, and an unset bit that it is absolute. | |
{| class="wikitable" | {| 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—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). | ||
+ | |||
+ | {| class="wikitable" {{added}} | ||
! Name | ! Name | ||
! Type | ! Type | ||
− | ! | + | ! Description |
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 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 |
− | | Optional | + | | {{Type|Optional}} {{Type|Identifier}} |
− | | | + | | The registry tag defining the ID set. Only present if Type is 0. |
|- | |- | ||
− | | | + | | IDs |
− | | Optional | + | | {{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 61: | Line 97: | ||
!colspan="2"| Documentation | !colspan="2"| Documentation | ||
|- | |- | ||
− | !colspan="4"| | + | !colspan="4"| Play clientbound |
− | {{PacketList| | + | {{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 serverbound | ||
+ | {{PacketList|0x02|Bundle Item Selected|rel=added}} | ||
+ | {{PacketList|0x0b|Client Tick End|rel=added}} | ||
+ | {{PacketList|{{change|0x0E|0x10}}|Click Container}} | ||
+ | {{PacketList|{{change|0x0F|0x11}}|Close Container}} | ||
+ | {{PacketList|{{change|0x14|0x16}}|Edit Book}} | ||
+ | {{PacketList|{{change|0x1A|0x1C}}|Set Player Position}} | ||
+ | {{PacketList|{{change|0x1B|0x1D}}|Set Player Position and Rotation}} | ||
+ | {{PacketList|{{change|0x1C|0x1E}}|Set Player Rotation}} | ||
+ | {{PacketList|0x1D|Set Player On Ground|pre=removed}} | ||
+ | {{PacketList|0x1F|Set Player Movement Flags|rel=added}} | ||
+ | {{PacketList|{{change|0x22|0x24}}|Place Recipe}} | ||
+ | {{PacketList|{{change|0x26|0x28}}|Player Input}} | ||
+ | {{PacketList|{{change|0x29|0x2B}}|Set Seen Recipe}} | ||
|} | |} | ||
− | == | + | == Handshake == |
No changes so far. | No changes so far. | ||
− | == | + | == Status == |
No changes so far. | No changes so far. | ||
− | == | + | == Login == |
+ | |||
+ | No changes so far. | ||
+ | |||
+ | == Configuration == | ||
No changes so far. | No changes so far. | ||
Line 81: | Line 159: | ||
=== Clientbound === | === 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. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! 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]]. | ||
+ | |- | ||
+ | | Count | ||
+ | | {{Type|VarInt}} | ||
+ | | Number of elements in the following array. | ||
+ | |- | ||
+ | | Slot Data | ||
+ | | {{Type|Array}} of [[Slot Data|Slot]] | ||
+ | |- | ||
+ | | Carried Item | ||
+ | | {{Type|Slot}} | ||
+ | | Item being dragged with the mouse. | ||
+ | |} | ||
+ | |||
+ | 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. | ||
+ | |||
+ | ==== Set Container Property ==== | ||
− | + | This packet is used to inform the client that part of a GUI window should be updated. | |
− | + | {| class="wikitable" | |
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! 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. | ||
+ | |- | ||
+ | | Value | ||
+ | | {{Type|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. | |
− | === | + | {| class="wikitable" |
+ | |- | ||
+ | ! Window type | ||
+ | ! Property | ||
+ | ! Value | ||
+ | |- | ||
+ | | rowspan="4"| Furnace | ||
+ | | 0: Fire icon (fuel left) | ||
+ | | counting from fuel burn time down to 0 (in-game ticks) | ||
+ | |- | ||
+ | | 1: Maximum fuel burn time | ||
+ | | fuel burn time or 0 (in-game ticks) | ||
+ | |- | ||
+ | | 2: Progress arrow | ||
+ | | counting from 0 to maximum progress (in-game ticks) | ||
+ | |- | ||
+ | | 3: Maximum progress | ||
+ | | always 200 on the notchian server | ||
+ | |- | ||
+ | | rowspan="10"| Enchantment Table | ||
+ | | 0: Level requirement for top enchantment slot | ||
+ | | rowspan="3"| The enchantment's xp level requirement | ||
+ | |- | ||
+ | | 1: Level requirement for middle enchantment slot | ||
+ | |- | ||
+ | | 2: Level requirement for bottom enchantment slot | ||
+ | |- | ||
+ | | 3: The enchantment seed | ||
+ | | Used for drawing the enchantment names (in [[Wikipedia:Standard Galactic Alphabet|SGA]]) clientside. The same seed ''is'' used to calculate enchantments, but some of the data isn't sent to the client to prevent easily guessing the entire list (the seed value here is the regular seed bitwise and <code>0xFFFFFFF0</code>). | ||
+ | |- | ||
+ | | 4: Enchantment ID shown on mouse hover over top enchantment slot | ||
+ | | rowspan="3"| The enchantment id (set to -1 to hide it), see below for values | ||
+ | |- | ||
+ | | 5: Enchantment ID shown on mouse hover over middle enchantment slot | ||
+ | |- | ||
+ | | 6: Enchantment ID shown on mouse hover over bottom enchantment slot | ||
+ | |- | ||
+ | | 7: Enchantment level shown on mouse hover over the top slot | ||
+ | | rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant | ||
+ | |- | ||
+ | | 8: Enchantment level shown on mouse hover over the middle slot | ||
+ | |- | ||
+ | | 9: Enchantment level shown on mouse hover over the bottom slot | ||
+ | |- | ||
+ | | rowspan="3"| Beacon | ||
+ | | 0: Power level | ||
+ | | 0-4, controls what effect buttons are enabled | ||
+ | |- | ||
+ | | 1: First potion effect | ||
+ | | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect | ||
+ | |- | ||
+ | | 2: Second potion effect | ||
+ | | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect | ||
+ | |- | ||
+ | | Anvil | ||
+ | | 0: Repair cost | ||
+ | | The repair's cost in xp levels | ||
+ | |- | ||
+ | | rowspan="2"| Brewing Stand | ||
+ | | 0: Brew time | ||
+ | | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full | ||
+ | |- | ||
+ | | 1: Fuel time | ||
+ | | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full | ||
+ | |- | ||
+ | | Stonecutter | ||
+ | | 0: Selected recipe | ||
+ | | The index of the selected recipe. -1 means none is selected. | ||
+ | |- | ||
+ | | Loom | ||
+ | | 0: Selected pattern | ||
+ | | The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern. | ||
+ | |- | ||
+ | | Lectern | ||
+ | | 0: Page number | ||
+ | | The current page number, starting from 0. | ||
+ | |} | ||
− | + | For an enchanting table, the following numerical IDs are used: | |
− | = | + | {| class="wikitable" |
+ | ! Numerical ID | ||
+ | ! Enchantment ID | ||
+ | ! Enchantment Name | ||
+ | |- | ||
+ | | 0 | ||
+ | | minecraft:protection | ||
+ | | Protection | ||
+ | |- | ||
+ | | 1 | ||
+ | | minecraft:fire_protection | ||
+ | | Fire Protection | ||
+ | |- | ||
+ | | 2 | ||
+ | | minecraft:feather_falling | ||
+ | | Feather Falling | ||
+ | |- | ||
+ | | 3 | ||
+ | | minecraft:blast_protection | ||
+ | | Blast Protection | ||
+ | |- | ||
+ | | 4 | ||
+ | | minecraft:projectile_protection | ||
+ | | Projectile Protection | ||
+ | |- | ||
+ | | 5 | ||
+ | | minecraft:respiration | ||
+ | | Respiration | ||
+ | |- | ||
+ | | 6 | ||
+ | | minecraft:aqua_affinity | ||
+ | | Aqua Affinity | ||
+ | |- | ||
+ | | 7 | ||
+ | | minecraft:thorns | ||
+ | | Thorns | ||
+ | |- | ||
+ | | 8 | ||
+ | | minecraft:depth_strider | ||
+ | | Depth Strider | ||
+ | |- | ||
+ | | 9 | ||
+ | | minecraft:frost_walker | ||
+ | | Frost Walker | ||
+ | |- | ||
+ | | 10 | ||
+ | | minecraft:binding_curse | ||
+ | | Curse of Binding | ||
+ | |- | ||
+ | | 11 | ||
+ | | minecraft:soul_speed | ||
+ | | Soul Speed | ||
+ | |- | ||
+ | | 12 | ||
+ | | minecraft:swift_sneak | ||
+ | | Swift Sneak | ||
+ | |- | ||
+ | | 13 | ||
+ | | minecraft:sharpness | ||
+ | | Sharpness | ||
+ | |- | ||
+ | | 14 | ||
+ | | minecraft:smite | ||
+ | | Smite | ||
+ | |- | ||
+ | | 15 | ||
+ | | minecraft:bane_of_arthropods | ||
+ | | Bane of Arthropods | ||
+ | |- | ||
+ | | 16 | ||
+ | | minecraft:knockback | ||
+ | | Knockback | ||
+ | |- | ||
+ | | 17 | ||
+ | | minecraft:fire_aspect | ||
+ | | Fire Aspect | ||
+ | |- | ||
+ | | 18 | ||
+ | | minecraft:looting | ||
+ | | Looting | ||
+ | |- | ||
+ | | 19 | ||
+ | | minecraft:sweeping_edge | ||
+ | | Sweeping Edge | ||
+ | |- | ||
+ | | 20 | ||
+ | | minecraft:efficiency | ||
+ | | Efficiency | ||
+ | |- | ||
+ | | 21 | ||
+ | | minecraft:silk_touch | ||
+ | | Silk Touch | ||
+ | |- | ||
+ | | 22 | ||
+ | | minecraft:unbreaking | ||
+ | | Unbreaking | ||
+ | |- | ||
+ | | 23 | ||
+ | | minecraft:fortune | ||
+ | | Fortune | ||
+ | |- | ||
+ | | 24 | ||
+ | | minecraft:power | ||
+ | | Power | ||
+ | |- | ||
+ | | 25 | ||
+ | | minecraft:punch | ||
+ | | Punch | ||
+ | |- | ||
+ | | 26 | ||
+ | | minecraft:flame | ||
+ | | Flame | ||
+ | |- | ||
+ | | 27 | ||
+ | | minecraft:infinity | ||
+ | | Infinity | ||
+ | |- | ||
+ | | 28 | ||
+ | | minecraft:luck_of_the_sea | ||
+ | | Luck of the Sea | ||
+ | |- | ||
+ | | 29 | ||
+ | | minecraft:lure | ||
+ | | Lure | ||
+ | |- | ||
+ | | 30 | ||
+ | | minecraft:loyalty | ||
+ | | Loyalty | ||
+ | |- | ||
+ | | 31 | ||
+ | | minecraft:impaling | ||
+ | | Impaling | ||
+ | |- | ||
+ | | 32 | ||
+ | | minecraft:riptide | ||
+ | | Riptide | ||
+ | |- | ||
+ | | 33 | ||
+ | | minecraft:channeling | ||
+ | | Channeling | ||
+ | |- | ||
+ | | 34 | ||
+ | | minecraft:multishot | ||
+ | | Multishot | ||
+ | |- | ||
+ | | 35 | ||
+ | | minecraft:quick_charge | ||
+ | | Quick Charge | ||
+ | |- | ||
+ | | 36 | ||
+ | | minecraft:piercing | ||
+ | | Piercing | ||
+ | |- | ||
+ | | 37 | ||
+ | | minecraft:density | ||
+ | | Density | ||
+ | |- | ||
+ | | 38 | ||
+ | | minecraft:breach | ||
+ | | Breach | ||
+ | |- | ||
+ | | 39 | ||
+ | | minecraft:wind_burst | ||
+ | | Wind Burst | ||
+ | |- | ||
+ | | 40 | ||
+ | | minecraft:mending | ||
+ | | Mending | ||
+ | |- | ||
+ | | 41 | ||
+ | | minecraft:vanishing_curse | ||
+ | | Curse of Vanishing | ||
+ | |} | ||
− | ==== | + | ==== Set Container Slot ==== |
− | + | Sent by the server when an item in a slot (in a window) is added/removed. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 107: | Line 514: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan="4"| | + | | rowspan="4"| 0x15 |
− | |rowspan="4"| | + | | rowspan="4"| Play |
− | |rowspan="4"| | + | | rowspan="4"| Client |
− | | | + | | Window ID |
− | | VarInt | + | | {{change|{{Type|Unsigned Byte}}|{{Type|VarInt}}}} |
− | | | + | | The window which is being updated. 0 for player inventory. The client ignores any packets targeting a Window ID other than the current one{{change|; see below for exceptions|, unless it is 0 (see below)}}. |
+ | |- | ||
+ | | State ID | ||
+ | | {{Type|VarInt}} | ||
+ | | A server-managed sequence number used to avoid desynchronization; see [[#Click Container]]. | ||
+ | |- | ||
+ | | Slot | ||
+ | | {{Type|Short}} | ||
+ | | The slot that should be updated. | ||
|- | |- | ||
− | | | + | | Slot Data |
− | | | + | | {{Type|Slot}} |
− | | | + | | |
+ | |} | ||
+ | |||
+ | If Window ID is 0, the hotbar and offhand slots (slots 36 through 45) may be updated even when a different container window is open. (The Notchian server does not appear to utilize this special case.) Updates are also restricted to those slots when the player is looking at a creative inventory tab other than the survival inventory. (The Notchian server does ''not'' handle this restriction in any way, leading to [https://bugs.mojang.com/browse/MC-242392 MC-242392].) | ||
+ | |||
+ | {{change|If Window ID is -1, the item being dragged with the mouse is set. In this case, State ID and Slot are ignored.|}} | ||
+ | |||
+ | {{change|If Window ID is -2, any slot in the player's inventory can be updated irrespective of the current container window. In this case, State ID is ignored, and the Notchian server uses a bogus value of 0. Used by the Notchian server to implement the [[#Pick Item]] functionality.|}} | ||
+ | |||
+ | When a container window is open, the server never sends updates targeting Window ID 0—all of the [[Inventory|window types]] include slots for the player inventory. The client must automatically apply changes targeting the inventory portion of a container window to the main inventory; the server does not resend them for ID 0 when the window is closed. However, since the armor and offhand slots are only present on ID 0, updates to those slots occurring while a window is open must be deferred by the server until the window's closure. | ||
+ | |||
+ | ==== Set Cooldown ==== | ||
+ | |||
+ | 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 |
− | | Unsigned | + | | 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}} | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! 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. | ||
+ | |- | ||
+ | | On Ground | ||
+ | | {{Type|Boolean}} | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | ==== Explosion ==== | ||
+ | |||
+ | Sent when an explosion occurs (creepers, TNT, and ghast fireballs). | ||
+ | |||
+ | {{change|Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x|}} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! 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}} | ||
+ | | colspan="2" | Records | ||
+ | | {{Type|Array}} of ({{Type|Byte}}, {{Type|Byte}}, {{Type|Byte}}) | ||
+ | | Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks. | ||
+ | |- {{added}} | ||
+ | | colspan="2" | Has Player Motion | ||
+ | | {{Type|Boolean}} | ||
+ | | | ||
+ | |- | ||
+ | | 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}} | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | ==== 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}} | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! 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 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}} | ||
+ | |- | ||
+ | | Update Listed | ||
+ | | 0x08 | ||
+ | | colspan="2" | Listed | ||
+ | | colspan="2" | {{Type|Boolean}} | ||
+ | | Whether the player should be listed on the player list. | ||
+ | |- | ||
+ | | Update Latency | ||
+ | | 0x10 | ||
+ | | colspan="2" | Ping | ||
+ | | colspan="2" | {{Type|VarInt}} | ||
+ | | Measured in milliseconds. | ||
+ | |- | ||
+ | | rowspan="2" | Update Display Name | ||
+ | | rowspan="2" | 0x20 | ||
+ | | colspan="2" | Has Display Name | ||
+ | | colspan="2" | {{Type|Boolean}} | ||
+ | |- | ||
+ | | colspan="2" | Display Name | ||
+ | | colspan="2" | {{Type|Optional}} {{Type|Text Component}} | ||
+ | | Only sent if Has Display Name is true. | ||
+ | |- {{added}} | ||
+ | | Update List Priority | ||
+ | | 0x40 | ||
+ | | colspan="2" | Priority | ||
+ | | colspan="2" | {{Type|VarInt}} | ||
+ | | See below. | ||
+ | |} | ||
+ | |||
+ | The properties included in this packet are the same as in [[#Login Success|Login Success]], for the current player. | ||
+ | |||
+ | Ping values correspond with icons in the following way: | ||
+ | * A ping that negative (i.e. not known to the server yet) will result in the no connection icon. | ||
+ | * A ping under 150 milliseconds will result in 5 bars | ||
+ | * A ping under 300 milliseconds will result in 4 bars | ||
+ | * A ping under 600 milliseconds will result in 3 bars | ||
+ | * A ping under 1000 milliseconds (1 second) will result in 2 bars | ||
+ | * A ping greater than or equal to 1 second will result in 1 bar. | ||
+ | |||
+ | The order of players in the player list is determined as follows: | ||
+ | * {{change||Players with higher priorities are sorted before those with lower priorities.}} | ||
+ | * {{change||Among players of equal priorities, }}spectators are sorted after non-spectators. | ||
+ | * Within each of those groups, players are sorted into teams. The teams are ordered case-sensitively by team name in ascending order. Players with no team are listed first. | ||
+ | * The players of each team (and non-team) are sorted case-insensitively by name in ascending order. | ||
+ | |||
+ | ==== Synchronize Player Position ==== | ||
+ | |||
+ | Teleports the client, e.g. during login, when using an ender pearl, in response to invalid move packets, etc. | ||
+ | |||
+ | Due to latency, the server may receive outdated movement packets sent before the client was aware of the teleport. To account for this, the server ignores all movement packets from the client until a [[#Confirm Teleportation|Confirm Teleportation]] packet with an ID matching the one sent in the teleport packet is received. | ||
+ | |||
+ | Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360 (see [https://bugs.mojang.com/browse/MC-90097 MC-90097]). | ||
+ | |||
+ | Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | | rowspan="11"| ''protocol:''<br/><code>{{change|0x40|0x42}}</code><br/><br/>''resource:''<br/><code>player_position</code> | ||
+ | | rowspan="11"| Play | ||
+ | | rowspan="11"| Client | ||
+ | | {{added}} | Teleport ID | ||
+ | | {{added}} | {{Type|VarInt}} | ||
+ | | {{added}} | Client should confirm this packet with [[#Confirm Teleportation|Confirm Teleportation]] containing the same Teleport ID. | ||
+ | |- | ||
+ | | X | ||
+ | | {{Type|Double}} | ||
+ | | Absolute or relative position, depending on Flags. | ||
+ | |- | ||
+ | | Y | ||
+ | | {{Type|Double}} | ||
+ | | Absolute or relative position, depending on Flags. | ||
+ | |- | ||
+ | | Z | ||
+ | | {{Type|Double}} | ||
+ | | Absolute or relative position, depending on Flags. | ||
+ | |- {{added}} | ||
+ | | Velocity X | ||
+ | | {{Type|Double}} | ||
+ | | | ||
+ | |- {{added}} | ||
+ | | Velocity Y | ||
+ | | {{Type|Double}} | ||
+ | | | ||
+ | |- {{added}} | ||
+ | | Velocity Z | ||
+ | | {{Type|Double}} | ||
+ | | | ||
+ | |- | ||
+ | | Yaw | ||
+ | | {{Type|Float}} | ||
+ | | Absolute or relative rotation on the X axis, in degrees. | ||
+ | |- | ||
+ | | Pitch | ||
+ | | {{Type|Float}} | ||
+ | | Absolute or relative rotation on the Y axis, in degrees. | ||
+ | |- | ||
+ | | Flags | ||
+ | | {{change|{{Type|Byte}}|{{Type|Teleport Flags}}}} | ||
+ | | {{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. | ||
+ | |} | ||
+ | |||
+ | ==== Player Rotation ==== | ||
+ | |||
+ | {| 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" | ||
+ | ! 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 Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | | rowspan="2"| 0x45 | ||
+ | | rowspan="2"| Play | ||
+ | | rowspan="2"| Client | ||
+ | | Recipe Count | ||
+ | | {{Type|VarInt}} | ||
+ | | Number of elements in the following array. | ||
+ | |- | ||
+ | | Recipes | ||
+ | | {{Type|Array}} of {{Type|VarInt}} | ||
+ | | IDs of recipes to remove. | ||
+ | |} | ||
+ | |||
+ | ==== Recipe Book Settings ==== | ||
+ | |||
+ | {| class="wikitable" {{added}} | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | | rowspan="8"| 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. | ||
+ | |- | ||
+ | | Smoker Recipe Book Filter Active | ||
+ | | {{Type|Boolean}} | ||
+ | | If true, then the filtering option is active when the players opens its inventory. | ||
+ | |} | ||
+ | |||
+ | ==== Respawn ==== | ||
+ | |||
+ | {{Need Info|Although the number of portal cooldown ticks is included in this packet, the whole portal usage process is still dictated entirely by the server. What kind of effect does this value have on the client, if any?}} | ||
+ | |||
+ | 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" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! 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}} | ||
+ | | Sea level | ||
+ | | {{Type|VarInt}} | ||
+ | | | ||
+ | |- | ||
+ | | Data kept | ||
+ | | {{Type|Byte}} | ||
+ | | Bit mask. 0x01: Keep attributes, 0x02: Keep metadata. Tells which data should be kept on the client side once the player has respawned. | ||
+ | In the Notchian implementation, this is context dependent: | ||
+ | * normal respawns (after death) keep no data; | ||
+ | * exiting the end poem/credits keeps the attributes; | ||
+ | * other dimension changes (portals or teleports) keep all data. | ||
+ | |} | ||
+ | |||
+ | {{Warning2|Avoid changing player's dimension to same dimension they were already in unless they are dead. If you change the dimension to one they are already in, weird bugs can occur, such as the player being unable to attack other players in new world (until they die and respawn). | ||
+ | |||
+ | Before 1.16, if you must respawn a player in the same dimension without killing them, send two respawn packets, one to a different world and then another to the world you want. You do not need to complete the first respawn; it only matters that you send two packets.}} | ||
+ | |||
+ | ==== Set Cursor Item ==== | ||
+ | |||
+ | {| class="wikitable" {{added}} | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | | 0x5A | ||
+ | | Play | ||
+ | | Client | ||
+ | | Slot Data | ||
+ | | {{Type|Slot}} | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | ==== 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 | ||
+ | |- | ||
+ | | rowspan="3"| {{change|0x64|0x6b}} | ||
+ | | rowspan="3"| Play | ||
+ | | rowspan="3"| Client | ||
+ | | World Age | ||
+ | | {{Type|Long}} | ||
+ | | In ticks; not changed by server commands. | ||
|- | |- | ||
− | | | + | | Time of day |
− | | | + | | {{Type|Long}} |
− | | | + | | The world (or region) time, in ticks. {{change|If negative the sun will stop moving at the Math.abs of the time.|}} |
+ | |- {{added}} | ||
+ | | Time of day increasing | ||
+ | | {{Type|Boolean}} | ||
+ | | If true, the client should automatically advance the time of day according to its ticking rate. | ||
|} | |} | ||
− | == | + | ==== Set Player Inventory Slot ==== |
+ | |||
+ | {| 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}} | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | ==== Teleport Entity ==== | ||
− | + | This packet is sent by the server when an entity moves more than 8 blocks. | |
− | + | {| class="wikitable" | |
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | | rowspan="11"| {{change|0x70|0x77}} | ||
+ | | rowspan="11"| Play | ||
+ | | rowspan="11"| Client | ||
+ | | Entity ID | ||
+ | | {{Type|VarInt}} | ||
+ | | | ||
+ | |- | ||
+ | | X | ||
+ | | {{Type|Double}} | ||
+ | | | ||
+ | |- | ||
+ | | Y | ||
+ | | {{Type|Double}} | ||
+ | | | ||
+ | |- | ||
+ | | Z | ||
+ | | {{Type|Double}} | ||
+ | | | ||
+ | |- {{added}} | ||
+ | | Velocity X | ||
+ | | {{Type|Double}} | ||
+ | | | ||
+ | |- {{added}} | ||
+ | | Velocity Y | ||
+ | | {{Type|Double}} | ||
+ | | | ||
+ | |- {{added}} | ||
+ | | Velocity Z | ||
+ | | {{Type|Double}} | ||
+ | | | ||
+ | |- | ||
+ | | Yaw | ||
+ | | {{Type|Angle}} | ||
+ | | (Y Rot)New angle, not a delta. | ||
+ | |- | ||
+ | | Pitch | ||
+ | | {{Type|Angle}} | ||
+ | | (X Rot)New angle, not a delta. | ||
+ | |- {{added}} | ||
+ | | Flags | ||
+ | | {{Type|Teleport Flags}} | ||
+ | | | ||
+ | |- | ||
+ | | On Ground | ||
+ | | {{Type|Boolean}} | ||
+ | | | ||
+ | |} | ||
=== Serverbound === | === Serverbound === | ||
− | No | + | ==== 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. | ||
+ | |} | ||
+ | |||
+ | ==== Edit Book ==== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | | rowspan="5"| {{change|0x14|0x16}} | ||
+ | | rowspan="5"| Play | ||
+ | | rowspan="5"| Server | ||
+ | | Slot | ||
+ | | {{Type|VarInt}} | ||
+ | | The hotbar slot where the written book is located | ||
+ | |- | ||
+ | | Count | ||
+ | | {{Type|VarInt}} | ||
+ | | Number of elements in the following array. Maximum array size is {{change|200|100}}. | ||
+ | |- | ||
+ | | Entries | ||
+ | | {{Type|Array}} ({{change|200|100}}) of {{Type|String}} ({{change|8192|1024}}) | ||
+ | | Text from each page. Maximum string length is {{change|8192|1024}} chars. | ||
+ | |- | ||
+ | | Has title | ||
+ | | {{Type|Boolean}} | ||
+ | | If true, the next field is present. true if book is being signed, false if book is being edited. | ||
+ | |- | ||
+ | | Title | ||
+ | | {{Type|Optional}} {{Type|String}} ({{change|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|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 (Δ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 <code>Motion</code> NBT tag on the player entity. | ||
+ | * The maximum permitted movement distance squared is computed as 100 (300 if the player is using an elytra), multiplied by the number of movement packets received since the last tick, including this one, unless that value is greater than 5, in which case no multiplier is applied. | ||
+ | * If the requested movement distance squared minus the baseline distance squared is more than the maximum squared, the player is moving too fast. | ||
+ | |||
+ | If the player is moving too fast, it is logged that "<player> moved too quickly! " followed by the change in x, y, and z, and the player is teleported back to their current (before this packet) server-side position. | ||
+ | |||
+ | Checking for block collisions is achieved like this: | ||
+ | |||
+ | * A temporary collision-checked move of the player is attempted from its current position to the requested one. | ||
+ | * The offset from the resulting position to the requested position is computed. If the absolute value of the offset on the y axis is less than 0.5, it (only the y component) is rounded down to 0. | ||
+ | * If the magnitude of the offset is greater than 0.25 and the player isn't in creative or spectator mode, it is logged that "<player> moved wrongly!", and the player is teleported back to their current (before this packet) server-side position. | ||
+ | * In addition, if the player's hitbox stationary at the requested position would intersect with a block, and they aren't in spectator mode, they are teleported back without a log message. | ||
+ | |||
+ | Checking for illegal flight is achieved like this: | ||
+ | |||
+ | * When a movement packet is received, a flag indicating whether or not the player is floating mid-air is updated. The flag is set if the move test described above detected no collision below the player ''and'' the y component of the offset from the player's current position to the requested one is greater than -0.5, unless any of various conditions permitting flight (creative mode, elytra, levitation effect, etc., but not jumping) are met. | ||
+ | * Each server tick, it is checked if the flag has been set for more than 80 consecutive ticks. If so, and the player isn't currently sleeping, dead or riding a vehicle, they are kicked for <code>multiplayer.disconnect.flying</code>. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | | rowspan="5"| {{change|0x1A|0x1C}} | ||
+ | | rowspan="5"| Play | ||
+ | | rowspan="5"| Server | ||
+ | | X | ||
+ | | {{Type|Double}} | ||
+ | | Absolute position. | ||
+ | |- | ||
+ | | Feet Y | ||
+ | | {{Type|Double}} | ||
+ | | Absolute feet position, normally Head Y - 1.62. | ||
+ | |- | ||
+ | | Z | ||
+ | | {{Type|Double}} | ||
+ | | Absolute position. | ||
+ | |- {{removed}} | ||
+ | | On Ground | ||
+ | | {{Type|Boolean}} | ||
+ | | True if the client is on the ground, false otherwise. | ||
+ | |- {{added}} | ||
+ | | Flags | ||
+ | | {{Type|Byte}} | ||
+ | | Bit field: 0x01: on ground, 0x02: 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 | ||
+ | |- | ||
+ | | rowspan="7"| {{change|0x1B|0x1D}} | ||
+ | | rowspan="7"| Play | ||
+ | | rowspan="7"| Server | ||
+ | | X | ||
+ | | {{Type|Double}} | ||
+ | | Absolute position. | ||
+ | |- | ||
+ | | Feet Y | ||
+ | | {{Type|Double}} | ||
+ | | Absolute feet position, normally Head Y - 1.62. | ||
+ | |- | ||
+ | | Z | ||
+ | | {{Type|Double}} | ||
+ | | Absolute position. | ||
+ | |- | ||
+ | | Yaw | ||
+ | | {{Type|Float}} | ||
+ | | Absolute rotation on the X Axis, in degrees. | ||
+ | |- | ||
+ | | Pitch | ||
+ | | {{Type|Float}} | ||
+ | | Absolute rotation on the Y Axis, in degrees. | ||
+ | |- {{removed}} | ||
+ | | On Ground | ||
+ | | {{Type|Boolean}} | ||
+ | | True if the client is on the ground, false otherwise. | ||
+ | |- {{added}} | ||
+ | | Flags | ||
+ | | {{Type|Byte}} | ||
+ | | Bit field: 0x01: on ground, 0x02: against wall. | ||
+ | |} | ||
+ | |||
+ | ==== Set Player Rotation ==== | ||
+ | [[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]] | ||
+ | [[File:Yaw.png|thumb|The unit circle of yaw, redrawn]] | ||
+ | |||
+ | Updates the direction the player is looking in. | ||
+ | |||
+ | Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0,-1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360. | ||
+ | |||
+ | Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down. | ||
+ | |||
+ | The yaw and pitch of player (in degrees), standing at point (x0, y0, z0) and looking towards point (x, y, z) can be calculated with: | ||
+ | |||
+ | dx = x-x0 | ||
+ | dy = y-y0 | ||
+ | dz = z-z0 | ||
+ | r = sqrt( dx*dx + dy*dy + dz*dz ) | ||
+ | yaw = -atan2(dx,dz)/PI*180 | ||
+ | if yaw < 0 then | ||
+ | yaw = 360 + yaw | ||
+ | pitch = -arcsin(dy/r)/PI*180 | ||
+ | |||
+ | 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) | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | | rowspan="4"| {{change|0x1C|0x1E}} | ||
+ | | rowspan="4"| Play | ||
+ | | rowspan="4"| Server | ||
+ | | Yaw | ||
+ | | {{Type|Float}} | ||
+ | | Absolute rotation on the X Axis, in degrees. | ||
+ | |- | ||
+ | | Pitch | ||
+ | | {{Type|Float}} | ||
+ | | Absolute rotation on the Y Axis, in degrees. | ||
+ | |- {{removed}} | ||
+ | | On Ground | ||
+ | | {{Type|Boolean}} | ||
+ | | True if the client is on the ground, false otherwise. | ||
+ | |- {{added}} | ||
+ | | Flags | ||
+ | | {{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 | ||
+ | |- | ||
+ | | rowspan="2"| {{change|0x1D|0x1F}} | ||
+ | | rowspan="2"| Play | ||
+ | | 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. | ||
+ | |} | ||
+ | |||
+ | ==== Place Recipe ==== | ||
+ | |||
+ | This packet is sent when a player clicks a recipe in the crafting book that is craftable (white border). | ||
+ | |||
+ | {| 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. | ||
+ | |} | ||
+ | |||
+ | ==== Player Input ==== | ||
− | == | + | {| 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.}} | ||
+ | |} | ||
− | + | The flags are as follows: | |
− | + | {| class="wikitable" {{added}} | |
+ | |- | ||
+ | ! 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. | |
+ | {| 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
Contents
- 1 Contents
- 2 Handshake
- 3 Status
- 4 Login
- 5 Configuration
- 6 Play
- 6.1 Clientbound
- 6.1.1 Close Container
- 6.1.2 Set Container Content
- 6.1.3 Set Container Property
- 6.1.4 Set Container Slot
- 6.1.5 Set Cooldown
- 6.1.6 Synchronize Entity Position
- 6.1.7 Explosion
- 6.1.8 Open Horse Screen
- 6.1.9 Login (play)
- 6.1.10 Move Minecart Along Track
- 6.1.11 Player Info Update
- 6.1.12 Synchronize Player Position
- 6.1.13 Player Rotation
- 6.1.14 Place Ghost Recipe
- 6.1.15 Recipe Book Add
- 6.1.16 Recipe Book Remove
- 6.1.17 Recipe Book Settings
- 6.1.18 Respawn
- 6.1.19 Set Cursor Item
- 6.1.20 Update Time
- 6.1.21 Set Player Inventory Slot
- 6.1.22 Teleport Entity
- 6.2 Serverbound
- 6.2.1 Bundle Item Selected
- 6.2.2 Client Tick End
- 6.2.3 Click Container
- 6.2.4 Close Container
- 6.2.5 Edit Book
- 6.2.6 Set Player Position
- 6.2.7 Set Player Position and Rotation
- 6.2.8 Set Player Rotation
- 6.2.9 Set Player On Ground Movement Flags
- 6.2.10 Place Recipe
- 6.2.11 Player Input
- 6.2.12 Set Seen Recipe
- 6.1 Clientbound
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:
|
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 | |
Explosion | Current | Pre | |
Open Horse Screen | Current | Pre | |
Login (play) | Current | Pre | |
0x31 | Move Minecart Along Track | Pre | |
Place Ghost Recipe | Current | Pre | |
Player Info Update | Current | Pre | |
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 | |
Respawn | Current | Pre | |
0x5a | Set Cursor Item | Pre | |
Set Held Item | Current | (unchanged) | |
0x66 | Set Player Inventory Slot | Pre | |
Update Time | Current | Pre | |
Teleport Entity | Current | Pre | |
Play serverbound | |||
0x02 | Bundle Item Selected | Pre | |
0x0b | Client Tick End | Pre | |
Click Container | Current | Pre | |
Close Container | Current | Pre | |
Edit Book | Current | Pre | |
Set Player Position | Current | Pre | |
Set Player Position and Rotation | Current | Pre | |
Set Player Rotation | Current | Pre | |
0x1D | Set Player On Ground | Current | |
0x1F | Set Player Movement Flags | Pre | |
Place Recipe | Current | Pre | |
Player Input | Current | Pre | |
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 | This is the ID of the window that was closed. 0 for inventory. |
Set Container Content
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 | 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 | ||
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 | The window which is being updated. 0 for player inventory. The client ignores any packets targeting a Window ID other than the current one | |
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 | |||
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 | |
---|---|---|---|---|---|---|
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. | ||||
VarInt | The particle ID listed in Particles. | |||||
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 | ||
Slot count | VarInt | ||||
Entity ID | Int |
Login (play)
See Protocol Encryption for information on logging in.
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
protocol:
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 | ||
---|---|---|---|---|---|---|---|
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. |
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:
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 | |||||
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 |
---|---|---|---|---|---|
Play | Client | Window ID | |||
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
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 |
---|---|---|---|---|---|
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:
|
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 |
---|---|---|---|---|---|
Play | Client | World Age | Long | In ticks; not changed by server commands. | |
Time of day | Long | The world (or region) time, in ticks. | |||
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 |
---|---|---|---|---|---|
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 | |||
---|---|---|---|---|---|---|---|---|
Play | Server | Window ID | 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):
- 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 packet for the inventory.
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
Play | Server | Window ID | 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 |
---|---|---|---|---|---|
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 | |||
Entries | Array ( |
Text from each page. Maximum string length is | |||
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 ( |
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 |
---|---|---|---|---|---|
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 |
---|---|---|---|---|---|
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
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 |
---|---|---|---|---|---|
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 |
---|---|---|---|---|---|
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 |
---|---|---|---|---|---|
Play | Server | Window ID | Byte | ||
Recipe ID | |||||
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 |
---|---|---|---|---|---|
Play | Server | Sideways | Float | Positive to the left of the player. | |
Forward | Float | Positive forward. | |||
Flags | Unsigned Byte | Bit mask |
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 |
---|---|---|---|---|---|
Play | Server | Recipe ID | ID of recipe previously defined in Recipe Book Add. |