Pre-release protocol
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.2.13 Use Item On
- 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 | |
Use Item On | 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 | X velocity of the player being pushed by the explosion. Only present if Has Player Motion is true. | |||||
Player Motion Y | Y velocity of the player being pushed by the explosion. Only present if Has Player Motion is true. | |||||
Player Motion Z | 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 | ||||||
Replace | Bool | Replace or Add to known recipes |
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 | (Y Rot)New angle, not a delta. | ||||
Pitch | (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: pushing against wall. |
Set Player Position and Rotation
A combination of Move Player Rotation and Move Player Position.
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
Play | Server | X | Double | Absolute position. | |
Feet Y | Double | Absolute feet position, normally Head Y - 1.62. | |||
Z | Double | Absolute position. | |||
Yaw | Float | Absolute rotation on the X Axis, in degrees. | |||
Pitch | Float | Absolute rotation on the Y Axis, in degrees. | |||
On Ground | Boolean | True if the client is on the ground, false otherwise. | |||
Flags | Byte | Bit field: 0x01: on ground, 0x02: pushing against wall. |
Set Player Rotation
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: pushing against wall. |
Set Player On Ground Movement Flags
This packet as well as Set Player Position, Set Player Rotation, and Set Player Position and Rotation are called the “serverbound movement packets”. Vanilla clients will send Move Player Position once every 20 ticks even for a stationary player.
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
When dropping from sufficient height, fall damage is applied when this state goes from false to true. The amount of damage applied is based on the point where it last changed from true to false. Note that there are several movement related packets containing this state.
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
Play | Server | On Ground | Boolean | True if the client is on the ground, false otherwise. | |
Flags | Byte | Bit field: 0x01: on ground, 0x02: pushing against wall. |
Place Recipe
This packet is sent when a player clicks a recipe in the crafting book that is craftable (white border).
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
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. |
Use Item On
Packet ID | State | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|---|
0x38 | Play | Server | Hand | VarInt Enum | The hand from which the block is placed; 0: main hand, 1: off hand. |
Location | Position | Block position. | |||
Face | VarInt Enum | The face on which the block is placed (as documented at Player Action). | |||
Cursor Position X | Float | The position of the crosshair on the block, from 0 to 1 increasing from west to east. | |||
Cursor Position Y | Float | The position of the crosshair on the block, from 0 to 1 increasing from bottom to top. | |||
Cursor Position Z | Float | The position of the crosshair on the block, from 0 to 1 increasing from north to south. | |||
Inside block | Boolean | True when the player's head is inside of a block. | |||
World border hit | Boolean | Seems to always be false, even when interacting with blocks around or outside the world border, or while the player is outside the border. | |||
Sequence | VarInt | Block change sequence number (see #Acknowledge Block Change). |
Upon placing a block, this packet is sent once.
The Cursor Position X/Y/Z fields (also known as in-block coordinates) are calculated using raytracing. The unit corresponds to sixteen pixels in the default resource pack. For example, let's say a slab is being placed against the south face of a full block. The Cursor Position X will be higher if the player was pointing near the right (east) edge of the face, lower if pointing near the left. The Cursor Position Y will be used to determine whether it will appear as a bottom slab (values 0.0–0.5) or as a top slab (values 0.5-1.0). The Cursor Position Z should be 1.0 since the player was looking at the southernmost part of the block.
Inside block is true when a player's head (specifically eyes) are inside of a block's collision. In 1.13 and later versions, collision is rather complicated and individual blocks can have multiple collision boxes. For instance, a ring of vines has a non-colliding hole in the middle. This value is only true when the player is directly in the box. In practice, though, this value is only used by scaffolding to place in front of the player when sneaking inside of it (other blocks will place behind when you intersect with them -- try with glass for instance).