Difference between revisions of "Protocol"

From wiki.vg
Jump to: navigation, search
m (Resource Pack Status: Fix incorrect rowspan)
(Chunk Data: Document my findings/headaches)
 
(17 intermediate revisions by 8 users not shown)
Line 5: Line 5:
 
   |ICON =  
 
   |ICON =  
 
   |HEADING = Heads up!
 
   |HEADING = Heads up!
   |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''computer edition''' ([[Protocol version numbers|1.13.2, protocol 404]]). For the computer edition pre-releases, see [[Pre-release protocol]]. For Pocket Edition, see [[Pocket Edition Protocol Documentation]].
+
   |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''computer edition''' ([[Protocol version numbers|1.14.4, protocol 498]]). For the computer edition pre-releases, see [[Pre-release protocol]]. For Pocket Edition, see [[Pocket Edition Protocol Documentation]].
 
}}
 
}}
  
Line 47: Line 47:
 
  |-
 
  |-
 
  | Global palette
 
  | Global palette
  | A table/dictionary/palette mapping nonnegative integers to block states. Block state IDs are created in a linear fashion based off of order of assignment.  One block state ID allocated for each unique block state for a block; if a block has multiple properties then the number of allocated states is the product of the number of values for each property.  A current list of properties and state ID ranges is found on [https://pokechu22.github.io/Burger/1.13.2.html burger].
+
  | A table/dictionary/palette mapping nonnegative integers to block states. Block state IDs are created in a linear fashion based off of order of assignment.  One block state ID allocated for each unique block state for a block; if a block has multiple properties then the number of allocated states is the product of the number of values for each property.  A current list of properties and state ID ranges is found on [https://pokechu22.github.io/Burger/1.14.4.html burger].
  
 
Alternatively, the vanilla server now includes an option to export the current block state ID mapping, by running <code>java -cp minecraft_server.jar net.minecraft.data.Main --reports</code>.  See [[Data Generators]] for more information.
 
Alternatively, the vanilla server now includes an option to export the current block state ID mapping, by running <code>java -cp minecraft_server.jar net.minecraft.data.Main --reports</code>.  See [[Data Generators]] for more information.
Line 111: Line 111:
 
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
 
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
  
If compressed, the uncompressed length of (Packet ID + Data) must be equal to or over the threshold set in the packet [[#Set Compression 2|Set Compression]], otherwise the receiving party will disconnect.
+
If compressed, the uncompressed length of (Packet ID + Data) must be equal to or over the threshold set in the packet [[#Set Compression|Set Compression]], otherwise the receiving party will disconnect.
  
 
Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all.
 
Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all.
Line 140: Line 140:
 
  | Protocol Version
 
  | Protocol Version
 
  | VarInt
 
  | VarInt
  | See [[protocol version numbers]] (currently 404 in Minecraft 1.13.2)
+
  | See [[protocol version numbers]] (currently 498 in Minecraft 1.14.4)
 
  |-
 
  |-
 
  | Server Address
 
  | Server Address
 
  | String (255)
 
  | String (255)
  | Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. The Notchian server does not use this information.
+
  | Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. The Notchian server does not use this information. Note that SRV records are a complete redirect, e.g. if _minecraft._tcp.example.com points to mc.example.org, users connecting to example.com will provide mc.example.org as server address in addition to connecting to it.
 
  |-  
 
  |-  
 
  | Server Port
 
  | Server Port
Line 207: Line 207:
 
  |-
 
  |-
 
  | Type
 
  | Type
  | Byte
+
  | VarInt
  | The type of object (see [[Entities#Objects]])
+
  | The type of object (same as in [[#Spawn Mob|Spawn Mob]])
 
  |-
 
  |-
 
  | X
 
  | X
Line 622: Line 622:
 
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
 
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
  
This packet must be sent after the [[#Player List Item|Player List Item]] packet that adds the player data for the client to use when spawning a player. If the Player List Item for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player List Item packet includes skin/cape data.
+
This packet must be sent after the [[#Player Info|Player Info]] packet that adds the player data for the client to use when spawning a player. If the Player Info for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player Info packet includes skin/cape data.
  
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
Line 1,095: Line 1,095:
 
* '''8''': Set the destination for a end gateway
 
* '''8''': Set the destination for a end gateway
 
* '''9''': Set the text on a sign
 
* '''9''': Set the text on a sign
* '''10''': Declare a shulker box, no data appears to be sent and the client seems to do fine without this packet. Perhaps it is a leftover from earlier versions?
+
* '''10''': Unused
 
* '''11''': Declare a bed
 
* '''11''': Declare a bed
 +
* '''12''': Set data of a jigsaw block
 +
* '''13''': Set items in a campfire
  
 
==== Block Action ====
 
==== Block Action ====
Line 1,296: Line 1,298:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x0D
+
  |rowspan="2"| 0x0D
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
 
  | Difficulty
 
  | Difficulty
 
  | Unsigned Byte
 
  | Unsigned Byte
 
  | 0: peaceful, 1: easy, 2: normal, 3: hard
 
  | 0: peaceful, 1: easy, 2: normal, 3: hard
 +
|-
 +
| Difficulty locked?
 +
| Boolean
 +
|
 
  |}
 
  |}
  
Line 1,508: Line 1,514:
 
  | This is the ID of the window that was closed. 0 for inventory.
 
  | This is the ID of the window that was closed. 0 for inventory.
 
  |}
 
  |}
 
==== Open Window ====
 
 
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="5"| 0x14
 
|rowspan="5"| Play
 
|rowspan="5"| Client
 
| Window ID
 
| Unsigned Byte
 
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
|-
 
| Window Type
 
| String (32)
 
| The window type to use for display. See [[Inventory]] for a list.
 
|-
 
| Window Title
 
| [[Chat]]
 
| The title of the window
 
|-
 
| Number Of Slots
 
| Unsigned Byte
 
| Number of slots in the window (excluding the number of slots in the player inventory). Always 0 for non-storage windows (e.g. Workbench, Anvil).
 
|-
 
| Entity ID
 
| Optional Int
 
| EntityHorse's EID. Only sent when Window Type is “EntityHorse”
 
|}
 
 
See [[Inventory]] for further information.
 
  
 
==== Window Items ====
 
==== Window Items ====
Line 1,560: Line 1,528:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x15
+
  |rowspan="3"| 0x14
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
 
  |rowspan="3"| Client
 
  |rowspan="3"| Client
Line 1,590: Line 1,558:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x16
+
  |rowspan="3"| 0x15
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
 
  |rowspan="3"| Client
 
  |rowspan="3"| Client
Line 1,830: Line 1,798:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x17
+
  |rowspan="3"| 0x16
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
 
  |rowspan="3"| Client
 
  |rowspan="3"| Client
Line 1,862: Line 1,830:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x18
+
  |rowspan="2"| 0x17
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
Line 1,890: Line 1,858:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x19
+
  |rowspan="2"| 0x18
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
Line 1,915: Line 1,883:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x1A
+
  |rowspan="7"| 0x19
 
  |rowspan="7"| Play
 
  |rowspan="7"| Play
 
  |rowspan="7"| Client
 
  |rowspan="7"| Client
 
  | Sound Name
 
  | Sound Name
 
  | Identifier
 
  | Identifier
  | All sound effect names as of 1.13.2 can be seen [https://pokechu22.github.io/Burger/1.13.2.html#sounds here].
+
  | All sound effect names as of 1.14.4 can be seen [https://pokechu22.github.io/Burger/1.14.4.html#sounds here].
 
  |-
 
  |-
 
  | Sound Category
 
  | Sound Category
Line 1,959: Line 1,927:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x1B
+
  | 0x1A
 
  | Play
 
  | Play
 
  | Client
 
  | Client
Line 1,979: Line 1,947:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1C
+
  |rowspan="2"| 0x1B
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
Line 1,993: Line 1,961:
 
See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
 
See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
  
==== NBT Query Response ====
+
==== Explosion ====
 +
 
 +
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
  
Sent in response to [[#Query Block NBT|Query Block NBT]] or [[#Query Entity NBT|Query Entity NBT]].
+
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,005: Line 1,975:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
|rowspan="2"| 0x1D
+
  |rowspan="9"| 0x1C
|rowspan="2"| Play
+
  |rowspan="9"| Play
|rowspan="2"| Client
 
| Transaction ID
 
| VarInt
 
| Can be compared to the one sent in the original query packet.
 
|-
 
| NBT
 
| [[NBT|NBT Tag]]
 
| The NBT of the block or entity.  May be a TAG_END (0) in which case no NBT is present.
 
|}
 
 
 
==== 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
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
  |rowspan="9"| 0x1E
 
  |rowspan="9"| Play
 
 
  |rowspan="9"| Client
 
  |rowspan="9"| Client
 
  | X
 
  | X
Line 2,083: Line 2,027:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1F
+
  |rowspan="2"| 0x1D
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
Line 2,109: Line 2,053:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x20
+
  |rowspan="2"| 0x1E
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
Line 2,170: Line 2,114:
 
  | Play elder guardian mob appearance (effect and sound)
 
  | Play elder guardian mob appearance (effect and sound)
 
  |  
 
  |  
 +
|}
 +
 +
==== Open Horse Window ====
 +
 +
This packet is used exclusively for opening the horse GUI.  [[#Open Window|Open Window]] is used for all other GUIs.
 +
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="3"| 0x1F
 +
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Window ID?
 +
| Byte
 +
|
 +
|-
 +
| Number of slots?
 +
| VarInt
 +
|
 +
|-
 +
| Entity ID?
 +
| Integer
 +
|
 
  |}
 
  |}
  
Line 2,186: Line 2,158:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x21
+
  |rowspan="1"| 0x20
 
  |rowspan="1"| Play
 
  |rowspan="1"| Play
 
  |rowspan="1"| Client
 
  |rowspan="1"| Client
Line 2,208: Line 2,180:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x22
+
  |rowspan="9"| 0x21
  |rowspan="8"| Play
+
  |rowspan="9"| Play
  |rowspan="8"| Client
+
  |rowspan="9"| Client
 
  | Chunk X
 
  | Chunk X
 
  | Int
 
  | Int
Line 2,226: Line 2,198:
 
  | VarInt
 
  | VarInt
 
  | Bitmask with bits set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
 
  | Bitmask with bits set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
 +
|-
 +
| Heightmaps
 +
| [[NBT]]
 +
| Compound containing one long array named <code>MOTION_BLOCKING</code>, which is a heightmap for the highest solid block at each position in the chunk (as a compacted long array with 256 entries at 9 bits per entry totaling 36 longs). The Notchian server also adds a <code>WORLD_SURFACE</code> long array, the purpose of which is unknown, but it's not required for the chunk to be accepted.
 
  |-  
 
  |-  
 
  | Size
 
  | Size
Line 2,243: Line 2,219:
 
  | All block entities in the chunk.  Use the x, y, and z tags in the NBT to determine their positions.
 
  | All block entities in the chunk.  Use the x, y, and z tags in the NBT to determine their positions.
 
  |}
 
  |}
 +
 +
Note that the Notchian client requires an [[#Update View Position|Update View Position]] packet when it crosses a chunk border, otherwise it'll only display render distance + 2 chunks around the chunk it spawned in.
  
 
==== Effect ====
 
==== Effect ====
Line 2,258: Line 2,236:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x23
+
  |rowspan="4"| 0x22
 
  |rowspan="4"| Play
 
  |rowspan="4"| Play
 
  |rowspan="4"| Client
 
  |rowspan="4"| Client
Line 2,530: Line 2,508:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="11"| 0x24
+
  |rowspan="11"| 0x23
 
  |rowspan="11"| Play
 
  |rowspan="11"| Play
 
  |rowspan="11"| Client
 
  |rowspan="11"| Client
Line 2,577: Line 2,555:
 
  | The variable data listed in [[#Particle|the particle data type]].
 
  | The variable data listed in [[#Particle|the particle data type]].
 
  |}
 
  |}
 +
 +
==== Update Light ====
 +
 +
Updates light levels for a chunk.
 +
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 +
|-
 +
|rowspan="10"| 0x24
 +
|rowspan="10"| Play
 +
|rowspan="10"| Client
 +
|colspan="2"| Chunk X
 +
|colspan="2"| VarInt
 +
| Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
|colspan="2"| Chunk Z
 +
|colspan="2"| VarInt
 +
| Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
|colspan="2"| Sky Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, with the lowest bit corresponding to chunk section -1 (in the void, y=-16 to y=-1) and the highest bit for chunk section 16 (above the world, y=256 to y=271)
 +
|-
 +
|colspan="2"| Block Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, with the same order as sky light
 +
|-
 +
|colspan="2"| Empty Sky Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, which indicates sections that have 0 for all their sky light values.  If a section is set in both this mask and the main sky light mask, it is ignored for this mask and it is included in the sky light arrays (the notchian server does not create such masks).  If it is only set in this mask, it is not included in the sky light arrays.
 +
|-
 +
|colspan="2"| Empty Block Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, which indicates sections that have 0 for all their block light values.  If a section is set in both this mask and the main block light mask, it is ignored for this mask and it is included in the block light arrays (the notchian server does not create such masks).  If it is only set in this mask, it is not included in the block light arrays.
 +
|-
 +
|rowspan="2"| Sky Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Sky Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the sky light mask, starting with the lowest value.  Half a byte per light value.
 +
|-
 +
|rowspan="2"| Block Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Block Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the block light mask, starting with the lowest value.  Half a byte per light value.
 +
|}
 +
 +
Individual block or sky light arrays are is given for each block with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates. Even-indexed items (those with an even x coordinate, starting at 0) are packed into the low bits, odd-indexed into the high bits.
  
 
==== Join Game ====
 
==== Join Game ====
Line 2,604: Line 2,644:
 
  | Int Enum
 
  | Int Enum
 
  | -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
 
  | -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
|-
 
| Difficulty
 
| Unsigned Byte
 
| 0: peaceful, 1: easy, 2: normal, 3: hard
 
 
  |-
 
  |-
 
  | Max Players
 
  | Max Players
Line 2,615: Line 2,651:
 
  | Level Type
 
  | Level Type
 
  | String Enum (16)
 
  | String Enum (16)
  | default, flat, largeBiomes, amplified, default_1_1
+
  | default, flat, largeBiomes, amplified, customized, buffet, default_1_1
 +
|-
 +
| View Distance
 +
| VarInt
 +
| Render distance (2-32)
 
  |-
 
  |-
 
  | Reduced Debug Info
 
  | Reduced Debug Info
Line 2,634: Line 2,674:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="16"| 0x26
+
  |rowspan="17"| 0x26
  |rowspan="16"| Play
+
  |rowspan="17"| Play
  |rowspan="16"| Client
+
  |rowspan="17"| Client
 
  |colspan="2"| Map ID
 
  |colspan="2"| Map ID
 
  |colspan="2"| VarInt
 
  |colspan="2"| VarInt
Line 2,648: Line 2,688:
 
  |colspan="2"| Boolean
 
  |colspan="2"| Boolean
 
  | Specifies whether player and item frame icons are shown
 
  | Specifies whether player and item frame icons are shown
 +
|-
 +
|colspan="2"| Locked
 +
|colspan="2"| Boolean
 +
| True if the map has been locked in a cartography table
 
  |-  
 
  |-  
 
  |colspan="2"| Icon Count
 
  |colspan="2"| Icon Count
Line 2,653: Line 2,697:
 
  | Number of elements in the following array
 
  | Number of elements in the following array
 
  |-
 
  |-
  |rowspan="5"| Icon
+
  |rowspan="6"| Icon
 
  | Type
 
  | Type
 
  |rowspan="6"| Array
 
  |rowspan="6"| Array
Line 2,680: Line 2,724:
 
  |-  
 
  |-  
 
  |colspan="2"| Columns
 
  |colspan="2"| Columns
  |colspan="2"| Byte
+
  |colspan="2"| Unsigned Byte
 
  | Number of columns updated
 
  | Number of columns updated
 
  |-
 
  |-
Line 2,795: Line 2,839:
 
  |}
 
  |}
  
==== Entity ====
+
==== Trade List ====
  
This packet may be used to initialize an entity.
+
The list of trades a villager NPC is offering.
 
 
For player entities, either this packet or any move/look packet is sent every game tick. So the meaning of this packet is basically that the entity did not move/look since the last such packet.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,805: Line 2,847:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x27
+
  |rowspan="18"| 0x27
  |rowspan="1"| Play
+
  |rowspan="18"| Play
  |rowspan="1"| Client
+
  |rowspan="18"| Client
| Entity ID
 
| VarInt
 
|
 
|}
 
 
 
==== Entity Relative Move ====
 
 
 
This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Entity Teleport|Entity Teleport]] should be sent instead.
 
 
 
This packet allows at most 8 blocks movement in any direction, because short range is from -32768 to 32767. And <code>32768 / (128 * 32)</code> = 8.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x28
+
  | colspan="2" | Window ID
  |rowspan="5"| Play
+
  | colspan="2" | VarInt
|rowspan="5"| Client
+
  | The ID of the window that is open; this is an int rather than a byte.
  | Entity ID
 
| VarInt
 
|
 
 
  |-
 
  |-
  | Delta X
+
  | colspan="2" | Size
  | Short
+
  | colspan="2" | Byte
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
  | The number of trades in the following array
 
  |-
 
  |-
  | Delta Y
+
  | rowspan="11" | Trades
  | Short
+
| Input item 1
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
| rowspan="11" | Array
 +
  | [[Slot]]
 +
  | The first item the villager is buying
 
  |-
 
  |-
  | Delta Z
+
  | Output item
  | Short
+
  | [[Slot]]
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
+
  | The item the villager is selling
 
  |-
 
  |-
  | On Ground
+
  | Has second item
 
  | Boolean
 
  | Boolean
  |  
+
  | Whether there is a second item
 +
|-
 +
| Input item 2
 +
| Optional [[Slot]]
 +
| The second item the villager is buying; only present if they have a second item.
 +
|-
 +
| Trade disabled
 +
| Boolean
 +
| True if the trade is disabled; false if the trade is enabled.
 +
|-
 +
| Number of trade uses
 +
| Integer
 +
| Number of times the trade has been used so far
 +
|-
 +
| Maximum number of trade uses
 +
| Integer
 +
| Number of times this trade can be used
 +
|-
 +
| XP
 +
| Integer
 +
|
 +
|-
 +
| Special Price
 +
| Integer
 +
|
 +
|-
 +
| Price Multiplier
 +
| Float
 +
|
 +
|-
 +
| Demand
 +
| Integer
 +
|
 +
|-
 +
|colspan="2"| Villager level
 +
|colspan="2"| VarInt
 +
| Appears on the trade GUI; meaning comes from the translation key <code>merchant.level.</code> + level.
 +
1: Novice, 2: Apprentice, 3: Journeyman, 4: Expert, 5: Master
 +
|-
 +
|colspan="2"| Experience
 +
|colspan="2"| VarInt
 +
| Total experience for this villager (always 0 for the wandering trader)
 +
|-
 +
|colspan="2"| Is regular villager
 +
|colspan="2"| Boolean
 +
| True if this is a regular villager; false for the wandering trader.  When false, hides the villager level and some other GUI elements.
 +
|-
 +
|colspan="2"| Can restock
 +
|colspan="2"| Boolean
 +
| True for regular villagers and false for the wandering trader.  If true, the "Villagers restock up to two times per day." message is displayed when hovering over disabled trades.
 
  |}
 
  |}
  
==== Entity Look And Relative Move ====
+
[[File:1.14-merchant-slots.png|thumb|The merchant UI, for reference]]
 +
{{-}}
 +
 
 +
==== Entity Relative Move ====
 +
 
 +
This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Entity Teleport|Entity Teleport]] should be sent instead.
  
This packet is sent by the server when an entity rotates and moves. Since a short range is limited from -32768 to 32767, and movement is offset of fixed-point numbers, this packet allows at most 8 blocks movement in any direction. (<code>-32768 / (32 * 128) == -8</code>)
+
This packet allows at most 8 blocks movement in any direction, because short range is from -32768 to 32767. And <code>32768 / (128 * 32)</code> = 8.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,867: Line 2,944:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x29
+
  |rowspan="5"| 0x28
  |rowspan="7"| Play
+
  |rowspan="5"| Play
  |rowspan="7"| Client
+
  |rowspan="5"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
Line 2,885: Line 2,962:
 
  | Short
 
  | Short
 
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
|-
 
| Yaw
 
| Angle
 
| New angle, not a delta
 
|-
 
| Pitch
 
| Angle
 
| New angle, not a delta
 
 
  |-
 
  |-
 
  | On Ground
 
  | On Ground
Line 2,899: Line 2,968:
 
  |}
 
  |}
  
==== Entity Look ====
+
==== Entity Look And Relative Move ====
  
This packet is sent by the server when an entity rotates.
+
This packet is sent by the server when an entity rotates and moves. Since a short range is limited from -32768 to 32767, and movement is offset of fixed-point numbers, this packet allows at most 8 blocks movement in any direction. (<code>-32768 / (32 * 128) == -8</code>)
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,911: Line 2,980:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x2A
+
  |rowspan="7"| 0x29
  |rowspan="4"| Play
+
  |rowspan="7"| Play
  |rowspan="4"| Client
+
  |rowspan="7"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
 
  |  
 
  |  
 +
|-
 +
| Delta X
 +
| Short
 +
| Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
 +
|-
 +
| Delta Y
 +
| Short
 +
| Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
 +
|-
 +
| Delta Z
 +
| Short
 +
| Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 
  |-
 
  |-
 
  | Yaw
 
  | Yaw
Line 2,931: Line 3,012:
 
  |}
 
  |}
  
==== Vehicle Move (clientbound) ====
+
==== Entity Look ====
  
Note that all fields use absolute positioning and do not allow for relative positioning.
+
This packet is sent by the server when an entity rotates.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,943: Line 3,024:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x2B
+
  |rowspan="4"| 0x2A
  |rowspan="5"| Play
+
  |rowspan="4"| Play
  |rowspan="5"| Client
+
  |rowspan="4"| Client
  | X
+
  | Entity ID
  | Double
+
  | VarInt
  | Absolute position (X coordinate)
+
  |  
|-
 
| Y
 
| Double
 
| Absolute position (Y coordinate)
 
|-
 
| Z
 
| Double
 
| Absolute position (Z coordinate)
 
 
  |-
 
  |-
 
  | Yaw
 
  | Yaw
  | Float
+
  | Angle
  | Absolute rotation on the vertical axis, in degrees
+
  | New angle, not a delta
 
  |-
 
  |-
 
  | Pitch
 
  | Pitch
  | Float
+
  | Angle
  | Absolute rotation on the horizontal axis, in degrees
+
  | New angle, not a delta
  |}
+
|-
 +
| On Ground
 +
| Boolean
 +
|
 +
  |}
  
==== Open Sign Editor ====
+
==== Entity ====
 +
 
 +
This packet may be used to initialize an entity.
  
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]]. There must already be a sign at the given location (which the client does not do automatically) - send a [[#Block Change|Block Change]] first.
+
For player entities, either this packet or any move/look packet is sent every game tick. So the meaning of this packet is basically that the entity did not move/look since the last such packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,979: Line 3,058:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x2C
+
  |rowspan="1"| 0x2B
 
  |rowspan="1"| Play
 
  |rowspan="1"| Play
 
  |rowspan="1"| Client
 
  |rowspan="1"| Client
  | Location
+
  | Entity ID
  | Position
+
  | VarInt
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Craft Recipe Response ====
+
==== Vehicle Move (clientbound) ====
  
Response to the serverbound packet ([[#Craft Recipe Request|Craft Recipe Request]]), with the same recipe ID.  Appears to be used to notify the UI.
+
Note that all fields use absolute positioning and do not allow for relative positioning.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,999: Line 3,078:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x2D
+
  |rowspan="5"| 0x2C
  |rowspan="2"| Play
+
  |rowspan="5"| Play
  |rowspan="2"| Client
+
  |rowspan="5"| Client
  | Window ID
+
  | X
  | Byte
+
  | Double
  |
+
  | Absolute position (X coordinate)
 +
|-
 +
| Y
 +
| Double
 +
| Absolute position (Y coordinate)
 +
|-
 +
| Z
 +
| Double
 +
| Absolute position (Z coordinate)
 +
|-
 +
| Yaw
 +
| Float
 +
| Absolute rotation on the vertical axis, in degrees
 
  |-
 
  |-
  | Recipe
+
  | Pitch
  | Identifier
+
  | Float
  | A recipe ID
+
  | Absolute rotation on the horizontal axis, in degrees
 
  |}
 
  |}
  
==== Player Abilities (clientbound) ====
+
==== Open Book ====
  
The latter 2 floats are used to indicate the field of view and flying speed respectively, while the first byte is used to determine the value of 4 booleans.
+
Sent when a player right clicks with a signed book. This tells the client to open the book GUI.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,023: Line 3,114:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x2E
+
  |rowspan="1"| 0x2D
  |rowspan="3"| Play
+
  |rowspan="1"| Play
  |rowspan="3"| Client
+
  |rowspan="1"| Client
  | Flags
+
  | Hand
  | Byte
+
  | VarInt enum
  | Bit field, see below
+
  | 0: Main hand, 1: Off hand
|-
 
| Flying Speed
 
| Float
 
|
 
|-
 
| Field of View Modifier
 
| Float
 
| Modifies the field of view, like a speed potion. A Notchian server will use the same value as the movement speed (send in the [[Protocol#Entity_Properties|Entity Properties]] packet).
 
 
  |}
 
  |}
  
About the flags:
+
==== Open Window ====
 +
 
 +
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.  For horses, use [[#Open Horse Window|Open Horse Window]].
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Field
+
  |rowspan="3"| 0x2E
  ! Bit
+
  |rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Window ID
 +
| VarInt
 +
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
  |-
 
  |-
  | Invulnerable
+
  | Window Type
  | 0x01
+
  | VarInt
 +
| The window type to use for display. Contained in the <code>minecraft:menu</code> regisry; see [[Inventory]] for the different values.
 
  |-
 
  |-
  | Flying
+
  | Window Title
  | 0x02
+
  | [[Chat]]
  |-
+
  | The title of the window
| Allow Flying
 
| 0x04
 
|-
 
| Creative Mode (Instant Break)
 
| 0x08
 
 
  |}
 
  |}
  
==== Combat Event ====
+
==== Open Sign Editor ====
 +
 
 +
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]].  There must already be a sign at the given location (which the client does not do automatically) - send a [[#Block Change|Block Change]] first.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,065: Line 3,158:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x2F
+
  |rowspan="1"| 0x2F
  |rowspan="8"| Play
+
  |rowspan="1"| Play
  |rowspan="8"| Client
+
  |rowspan="1"| Client
  |colspan="2"| Event
+
  | Location
| VarInt Enum
+
  | Position
| Determines the layout of the remaining packet
 
|-
 
! Event
 
! Field Name
 
!
 
!
 
|-
 
| 0: enter combat
 
| ''no fields''
 
| ''no fields''
 
|
 
|-
 
|rowspan="2"| 1: end combat
 
| Duration
 
| VarInt
 
|
 
|-
 
| Entity ID
 
| Int
 
|
 
|-
 
|rowspan="3"| 2: entity dead
 
| Player ID
 
| VarInt
 
|
 
|-
 
| Entity ID
 
| Int
 
|
 
|-
 
| Message
 
  | [[Chat]]
 
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Player Info ====
+
==== Craft Recipe Response ====
  
Sent by the server to update the user list (<tab> in the client).
+
Response to the serverbound packet ([[#Craft Recipe Request|Craft Recipe Request]]), with the same recipe ID.  Appears to be used to notify the UI.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,117: Line 3,178:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="4"| Field Name
+
  ! Field Name
  !colspan="3"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="19"| 0x30
+
  |rowspan="2"| 0x30
  |rowspan="19"| Play
+
  |rowspan="2"| Play
  |rowspan="19"| Client
+
  |rowspan="2"| Client
  |colspan="4"| Action
+
  | Window ID
  |colspan="3"| VarInt
+
  | Byte
  | Determines the rest of the Player format after the UUID
+
  |
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  | Recipe
|colspan="3"| VarInt
+
| Identifier
  | Number of elements in the following array
+
| A recipe ID
 +
|}
 +
 
 +
==== Player Abilities (clientbound) ====
 +
 
 +
The latter 2 floats are used to indicate the field of view and flying speed respectively, while the first byte is used to determine the value of 4 booleans.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  |rowspan="17"| Player
+
  |rowspan="3"| 0x31
  |colspan="3"| UUID
+
  |rowspan="3"| Play
  |rowspan="17"| Array
+
  |rowspan="3"| Client
  |colspan="2"| UUID
+
  | Flags
  |  
+
| Byte
 +
  | Bit field, see below
 
  |-
 
  |-
  ! Action
+
  | Flying Speed
  !colspan="2"| Field Name
+
  | Float
  !colspan="2"|  
+
  | 0.05 by default
!
 
 
  |-
 
  |-
  |rowspan="10"| 0: add player
+
  | Field of View Modifier
  |colspan="2"| Name
+
| Float
  |colspan="2"| String (16)
+
  | Modifies the field of view, like a speed potion. A Notchian server will use the same value as the movement speed sent in the [[Protocol#Entity_Properties|Entity Properties]] packet, which defaults to 0.1 for players.
|
+
  |}
 +
 
 +
About the flags:
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  ! Field
  |colspan="2"| VarInt
+
  ! Bit
| Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | Invulnerable
| Name
+
  | 0x01
|rowspan="4"| Array
 
| String (32767)
 
  |  
 
 
  |-
 
  |-
  | Value
+
  | Flying
| String (32767)
+
  | 0x02
|
 
|-
 
| Is Signed
 
| Boolean
 
  |  
 
 
  |-
 
  |-
  | Signature
+
  | Allow Flying
  | Optional String (32767)
+
  | 0x04
| Only if Is Signed is true
 
 
  |-
 
  |-
  |colspan="2"| Gamemode
+
  | Creative Mode (Instant Break)
  |colspan="2"| VarInt
+
| 0x08
  |
+
|}
 +
 
 +
==== Combat Event ====
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
! Field Type
 +
  ! Notes
 
  |-
 
  |-
  |colspan="2"| Ping
+
  |rowspan="8"| 0x32
  |colspan="2"| VarInt
+
|rowspan="8"| Play
  | Measured in milliseconds
+
|rowspan="8"| Client
 +
  |colspan="2"| Event
 +
| VarInt Enum
 +
  | Determines the layout of the remaining packet
 
  |-
 
  |-
  |colspan="2"| Has Display Name
+
! Event
  |colspan="2"| Boolean
+
! Field Name
 +
!
 +
!
 +
  |-
 +
| 0: enter combat
 +
  | ''no fields''
 +
| ''no fields''
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  |rowspan="2"| 1: end combat
  |colspan="2"| Optional [[Chat]]
+
  | Duration
  | Only if Has Display Name is true
+
| VarInt
 +
  |  
 
  |-
 
  |-
  | 1: update gamemode
+
  | Entity ID
  |colspan="2"| Gamemode
+
  | Int
|colspan="2"| VarInt
 
 
  |  
 
  |  
|-
 
| 2: update latency
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
| Measured in milliseconds
 
 
  |-
 
  |-
  |rowspan="2"| 3: update display name
+
  |rowspan="3"| 2: entity dead
  |colspan="2"| Has Display Name
+
  | Player ID
  |colspan="2"| Boolean
+
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | Entity ID
  |colspan="2"| Optional [[Chat]]
+
  | Int
  | Only send if Has Display Name is true
+
  |  
 
  |-
 
  |-
  | 4: remove player
+
  | Message
  |colspan="2"| ''no fields''
+
  | [[Chat]]
|colspan="2"| ''no fields''
 
 
  |  
 
  |  
 
  |}
 
  |}
  
The Property field looks as in the response of [[Mojang API#UUID -> Profile + Skin/Cape]], except of course using the protocol format instead of JSON. That is, each player will usually have one property with Name “textures” and Value being a base64-encoded JSON string as documented at [[Mojang API#UUID -> Profile + Skin/Cape]]. An empty properties array is also acceptable, and will cause clients to display the player with one of the two default skins depending on UUID.
+
==== Player Info ====
  
Ping values correspond with icons in the following way:
+
Sent by the server to update the user list (<tab> in the client).
* 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.
 
  
==== Face Player ====
+
{| class="wikitable"
 
 
Used to rotate the client player to face the given location or entity (for <code>/teleport [<targets>] <x> <y> <z> facing</code>).
 
 
 
{| class="wikitable"
 
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="4"| Field Name
  ! Field Type
+
  !colspan="3"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x31
+
  |rowspan="19"| 0x33
  |rowspan="8"| Play
+
  |rowspan="19"| Play
  |rowspan="8"| Client
+
  |rowspan="19"| Client
 +
|colspan="4"| Action
 +
|colspan="3"| VarInt
 +
| Determines the rest of the Player format after the UUID
 
  |-
 
  |-
  | Feet/eyes
+
  |colspan="4"| Number Of Players
  | VarInt enum
+
  |colspan="3"| VarInt
  | Values are feet=0, eyes=1.  If set to eyes, aims using the head position; otherwise aims using the feet position.
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Target x
+
  |rowspan="17"| Player
  | Double
+
|colspan="3"| UUID
  | x coordinate of the point to face towards
+
  |rowspan="17"| Array
 +
|colspan="2"| UUID
 +
  |  
 
  |-
 
  |-
  | Target y
+
  ! Action
  | Double
+
!colspan="2"| Field Name
  | y coordinate of the point to face towards
+
  !colspan="2"|  
 +
  !
 
  |-
 
  |-
  | Target z
+
  |rowspan="10"| 0: add player
  | Double
+
|colspan="2"| Name
  | z coordinate of the point to face towards
+
  |colspan="2"| String (16)
 +
  |  
 
  |-
 
  |-
  | Is entity
+
  |colspan="2"| Number Of Properties
  | Boolean
+
  |colspan="2"| VarInt
  | If true, additional information about an entity is provided.
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Entity ID
+
  |rowspan="4"| Property
  | Optional VarInt
+
| Name
  | Only if is entity is true &mdash; the entity to face towards
+
|rowspan="4"| Array
 +
  | String (32767)
 +
  |  
 
  |-
 
  |-
  | Entity feet/eyes
+
  | Value
  | Optional VarInt enum
+
  | String (32767)
  | Whether to look at the entity's eyes or feet.  Same values and meanings as before, just for the entity's head/feet.
+
  |  
  |}
+
  |-  
 
+
| Is Signed
If the entity given by entity ID cannot be found, this packet should be treated as if is entity was false.
+
  | Boolean
 
+
  |
==== Player Position And Look (clientbound) ====
 
 
 
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
 
 
 
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
 
 
 
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”.
 
 
 
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.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x32
+
  | Signature
|rowspan="7"| Play
+
  | Optional String (32767)
|rowspan="7"| Client
+
  | Only if Is Signed is true
| X
 
  | Double
 
  | Absolute or relative position, depending on Flags
 
 
  |-
 
  |-
  | Y
+
  |colspan="2"| Gamemode
  | Double
+
  |colspan="2"| VarInt
  | Absolute or relative position, depending on Flags
+
  |  
 
  |-
 
  |-
  | Z
+
  |colspan="2"| Ping
  | Double
+
|colspan="2"| VarInt
  | Absolute or relative position, depending on Flags
+
| Measured in milliseconds
 +
|-
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
  |-
 +
|colspan="2"| Display Name
 +
|colspan="2"| Optional [[Chat]]
 +
  | Only if Has Display Name is true
 
  |-
 
  |-
  | Yaw
+
  | 1: update gamemode
  | Float
+
  |colspan="2"| Gamemode
  | Absolute or relative rotation on the X axis, in degrees
+
|colspan="2"| VarInt
 +
|
 +
|-
 +
| 2: update latency
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
  | Measured in milliseconds
 
  |-
 
  |-
  | Pitch
+
  |rowspan="2"| 3: update display name
  | Float
+
|colspan="2"| Has Display Name
  | Absolute or relative rotation on the Y axis, in degrees
+
  |colspan="2"| Boolean
 +
  |  
 
  |-
 
  |-
  | Flags
+
  |colspan="2"| Display Name
  | Byte
+
  |colspan="2"| Optional [[Chat]]
  | Bit field, see below
+
  | Only send if Has Display Name is true
 
  |-
 
  |-
  | Teleport ID
+
  | 4: remove player
  | VarInt
+
  |colspan="2"| ''no fields''
  | Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
+
  |colspan="2"| ''no fields''
 +
|  
 
  |}
 
  |}
  
About the Flags field:
+
The Property field looks as in the response of [[Mojang API#UUID -> Profile + Skin/Cape]], except of course using the protocol format instead of JSON. That is, each player will usually have one property with Name “textures” and Value being a base64-encoded JSON string as documented at [[Mojang API#UUID -> Profile + Skin/Cape]]. An empty properties array is also acceptable, and will cause clients to display the player with one of the two default skins depending on UUID.
  
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
+
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.
{| class="wikitable"
+
* A ping under 150 milliseconds will result in 5 bars
|-
+
* A ping under 300 milliseconds will result in 4 bars
! Field
+
* A ping under 600 milliseconds will result in 3 bars
! Bit
+
* 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.
| X
 
| 0x01
 
|-
 
| Y
 
| 0x02
 
|-
 
| Z
 
| 0x04
 
|-
 
| Y_ROT
 
| 0x08
 
|-
 
| X_ROT
 
| 0x10
 
|}
 
  
==== Use Bed ====  
+
==== Face Player ====
  
This packet tells that a player goes to bed.
+
Used to rotate the client player to face the given location or entity (for <code>/teleport [<targets>] <x> <y> <z> facing</code>).
 
 
The client with the matching Entity ID will go into bed mode.
 
 
 
This Packet is sent to all nearby players including the one sent to bed.
 
 
 
Any packets sent with a location not currently occupied by a bed will be ignored by clients.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,363: Line 3,416:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x33
+
  |rowspan="8"| 0x34
  |rowspan="2"| Play
+
  |rowspan="8"| Play
  |rowspan="2"| Client
+
  |rowspan="8"| Client
| Entity ID
 
| VarInt
 
| Sleeping player's EID
 
 
  |-
 
  |-
  | Location
+
  | Feet/eyes
  | Position
+
  | VarInt enum
  | Block location of the head part of the bed
+
  | Values are feet=0, eyes=1.  If set to eyes, aims using the head position; otherwise aims using the feet position.
|}
 
 
 
==== Unlock Recipes ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="10"| 0x34
+
  | Target x
  |rowspan="10"| Play
+
  | Double
  |rowspan="10"| Client
+
  | x coordinate of the point to face towards
 
  |-
 
  |-
  | Action
+
  | Target y
  | VarInt
+
  | Double
  | 0: init, 1: add, 2: remove
+
  | y coordinate of the point to face towards
 
  |-
 
  |-
  | Crafting Recipe Book Open
+
  | Target z
  | Boolean
+
  | Double
  | If true, then the crafting recipe book will be open when the player opens its inventory.
+
  | z coordinate of the point to face towards
 
  |-
 
  |-
  | Crafting Recipe Book Filter Active
+
  | Is entity
 
  | Boolean
 
  | Boolean
  | If true, then the filtering option is active when the players opens its inventory.
+
  | If true, additional information about an entity is provided.
 
  |-
 
  |-
  | Smelting Recipe Book Open
+
  | Entity ID
| 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.
 
|-
 
| Array size 1
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Recipe IDs
 
| Array of Identifier
 
|
 
|-
 
| Array size 2
 
 
  | Optional VarInt
 
  | Optional VarInt
  | Number of elements in the following array, only present if mode is 0 (init)
+
  | Only if is entity is true &mdash; the entity to face towards
 
  |-
 
  |-
  | Recipe IDs
+
  | Entity feet/eyes
  | Optional Array of Identifier, only present if mode is 0 (init)
+
  | Optional VarInt enum
  |
+
  | Whether to look at the entity's eyes or feet.  Same values and meanings as before, just for the entity's head/feet.
 
  |}
 
  |}
Action:
 
* 0 (init) = All the recipes in the list 2 will added to the recipe book. All the recipes in list 1 will be tagged as displayed, recipes that aren't tagged will be shown in the notification. VERIFY LIST ORDER?
 
* 1 (add) = All the recipes in the list are added and their icon will be shown in the notification.
 
* 2 (remove) = Remove all the recipes in the list. This allows them to re-displayed when they are readded.
 
  
==== Destroy Entities ====
+
If the entity given by entity ID cannot be found, this packet should be treated as if is entity was false.
 +
 
 +
==== Player Position And Look (clientbound) ====  
  
Sent by the server when a list of entities is to be destroyed on the client.
+
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
  
{| class="wikitable"
+
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x35
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Entity IDs
 
| Array of VarInt
 
| The list of entities of destroy
 
|}
 
  
==== Remove Entity Effect ====
+
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”.
  
{| class="wikitable"
+
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.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x36
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
|
 
|-
 
| Effect ID
 
| Byte
 
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 
|}
 
  
==== Resource Pack Send ====
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,486: Line 3,471:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x37
+
  |rowspan="7"| 0x35
  |rowspan="2"| Play
+
  |rowspan="7"| Play
  |rowspan="2"| Client
+
  |rowspan="7"| Client
  | URL
+
  | X
  | String (32767)
+
  | Double
  | The URL to the resource pack.
+
  | 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
 +
|-
 +
| Yaw
 +
| Float
 +
| Absolute or relative rotation on the X axis, in degrees
 +
|-
 +
| Pitch
 +
| Float
 +
| Absolute or relative rotation on the Y axis, in degrees
 +
|-
 +
| Flags
 +
| Byte
 +
| Bit field, see below
 
  |-
 
  |-
  | Hash
+
  | Teleport ID
  | String (40)
+
  | VarInt
  | A 40 character hexadecimal and lowercase [[wikipedia:SHA-1|SHA-1]] hash of the resource pack file. (must be lower case in order to work)<br />If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth — but it will still treat it as a unique id
+
  | Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
 
  |}
 
  |}
  
==== Respawn ====
+
About the Flags field:
  
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.
+
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x38
+
  ! Field
  |rowspan="4"| Play
+
  ! Bit
|rowspan="4"| Client
 
| Dimension
 
| Int Enum
 
| -1: The Nether, 0: The Overworld, 1: The End
 
 
  |-
 
  |-
  | Difficulty
+
  | X
  | Unsigned Byte
+
  | 0x01
| 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
 
 
  |-
 
  |-
  | Gamemode
+
  | Y
  | Unsigned Byte
+
  | 0x02
| 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
 
 
  |-
 
  |-
  | Level Type
+
  | Z
  | String (16)
+
  | 0x04
| Same as [[#Join Game|Join Game]]
 
|}
 
 
 
{{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).
 
 
 
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.}}
 
 
 
==== Entity Head Look ====
 
 
 
Changes the direction an entity's head is facing.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x39
+
  | Y_ROT
|rowspan="2"| Play
+
  | 0x08
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
  |  
 
 
  |-
 
  |-
  | Head Yaw
+
  | X_ROT
  | Angle
+
  | 0x10
| New angle, not a delta
 
 
  |}
 
  |}
  
==== Select Advancement Tab ====
+
==== Unlock Recipes ====
 
 
Sent by the server to indicate that the client should switch advancement tab. Sent either when the client switches tab in the GUI or when an advancement in another tab is made.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,570: Line 3,538:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  |rowspan="10"| 0x36
  |rowspan="2"| Play
+
  |rowspan="10"| Play
  |rowspan="2"| Client
+
  |rowspan="10"| Client
| Has id
 
| Boolean
 
| Indicates if the next field is present
 
 
  |-
 
  |-
  | Optional Identifier
+
  | Action
  | String (32767)
+
  | VarInt
  | See below
+
  | 0: init, 1: add, 2: remove
  |}
+
  |-
 
+
| Crafting Recipe Book Open
The Identifier can be one of the following:
+
| Boolean
 
+
| If true, then the crafting recipe book will be open when the player opens its inventory.
{| class="wikitable"
+
|-
  ! Optional Identifier
+
| 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.
 
  |-
 
  |-
  | minecraft:story/root
+
  | Smelting Recipe Book Filter Active
 +
| Boolean
 +
| If true, then the filtering option is active when the players opens its inventory.
 
  |-
 
  |-
  | minecraft:nether/root
+
  | Array size 1
 +
| VarInt
 +
| Number of elements in the following array
 
  |-
 
  |-
  | minecraft:end/root
+
  | Recipe IDs
 +
| Array of Identifier
 +
|
 
  |-
 
  |-
  | minecraft:adventure/root
+
  | Array size 2
 +
| Optional VarInt
 +
| Number of elements in the following array, only present if mode is 0 (init)
 
  |-
 
  |-
  | minecraft:husbandry/root
+
  | Recipe IDs
 +
| Optional Array of Identifier, only present if mode is 0 (init)
 +
|
 
  |}
 
  |}
 +
Action:
 +
* 0 (init) = All the recipes in the list 2 will added to the recipe book. All the recipes in list 1 will be tagged as displayed, recipes that aren't tagged will be shown in the notification. VERIFY LIST ORDER?
 +
* 1 (add) = All the recipes in the list are added and their icon will be shown in the notification.
 +
* 2 (remove) = Remove all the recipes in the list. This allows them to re-displayed when they are readded.
  
If no or an invalid identifier is sent, the client will switch to the first tab in the GUI.
+
==== Destroy Entities ====
  
==== World Border ====
+
Sent by the server when a list of entities is to be destroyed on the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,606: Line 3,591:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="18"| 0x3B
+
  |rowspan="2"| 0x37
  |rowspan="18"| Play
+
  |rowspan="2"| Play
  |rowspan="18"| Client
+
  |rowspan="2"| Client
  |colspan="2"| Action
+
  | Count
  | VarInt Enum
+
  | VarInt
  | Determines the format of the rest of the packet
+
  | Number of elements in the following array
 
  |-
 
  |-
  ! Action
+
| Entity IDs
 +
| Array of VarInt
 +
| The list of entities of destroy
 +
|}
 +
 
 +
==== Remove Entity Effect ====
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 
  ! Field Name
 
  ! Field Name
  !  
+
  ! Field Type
  !  
+
  ! Notes
 
  |-
 
  |-
  | 0: set size
+
  |rowspan="2"| 0x38
  | Diameter
+
|rowspan="2"| Play
  | Double
+
|rowspan="2"| Client
  | Length of a single side of the world border, in meters
+
  | Entity ID
 +
  | VarInt
 +
  |  
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
  | Effect ID
  | Old Diameter
+
| Byte
  | Double
+
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
  | Current length of a single side of the world border, in meters
+
  |}
  |-
+
 
  | New Diameter
+
==== Resource Pack Send ====
  | Double
+
 
  | Target length of a single side of the world border, in meters
+
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Speed
+
  |rowspan="2"| 0x39
  | VarLong
+
  |rowspan="2"| Play
  | Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
+
  |rowspan="2"| Client
 +
| URL
 +
| String (32767)
 +
| The URL to the resource pack.
 
  |-
 
  |-
  |rowspan="2"| 2: set center
+
  | Hash
  | X
+
| String (40)
  | Double
+
| A 40 character hexadecimal and lowercase [[wikipedia:SHA-1|SHA-1]] hash of the resource pack file. (must be lower case in order to work)<br />If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth — but it will still treat it as a unique id
  |
+
|}
 +
 
 +
==== 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.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Z
+
  |rowspan="3"| 0x3A
  | Double
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Dimension
 +
  | Int Enum
 +
  | -1: The Nether, 0: The Overworld, 1: The End
 
  |-
 
  |-
  |rowspan="8"| 3: initialize
+
  | Gamemode
  | X
+
  | Unsigned Byte
| Double
+
  | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
  |  
 
 
  |-
 
  |-
  | Z
+
  | Level Type
  | Double
+
  | String (16)
  |  
+
  | Same as [[#Join Game|Join Game]]
|-
 
| Old Diameter
 
| Double
 
| Current length of a single side of the world border, in meters
 
|-
 
| New Diameter
 
| Double
 
| Target length of a single side of the world border, in meters
 
|-
 
| Speed
 
| VarLong
 
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 
|-
 
| Portal Teleport Boundary
 
| VarInt
 
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 
|-
 
| Warning Time
 
| VarInt
 
| In seconds as set by <code>/worldborder warning time</code>
 
|-
 
| Warning Blocks
 
| VarInt
 
| In meters
 
|-
 
|rowspan="1"| 4: set warning time
 
| Warning Time
 
| VarInt
 
| In seconds as set by <code>/worldborder warning time</code>
 
|-
 
|rowspan="1"| 5: set warning blocks
 
| Warning Blocks
 
| VarInt
 
| In meters
 
 
  |}
 
  |}
  
The Notchian client determines how solid to display the warning by comparing to whichever is higher, the warning distance or whichever is lower, the distance from the current diameter to the target diameter or the place the border will be after warningTime seconds. In pseudocode:
+
{{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).
  
<syntaxhighlight lang="java">
+
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.}}
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 
if (playerDistance < distance) {
 
    warning = 1.0 - playerDistance / distance;
 
} else {
 
    warning = 0.0;
 
}
 
</syntaxhighlight>
 
  
==== Camera ====
+
==== Entity Head Look ====
  
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
+
Changes the direction an entity's head is facing.
  
The player's camera will move with the entity and look where it is looking. The entity is often another player, but can be any type of entity.  The player is unable to move this entity (move packets will act as if they are coming from the other entity).
+
While sending the Entity Look packet changes the vertical rotation of the head, sending this packet appears to be necessary to rotate the head horizontally.
 
 
If the given entity is not loaded by the player, this packet is ignored.  To return control to the player, send this packet with their entity ID.
 
 
 
The Notchian server resets this (sends it back to the default entity) whenever the spectated entity is killed or the player sneaks, but only if they were spectating an entity. It also sends this packet whenever the player switches out of spectator mode (even if they weren't spectating an entity).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,722: Line 3,697:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x3C
+
  |rowspan="2"| 0x3B
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Camera ID
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  | ID of the entity to set the client's camera to
+
  |  
 +
|-
 +
| Head Yaw
 +
| Angle
 +
| New angle, not a delta
 
  |}
 
  |}
  
The notchian also loads certain shaders for given entities:
+
==== Select Advancement Tab ====
  
* Creeper &rarr; <code>shaders/post/creeper.json</code>
+
Sent by the server to indicate that the client should switch advancement tab. Sent either when the client switches tab in the GUI or when an advancement in another tab is made.
* Spider (and cave spider) &rarr; <code>shaders/post/spider.json</code>
 
* Enderman &rarr; <code>shaders/post/invert.json</code>
 
* Anything else &rarr; the current shader is unloaded
 
 
 
==== Held Item Change (clientbound) ====
 
 
 
Sent to change the player's slot selection.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,749: Line 3,721:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x3D
+
  |rowspan="2"| 0x3C
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Slot
+
  | Has id
  | Byte
+
  | Boolean
  | The slot which the player has selected (0–8)
+
  | Indicates if the next field is present
 +
|-
 +
| Optional Identifier
 +
| String (32767)
 +
| See below
 
  |}
 
  |}
  
==== Display Scoreboard ====
+
The Identifier can be one of the following:
 
 
This is sent to the client when it should display a scoreboard.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Optional Identifier
  ! State
+
  |-
  ! Bound To
+
  | minecraft:story/root
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x3E
+
  | minecraft:nether/root
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Position
 
| Byte
 
| The position of the scoreboard. 0: list, 1: sidebar, 2: below name, 3 - 18: team specific sidebar, indexed as 3 + team color.
 
 
  |-
 
  |-
  | Score Name
+
  | minecraft:end/root
| String (16)
 
| The unique name for the scoreboard to be displayed.
 
|}
 
 
 
==== Entity Metadata ====
 
 
 
Updates one or more [[Entities#Entity Metadata Format|metadata]] properties for an existing entity. Any properties not included in the Metadata field are left unchanged.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x3F
+
  | minecraft:adventure/root
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
|
 
 
  |-
 
  |-
  | Metadata
+
  | minecraft:husbandry/root
| [[Entities#Entity Metadata Format|Entity Metadata]]
 
|
 
 
  |}
 
  |}
  
==== Attach Entity ====
+
If no or an invalid identifier is sent, the client will switch to the first tab in the GUI.
  
This packet is sent when an entity has been {{Minecraft Wiki|Lead|leashed}} to another entity.
+
==== World Border ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,813: Line 3,757:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x40
+
  |rowspan="18"| 0x3D
  |rowspan="2"| Play
+
  |rowspan="18"| Play
  |rowspan="2"| Client
+
  |rowspan="18"| Client
  | Attached Entity ID
+
  |colspan="2"| Action
  | Int
+
  | VarInt Enum
  | Attached entity's EID
+
  | Determines the format of the rest of the packet
 
  |-
 
  |-
| Holding Entity ID
+
  ! Action
| Int
 
| ID of the entity holding the lead. Set to -1 to detach.
 
|}
 
 
 
==== Entity Velocity ====
 
 
 
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms); for example, -1343 would move (-1343 / 8000) = −0.167875 blocks per tick (or −3,3575 blocks per second).
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
 
  ! Field Name
 
  ! Field Name
  ! Field Type
+
  !  
  ! Notes
+
  !  
 +
|-
 +
| 0: set size
 +
| Diameter
 +
| Double
 +
| Length of a single side of the world border, in meters
 
  |-
 
  |-
  |rowspan="4"| 0x41
+
  |rowspan="3"| 1: lerp size
  |rowspan="4"| Play
+
  | Old Diameter
|rowspan="4"| Client
+
  | Double
| Entity ID
+
  | Current length of a single side of the world border, in meters
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Velocity X
+
  | New Diameter
  | Short
+
  | Double
  | Velocity on the X axis
+
  | Target length of a single side of the world border, in meters
 
  |-
 
  |-
  | Velocity Y
+
  | Speed
  | Short
+
  | VarLong
  | Velocity on the Y axis
+
  | Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 
  |-
 
  |-
  | Velocity Z
+
  |rowspan="2"| 2: set center
  | Short
+
  | X
  | Velocity on the Z axis
+
  | Double
  |}
+
  |  
 
 
==== Entity Equipment ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x42
+
  | Z
|rowspan="3"| Play
+
  | Double
|rowspan="3"| Client
+
  |  
| Entity ID
 
  | VarInt
 
  | Entity's EID
 
 
  |-
 
  |-
  | Slot
+
  |rowspan="8"| 3: initialize
  | VarInt Enum
+
  | X
  | Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
+
| Double
 +
  |  
 
  |-
 
  |-
  | Item
+
  | Z
  | [[Slot Data|Slot]]
+
  | Double
 
  |  
 
  |  
|}
 
 
==== Set Experience ====
 
 
Sent by the server when the client should change experience levels.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x43
+
  | Old Diameter
  |rowspan="3"| Play
+
| Double
  |rowspan="3"| Client
+
| Current length of a single side of the world border, in meters
  | Experience bar
+
|-
  | Float
+
  | New Diameter
  | Between 0 and 1
+
| Double
 +
  | Target length of a single side of the world border, in meters
 +
|-
 +
  | Speed
 +
  | VarLong
 +
  | Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 +
|-
 +
| Portal Teleport Boundary
 +
| VarInt
 +
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 +
|-
 +
| Warning Time
 +
| VarInt
 +
| In seconds as set by <code>/worldborder warning time</code>
 +
|-
 +
| Warning Blocks
 +
| VarInt
 +
| In meters
 
  |-
 
  |-
  | Level
+
  |rowspan="1"| 4: set warning time
 +
| Warning Time
 
  | VarInt
 
  | VarInt
  |  
+
  | In seconds as set by <code>/worldborder warning time</code>
 
  |-
 
  |-
  | Total Experience
+
  |rowspan="1"| 5: set warning blocks
 +
| Warning Blocks
 
  | VarInt
 
  | VarInt
  | See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
+
  | In meters
 
  |}
 
  |}
  
==== Update Health ====
+
The Notchian client determines how solid to display the warning by comparing to whichever is higher, the warning distance or whichever is lower, the distance from the current diameter to the target diameter or the place the border will be after warningTime seconds. In pseudocode:
 +
 
 +
<syntaxhighlight lang="java">
 +
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 +
if (playerDistance < distance) {
 +
    warning = 1.0 - playerDistance / distance;
 +
} else {
 +
    warning = 0.0;
 +
}
 +
</syntaxhighlight>
 +
 
 +
==== Camera ====
  
Sent by the server to update/set the health of the player it is sent to.
+
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
  
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
+
The player's camera will move with the entity and look where it is looking. The entity is often another player, but can be any type of entity. The player is unable to move this entity (move packets will act as if they are coming from the other entity).
  
{| class="wikitable"
+
If the given entity is not loaded by the player, this packet is ignored.  To return control to the player, send this packet with their entity ID.
  ! Packet ID
+
 
  ! State
+
The Notchian server resets this (sends it back to the default entity) whenever the spectated entity is killed or the player sneaks, but only if they were spectating an entity. It also sends this packet whenever the player switches out of spectator mode (even if they weren't spectating an entity).
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
  ! State
 
  ! Bound To
 
  ! Bound To
 
  ! Field Name
 
  ! Field Name
Line 3,929: Line 3,873:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x44
+
  |rowspan="1"| 0x3E
  |rowspan="3"| Play
+
  |rowspan="1"| Play
  |rowspan="3"| Client
+
  |rowspan="1"| Client
  | Health
+
  | Camera ID
| Float
 
| 0 or less = dead, 20 = full HP
 
|-
 
| Food
 
 
  | VarInt
 
  | VarInt
  | 0–20
+
  | ID of the entity to set the client's camera to
|-
 
| Food Saturation
 
| Float
 
| Seems to vary from 0.0 to 5.0 in integer increments
 
 
  |}
 
  |}
  
==== Scoreboard Objective ====
+
The notchian also loads certain shaders for given entities:
 +
 
 +
* Creeper &rarr; <code>shaders/post/creeper.json</code>
 +
* Spider (and cave spider) &rarr; <code>shaders/post/spider.json</code>
 +
* Enderman &rarr; <code>shaders/post/invert.json</code>
 +
* Anything else &rarr; the current shader is unloaded
 +
 
 +
==== Held Item Change (clientbound) ====
  
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
+
Sent to change the player's slot selection.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,957: Line 3,900:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x45
+
  |rowspan="1"| 0x3F
  |rowspan="4"| Play
+
  |rowspan="1"| Play
  |rowspan="4"| Client
+
  |rowspan="1"| Client
  | Objective Name
+
  | Slot
| String (16)
 
| An unique name for the objective
 
|-
 
| Mode
 
 
  | Byte
 
  | Byte
  | 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
+
  | The slot which the player has selected (0–8)
  |-
+
  |}
| Objective Value
+
 
| Optional Chat
+
==== Update View Position ====
| Only if mode is 0 or 2. The text to be displayed for the score
+
 
  |-
+
{{Need Info|Why is this even needed?  Is there a better name for it? My guess is that it's something to do with logical behavior with latency, but it still seems weird.}}
| Type
+
 
  | Optional VarInt enum
+
Updates the client's location. This is used to determine what chunks should remain loaded and if a chunk load should be ignored; chunks outside of the view distance may be unloaded.
| Only if mode is 0 or 2. 0 = "integer", 1 = "hearts".
 
|}
 
  
==== Set Passengers ====
+
Sent whenever the player moves across a chunk border horizontally, and also (according to testing) for any integer change in the vertical axis, even if it doesn't go across a chunk section border.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,987: Line 3,924:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x46
+
  |rowspan="2"| 0x40
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Chunk X
 
  | VarInt
 
  | VarInt
  | Vehicle's EID
+
  | Chunk X coordinate of the player's position
 
  |-
 
  |-
  | Passenger Count
+
  | Chunk Z
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array
+
  | Chunk Z coordinate of the player's position
 +
|}
 +
 
 +
==== Update View Distance ====
 +
 
 +
Sent by the integrated singleplayer server when changing render distance.  Does not appear to be used by the dedicated server, as <code>view-distance</code> in server.properties cannot be changed at runtime.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Passengers
+
  |rowspan="1"| 0x41
  | Array of VarInt
+
|rowspan="1"| Play
  | EIDs of entity's passengers
+
|rowspan="1"| Client
 +
| View Distance
 +
  | VarInt
 +
  | Render distance (2-32)
 
  |}
 
  |}
  
==== Teams ====
+
==== Display Scoreboard ====
  
Creates and updates teams.
+
This is sent to the client when it should display a scoreboard.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,011: Line 3,964:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="23"| 0x47
+
  |rowspan="2"| 0x42
  |rowspan="23"| Play
+
  |rowspan="2"| Play
  |rowspan="23"| Client
+
  |rowspan="2"| Client
  |colspan="2"| Team Name
+
  | Position
 +
| Byte
 +
| The position of the scoreboard. 0: list, 1: sidebar, 2: below name, 3 - 18: team specific sidebar, indexed as 3 + team color.
 +
|-
 +
| Score Name
 
  | String (16)
 
  | String (16)
  | A unique name for the team. (Shared with scoreboard).
+
  | The unique name for the scoreboard to be displayed.
 +
|}
 +
 
 +
==== Entity Metadata ====
 +
 
 +
Updates one or more [[Entities#Entity Metadata Format|metadata]] properties for an existing entity. Any properties not included in the Metadata field are left unchanged.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  |colspan="2"| Mode
+
  |rowspan="2"| 0x43
  | Byte
+
  |rowspan="2"| Play
  | Determines the layout of the remaining packet
+
|rowspan="2"| Client
 +
| Entity ID
 +
| VarInt
 +
  |  
 
  |-
 
  |-
  |rowspan="9"| 0: create team
+
  | Metadata
  | Team Display Name
+
  | [[Entities#Entity Metadata Format|Entity Metadata]]
| Chat
 
 
  |  
 
  |  
 +
|}
 +
 +
==== Attach Entity ====
 +
 +
This packet is sent when an entity has been {{Minecraft Wiki|Lead|leashed}} to another entity.
 +
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Friendly Flags
+
  |rowspan="2"| 0x44
  | Byte
+
|rowspan="2"| Play
  | Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible players on same team
+
|rowspan="2"| Client
 +
| Attached Entity ID
 +
  | Int
 +
  | Attached entity's EID
 
  |-
 
  |-
  | Name Tag Visibility
+
  | Holding Entity ID
  | String Enum (32)
+
| Int
  | <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
+
  | ID of the entity holding the lead. Set to -1 to detach.
 +
  |}
 +
 
 +
==== Entity Velocity ====
 +
 
 +
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms); for example, -1343 would move (-1343 / 8000) = −0.167875 blocks per tick (or −3,3575 blocks per second).
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Collision Rule
+
  |rowspan="4"| 0x45
  | String Enum (32)
+
|rowspan="4"| Play
  | <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
+
|rowspan="4"| Client
 +
| Entity ID
 +
  | VarInt
 +
  |  
 
  |-
 
  |-
  | Formatting
+
  | Velocity X
  | VarInt enum
+
  | Short
  | See below
+
  | Velocity on the X axis
 
  |-
 
  |-
  | Team Prefix
+
  | Velocity Y
  | Chat
+
  | Short
  | Displayed before the names of players that are part of this team
+
  | Velocity on the Y axis
 
  |-
 
  |-
  | Team Suffix
+
  | Velocity Z
  | Chat
+
  | Short
  | Displayed after the names of players that are part of this team
+
  | Velocity on the Z axis
  |-
+
|}
  | Entity Count
+
 
  | VarInt
+
==== Entity Equipment ====
  | Number of elements in the following array
+
 
  |-
+
{| class="wikitable"
  | Entities
+
! Packet ID
  | Array of String (40)
+
! State
  | Identifiers for the entities in this team. For players, this is their username; for other entities, it is their UUID.
+
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
  |-
 +
|rowspan="3"| 0x46
 +
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
  | Entity ID
 +
  | VarInt
 +
  | Entity's EID
 +
  |-
 +
  | Slot
 +
  | VarInt Enum
 +
  | Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
 
  |-
 
  |-
  | 1: remove team
+
  | Item
  | ''no fields''
+
  | [[Slot Data|Slot]]
| ''no fields''
 
 
  |  
 
  |  
 +
|}
 +
 +
==== Set Experience ====
 +
 +
Sent by the server when the client should change experience levels.
 +
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  |rowspan="7"| 2: update team info
+
  |rowspan="3"| 0x47
  | Team Display Name
+
  |rowspan="3"| Play
  | Chat
+
|rowspan="3"| Client
 +
| Experience bar
 +
| Float
 +
| Between 0 and 1
 +
|-
 +
| Level
 +
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Friendly Flags
+
  | Total Experience
| Byte
 
| Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible entities on same team
 
|-
 
| Name Tag Visibility
 
| String Enum (32)
 
| <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
 
|-
 
| Collision Rule
 
| String Enum (32)
 
| <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
 
|-
 
| Formatting
 
| VarInt enum
 
| See below
 
|-
 
| Team Prefix
 
| Chat
 
| Displayed before the names of players that are part of this team
 
|-
 
| Team Suffix
 
| Chat
 
| Displayed after the names of players that are part of this team
 
|-
 
|rowspan="2"| 3: add players to team
 
| Entity Count
 
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array
+
  | See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
|-
 
| Entities
 
| Array of String (40)
 
| Identifiers for the entities added.  For players, this is their username; for other entities, it is their UUID.
 
|-
 
|rowspan="2"| 4: remove players from team
 
| Entity Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Entities
 
| Array of String (40)
 
| Identifiers for the entities removed.  For players, this is their username; for other entities, it is their UUID.
 
 
  |}
 
  |}
  
Formatting: The formatting of a team defines how the names of the team members are visualized. The following table lists all the possible formattings.
+
==== Update Health ====
 +
 
 +
Sent by the server to update/set the health of the player it is sent to.
 +
 
 +
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! ID
+
  ! Packet ID
  ! Formatting
+
  ! State
  |-
+
  ! Bound To
  | 0-15
+
! Field Name
  | Color formatting, same values as [[Chat]] colors.
+
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | 16
+
  |rowspan="3"| 0x48
  | Obfuscated
+
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Health
 +
| Float
 +
  | 0 or less = dead, 20 = full HP
 
  |-
 
  |-
  | 17
+
  | Food
  | Bold
+
  | VarInt
  |-
+
  | 0–20
| 18
+
  |-  
| Strikethrough
+
  | Food Saturation
|-
+
  | Float
| 19
+
  | Seems to vary from 0.0 to 5.0 in integer increments
| Underlined
 
  |-
 
  | 20
 
| Italic
 
|-
 
  | 21
 
  | Reset
 
 
  |}
 
  |}
  
==== Update Score ====
+
==== Scoreboard Objective ====
  
This is sent to the client when it should update a scoreboard item.  
+
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,156: Line 4,156:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x48
+
  |rowspan="4"| 0x49
 
  |rowspan="4"| Play
 
  |rowspan="4"| Play
 
  |rowspan="4"| Client
 
  |rowspan="4"| Client
  | Entity Name
+
  | Objective Name
  | String (40)
+
  | String (16)
  | The entity whose score this is.  For players, this is their username; for other entities, it is their UUID.
+
  | An unique name for the objective
 
  |-
 
  |-
  | Action
+
  | Mode
 
  | Byte
 
  | Byte
  | 0 to create/update an item. 1 to remove an item.
+
  | 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.  
 
  |-
 
  |-
  | Objective Name
+
  | Objective Value
  | String (16)
+
  | Optional Chat
  | The name of the objective the score belongs to
+
  | Only if mode is 0 or 2. The text to be displayed for the score
  |-
+
  |-
  | Value
+
  | Type
  | Optional VarInt
+
  | Optional VarInt enum
  | The score to be displayed next to the entry. Only sent when Action does not equal 1.
+
  | Only if mode is 0 or 2. 0 = "integer", 1 = "hearts".
 
  |}
 
  |}
  
==== Spawn Position ====
+
==== Set Passengers ====
 
 
Sent by the server after login to specify the coordinates of the spawn point (the point at which players spawn at, and which the compass points to). It can be sent at any time to update the point compasses point at.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,188: Line 4,186:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x49
+
  |rowspan="3"| 0x4A
  |rowspan="1"| Play
+
  |rowspan="3"| Play
  |rowspan="1"| Client
+
  |rowspan="3"| Client
  | Location
+
  | Entity ID
  | Position
+
  | VarInt
  | Spawn location
+
  | Vehicle's EID
 +
|-
 +
| Passenger Count
 +
| VarInt
 +
| Number of elements in the following array
 +
|-
 +
| Passengers
 +
| Array of VarInt
 +
| EIDs of entity's passengers
 
  |}
 
  |}
  
==== Time Update ====
+
==== Teams ====
  
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.
+
Creates and updates teams.
 
 
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"
 
{| class="wikitable"
Line 4,208: Line 4,210:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x4A
+
  |rowspan="23"| 0x4B
  |rowspan="2"| Play
+
  |rowspan="23"| Play
  |rowspan="2"| Client
+
  |rowspan="23"| Client
  | World Age
+
  |colspan="2"| Team Name
  | Long
+
  | String (16)
  | In ticks; not changed by server commands
+
  | A unique name for the team. (Shared with scoreboard).
 
  |-
 
  |-
  | Time of day
+
  |colspan="2"| Mode
| Long
+
  | Byte
| The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
+
  | Determines the layout of the remaining packet
|}
 
 
 
==== Title ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="10"| 0x4B
+
  |rowspan="9"| 0: create team
  |rowspan="10"| Play
+
  | Team Display Name
|rowspan="10"| Client
+
  | Chat
|colspan="2"| Action
 
  | VarInt Enum
 
 
  |  
 
  |  
 
  |-
 
  |-
  ! Action
+
  | Friendly Flags
  ! Field Name
+
  | Byte
  !
+
| Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible players on same team
  !
+
|-
 +
| Name Tag Visibility
 +
  | String Enum (32)
 +
  | <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
 
  |-
 
  |-
  | 0: set title
+
  | Collision Rule
  | Title Text
+
  | String Enum (32)
| [[Chat]]
+
  | <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
  |  
 
 
  |-
 
  |-
  | 1: set subtitle
+
  | Team Color
  | Subtitle Text
+
  | VarInt enum
  | [[Chat]]
+
  | Used to color the name of players on the team; see below
|
 
|-
 
| 2: set action bar
 
| Action bar text
 
| [[Chat]]
 
| Displays a message above the hotbar (the same as position 2 in [[#Chat Message (clientbound)|Chat Message (clientbound)]], except that it correctly renders formatted chat. See [https://bugs.mojang.com/browse/MC-119145 MC-119145] for more information.)
 
 
  |-
 
  |-
  |rowspan="3"| 3: set times and display
+
  | Team Prefix
  | Fade In
+
| Chat
  | Int
+
| Displayed before the names of players that are part of this team
  | Ticks to spend fading in
+
|-
 +
  | Team Suffix
 +
  | Chat
 +
  | Displayed after the names of players that are part of this team
 
  |-
 
  |-
  | Stay
+
  | Entity Count
  | Int
+
  | VarInt
  | Ticks to keep the title displayed
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Fade Out
+
  | Entities
  | Int
+
  | Array of String (40)
  | Ticks to spend out, not when to start fading out
+
  | Identifiers for the entities in this team.  For players, this is their username; for other entities, it is their UUID.
 
  |-
 
  |-
  | 4: hide
+
  | 1: remove team
 
  | ''no fields''
 
  | ''no fields''
 
  | ''no fields''
 
  | ''no fields''
 
  |  
 
  |  
 
  |-
 
  |-
  | 5: reset
+
  |rowspan="7"| 2: update team info
  | ''no fields''
+
  | Team Display Name
  | ''no fields''
+
  | Chat
 
  |  
 
  |  
|}
 
 
“Hide” makes the title disappear, but if you run times again the same title will appear. “Reset” erases the text.
 
 
The title is visible on screen for Fade In + Stay + Fade Out ticks.
 
 
==== Stop Sound ====
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x4C
+
  | Friendly Flags
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Flags
 
 
  | Byte
 
  | Byte
  | Controls which fields are present.
+
  | Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible entities on same team
 
  |-
 
  |-
  | Source
+
  | Name Tag Visibility
  | Optional VarInt enum
+
  | String Enum (32)
  | Only if flags is 3 or 1 (bit mask 0x1).  See below.  If not present, then sounds from all sources are cleared.
+
  | <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
 
  |-
 
  |-
  | Sound
+
  | Collision Rule
  | Optional Identifier
+
  | String Enum (32)
  | Only if flags is 2 or 3 (bit mask 0x2).  A sound effect name, see [[#Named Sound Effect|Named Sound Effect]].  If not present, then all sounds are cleared.
+
  | <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
|}
 
 
 
Categories:
 
 
 
{| class="wikitable"
 
! Name !! Value
 
 
  |-
 
  |-
  | master || 0
+
  | Team Color
 +
| VarInt enum
 +
| Used to color the name of players on the team; see below
 
  |-
 
  |-
  | music || 1
+
  | Team Prefix
 +
| Chat
 +
| Displayed before the names of players that are part of this team
 
  |-
 
  |-
  | record || 2
+
  | Team Suffix
 +
| Chat
 +
| Displayed after the names of players that are part of this team
 
  |-
 
  |-
  | weather || 3
+
  |rowspan="2"| 3: add players to team
 +
| Entity Count
 +
| VarInt
 +
| Number of elements in the following array
 
  |-
 
  |-
  | block || 4
+
  | Entities
 +
| Array of String (40)
 +
| Identifiers for the entities added.  For players, this is their username; for other entities, it is their UUID.
 
  |-
 
  |-
  | hostile || 5
+
  |rowspan="2"| 4: remove players from team
 +
| Entity Count
 +
| VarInt
 +
| Number of elements in the following array
 
  |-
 
  |-
  | neutral || 6
+
  | Entities
|-
+
  | Array of String (40)
  | player || 7
+
  | Identifiers for the entities removed. For players, this is their username; for other entities, it is their UUID.
  |-
 
  | ambient || 8
 
|-
 
| voice || 9
 
 
  |}
 
  |}
  
==== Sound Effect ====
+
Team Color: The color of a team defines how the names of the team members are visualized; any formatting code can be used. The following table lists all the possible values.
  
This packet is used to play a number of hardcoded sound events. For custom sounds, use [[#Named Sound Effect|Named Sound Effect]].
+
{| class="wikitable"
 +
! ID
 +
! Formatting
 +
|-
 +
| 0-15
 +
| Color formatting, same values as [[Chat]] colors.
 +
|-
 +
| 16
 +
| Obfuscated
 +
|-
 +
| 17
 +
| Bold
 +
|-
 +
| 18
 +
| Strikethrough
 +
|-
 +
| 19
 +
| Underlined
 +
|-
 +
| 20
 +
| Italic
 +
|-
 +
| 21
 +
| Reset
 +
|}
 +
 
 +
==== Update Score ====
  
{{Warning|Numeric sound effect IDs are liable to change between versions}}
+
This is sent to the client when it should update a scoreboard item.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,355: Line 4,355:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x4D
+
  |rowspan="4"| 0x4C
  |rowspan="7"| Play
+
  |rowspan="4"| Play
  |rowspan="7"| Client
+
  |rowspan="4"| Client
  | Sound ID
+
  | Entity Name
  | VarInt
+
  | String (40)
  | ID of hardcoded sound event ([https://pokechu22.github.io/Burger/1.13.2.html#sounds events] as of 1.13.2)
+
  | The entity whose score this is. For players, this is their username; for other entities, it is their UUID.
 
  |-
 
  |-
  | Sound Category
+
  | Action
  | VarInt Enum
+
  | Byte
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
+
  | 0 to create/update an item. 1 to remove an item.
 
  |-
 
  |-
  | Effect Position X
+
  | Objective Name
  | Int
+
  | String (16)
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | The name of the objective the score belongs to
 
  |-
 
  |-
  | Effect Position Y
+
  | Value
  | Int
+
  | Optional VarInt
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | The score to be displayed next to the entry. Only sent when Action does not equal 1.
|-
 
| Effect Position Z
 
| Int
 
| Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
|-
 
| Volume
 
| Float
 
| 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients
 
|-
 
| Pitch
 
| Float
 
| Float between 0.5 and 2.0 by Notchian clients
 
 
 
 
  |}
 
  |}
  
==== Player List Header And Footer ====
+
==== Spawn Position ====
  
This packet may be used by custom servers to display additional information above/below the player list. It is never sent by the Notchian server.
+
Sent by the server after login to specify the coordinates of the spawn point (the point at which players spawn at, and which the compass points to). It can be sent at any time to update the point compasses point at.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,400: Line 4,387:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x4E
+
  |rowspan="1"| 0x4D
  |rowspan="2"| Play
+
  |rowspan="1"| Play
  |rowspan="2"| Client
+
  |rowspan="1"| Client
  | Header
+
  | Location
  | [[Chat]]
+
  | Position
  | To remove the header, send a empty translatable component: {"translate":""}
+
  | Spawn location
|-
 
| Footer
 
| [[Chat]]
 
| To remove the footer, send a empty translatable component: {"translate":""}
 
 
  |}
 
  |}
  
==== Collect Item ====
+
==== Time Update ====
 +
 
 +
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.
  
Sent by the server when someone picks up an item lying on the ground — its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each [[#Player Position|Player Position]] (and [[#Player Position And Look|Player Position And Look]]) packet sent by the client. The collector entity can be any entity, it does not have to be a player.
+
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"
 
{| class="wikitable"
Line 4,424: Line 4,411:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x4F
+
  |rowspan="2"| 0x4E
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Collected Entity ID
+
  | World Age
  | VarInt
+
  | Long
  |  
+
  | In ticks; not changed by server commands
  |-  
+
  |-
  | Collector Entity ID
+
  | Time of day
| VarInt
+
  | Long
|
+
  | The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
|-
 
  | Pickup Item Count
 
  | VarInt
 
| Seems to be 1 for XP orbs, otherwise the number of items in the stack.
 
 
  |}
 
  |}
  
==== Entity Teleport ====
+
==== Title ====
 
 
This packet is sent by the server when an entity moves more than 8 blocks.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,448: Line 4,429:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x50
+
  |rowspan="10"| 0x4F
  |rowspan="7"| Play
+
  |rowspan="10"| Play
  |rowspan="7"| Client
+
  |rowspan="10"| Client
  | Entity ID
+
  |colspan="2"| Action
  | VarInt
+
  | VarInt Enum
 
  |  
 
  |  
 
  |-
 
  |-
  | X
+
  ! Action
  | Double
+
  ! Field Name
  |
+
  !
 +
!
 
  |-
 
  |-
  | Y
+
  | 0: set title
  | Double
+
  | Title Text
 +
| [[Chat]]
 
  |  
 
  |  
 
  |-
 
  |-
  | Z
+
  | 1: set subtitle
  | Double
+
  | Subtitle Text
 +
| [[Chat]]
 
  |  
 
  |  
 +
|-
 +
| 2: set action bar
 +
| Action bar text
 +
| [[Chat]]
 +
| Displays a message above the hotbar (the same as position 2 in [[#Chat Message (clientbound)|Chat Message (clientbound)]], except that it correctly renders formatted chat. See [https://bugs.mojang.com/browse/MC-119145 MC-119145] for more information.)
 
  |-
 
  |-
  | Yaw
+
  |rowspan="3"| 3: set times and display
  | Angle
+
| Fade In
  | New angle, not a delta
+
| Int
 +
| Ticks to spend fading in
 +
|-
 +
| Stay
 +
| Int
 +
| Ticks to keep the title displayed
 +
|-
 +
| Fade Out
 +
  | Int
 +
  | Ticks to spend out, not when to start fading out
 
  |-
 
  |-
  | Pitch
+
  | 4: hide
  | Angle
+
  | ''no fields''
  | New angle, not a delta
+
| ''no fields''
 +
  |  
 
  |-
 
  |-
  | On Ground
+
  | 5: reset
  | Boolean
+
  | ''no fields''
 +
| ''no fields''
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Advancements ====
+
“Hide” makes the title disappear, but if you run times again the same title will appear. “Reset” erases the text.
 +
 
 +
The title is visible on screen for Fade In + Stay + Fade Out ticks.
 +
 
 +
==== Entity Sound Effect ====
 +
 
 +
Plays a sound effect from an entity.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,490: Line 4,496:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x51
+
  |rowspan="5"| 0x50
  |rowspan="9"| Play
+
  |rowspan="5"| Play
  |rowspan="9"| Client
+
  |rowspan="5"| Client
  |colspan="2"| Reset/Clear
+
  | Sound ID
  |colspan="2"| Boolean
+
  | VarInt
  | Whether to reset/clear the current advancements
+
  | ID of hardcoded sound event ([https://pokechu22.github.io/Burger/1.14.4.html#sounds events] as of 1.14.4)
 
  |-
 
  |-
  |colspan="2"| Mapping size
+
  | Sound Category
  |colspan="2"| VarInt
+
  | VarInt Enum
  | Size of the following array
+
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 
  |-
 
  |-
  |rowspan="2"| Advancement mapping
+
  | Entity ID
| Key
+
  | VarInt
|rowspan="2"| Array
+
  |
  | Identifier
 
  | The identifier of the advancement
 
 
  |-
 
  |-
  | Value
+
  | Volume
  | Advancement
+
  | Float
  | See below
+
  | 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients
 
  |-
 
  |-
  |colspan="2"| List size
+
  | Pitch
|colspan="2"| VarInt
+
  | Float
| Size of the following array
+
  | Float between 0.5 and 2.0 by Notchian clients
  |-
 
  |colspan="2"| Identifiers
 
|colspan="2"| Array of Identifier
 
| The identifiers of the advancements that should be removed
 
|-
 
|colspan="2"| Progress size
 
|colspan="2"| VarInt
 
| Size of the following array
 
|-
 
|rowspan="2"| Progress mapping
 
| Key
 
|rowspan="2"| Array
 
| Identifier
 
| The identifier of the advancement
 
|-
 
| Value
 
| Advancement progress
 
| See below
 
 
  |}
 
  |}
  
Advancement structure:
+
==== Sound Effect ====
 +
 
 +
This packet is used to play a number of hardcoded sound events. For custom sounds, use [[#Named Sound Effect|Named Sound Effect]].
 +
 
 +
{{Warning|Numeric sound effect IDs are liable to change between versions}}
  
 
{| class="wikitable"
 
{| class="wikitable"
  !colspan="2"| Field Name
+
  ! Packet ID
  !colspan="2"| Field Type
+
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |colspan="2"| Has parent
+
  |rowspan="7"| 0x51
  |colspan="2"| Boolean
+
  |rowspan="7"| Play
  | Indicates whether the next field exists.
+
  |rowspan="7"| Client
 +
| Sound ID
 +
| VarInt
 +
| ID of hardcoded sound event ([https://pokechu22.github.io/Burger/1.14.4.html#sounds events] as of 1.14.4)
 
  |-
 
  |-
  |colspan="2"| Parent id
+
  | Sound Category
  |colspan="2"| Optional Identifier
+
  | VarInt Enum
  | The identifier of the parent advancement.
+
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 
  |-
 
  |-
  |colspan="2"| Has display
+
  | Effect Position X
  |colspan="2"| Boolean
+
  | Int
  | Indicates whether the next field exists
+
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  |colspan="2"| Display data
+
  | Effect Position Y
  |colspan="2"| Optional advancement display
+
  | Int
  | See below.
+
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  |colspan="2"| Number of criteria
+
  | Effect Position Z
  |colspan="2"| VarInt
+
  | Int
  | Size of the following array
+
  | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  |rowspan="2"| Criteria
+
  | Volume
| Key
+
  | Float
|rowspan="2"| Array
+
  | 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients
  | Identifier
 
  | The identifier of the criterion
 
 
  |-
 
  |-
  | Value
+
  | Pitch
  | '''Void'''
+
  | Float
  | There is ''no'' content written here. Perhaps this will be expanded in the future?
+
  | Float between 0.5 and 2.0 by Notchian clients
  |-
+
  |}
|colspan="2"| Array length
+
 
  |colspan="2"| VarInt
+
==== Stop Sound ====
  | Number of arrays in the following array
+
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| Requirements
+
  |rowspan="3"| 0x52
  | Array length 2
+
  |rowspan="3"| Play
  |rowspan="2"| Array
+
  |rowspan="3"| Client
  | VarInt
+
| Flags
  | Number of elements in the following array
+
| Byte
 +
| Controls which fields are present.
 +
  |-
 +
| Source
 +
| Optional VarInt enum
 +
  | Only if flags is 3 or 1 (bit mask 0x1).  See below.  If not present, then sounds from all sources are cleared.
 
  |-
 
  |-
  | Requirement
+
  | Sound
  | Array of String
+
  | Optional Identifier
  | Array of required criteria
+
  | Only if flags is 2 or 3 (bit mask 0x2).  A sound effect name, see [[#Named Sound Effect|Named Sound Effect]].  If not present, then all sounds are cleared.
 
  |}
 
  |}
  
Advancement display:
+
Categories:
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Field Name
+
  ! Name !! Value
! Field Type
 
! Notes
 
 
  |-
 
  |-
  | Title
+
  | master || 0
| Chat
 
|
 
 
  |-
 
  |-
  | Description
+
  | music || 1
| Chat
 
|
 
 
  |-
 
  |-
  | Icon
+
  | record || 2
| [[Slot]]
 
|
 
 
  |-
 
  |-
  | Frame type
+
  | weather || 3
| VarInt enum
 
| 0 = <code>task</code>, 1 = <code>challenge</code>, 2 = <code>goal</code>
 
 
  |-
 
  |-
  | Flags
+
  | block || 4
| Integer
 
| 0x1: has background texture; 0x2: <code>show_toast</code>; 0x4: <code>hidden</code>
 
 
  |-
 
  |-
  | Background texture
+
  | hostile || 5
| Optional Identifier
 
| Background texture location.  Only if flags indicates it.
 
 
  |-
 
  |-
  | X coord
+
  | neutral || 6
| Float
 
|  
 
 
  |-
 
  |-
  | Y coord
+
  | player || 7
| Float
 
|  
 
|}
 
 
 
Advancement progress:
 
 
 
{| class="wikitable"
 
!colspan="2"| Field Name
 
!colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |colspan="2"| Size
+
  | ambient || 8
|colspan="2"| VarInt
 
| Size of the following array
 
 
  |-
 
  |-
  |rowspan="2"| Criteria
+
  | voice || 9
| Criterion identifier
 
|rowspan="2"| Array
 
| Identifier
 
| The identifier of the criterion.
 
|-
 
| Criterion progress
 
| Criterion progress
 
|
 
 
  |}
 
  |}
  
Criterion progress:
+
==== Player List Header And Footer ====
 +
 
 +
This packet may be used by custom servers to display additional information above/below the player list. It is never sent by the Notchian server.
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 
  ! Field Name
 
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | Achieved
+
  |rowspan="2"| 0x53
  | Boolean
+
|rowspan="2"| Play
  | If true, next field is present
+
|rowspan="2"| Client
 +
| Header
 +
  | [[Chat]]
 +
  | To remove the header, send a empty translatable component: {"translate":""}
 
  |-
 
  |-
  | Date of achieving
+
  | Footer
  | Optional Long
+
  | [[Chat]]
  | As returned by [https://docs.oracle.com/javase/6/docs/api/java/util/Date.html#getTime() <code>Date.getTime</code>]
+
  | To remove the footer, send a empty translatable component: {"translate":""}
 
  |}
 
  |}
  
==== Entity Properties ====
+
==== NBT Query Response ====
  
Sets {{Minecraft Wiki|Attribute|attributes}} on the given entity.
+
Sent in response to [[#Query Block NBT|Query Block NBT]] or [[#Query Entity NBT|Query Entity NBT]].
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,676: Line 4,654:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x52
+
  |rowspan="2"| 0x54
  |rowspan="6"| Play
+
  |rowspan="2"| Play
  |rowspan="6"| Client
+
  |rowspan="2"| Client
  |colspan="2"| Entity ID
+
  | Transaction ID
|colspan="2"| VarInt
 
|
 
|-
 
|colspan="2"| Number Of Properties
 
|colspan="2"| Int
 
| Number of elements in the following array
 
|-
 
|rowspan="4"| Property
 
| Key
 
|rowspan="4"| Array
 
| String (64)
 
| See below
 
|-
 
| Value
 
| Double
 
| See below
 
|-
 
| Number Of Modifiers
 
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array
+
  | Can be compared to the one sent in the original query packet.
 
  |-
 
  |-
  | Modifiers
+
  | NBT
  | Array of Modifier Data
+
  | [[NBT|NBT Tag]]
  | See {{Minecraft Wiki|Attribute#Modifiers}}. Modifier Data defined below.
+
  | The NBT of the block or entity. May be a TAG_END (0) in which case no NBT is present.
 
  |}
 
  |}
  
Known Key values (see also {{Minecraft Wiki|Attribute#Modifiers}}):
+
==== Collect Item ====
 +
 
 +
Sent by the server when someone picks up an item lying on the ground — its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each [[#Player Position|Player Position]] (and [[#Player Position And Look|Player Position And Look]]) packet sent by the client. The collector entity can be any entity; it does not have to be a player. The collected entity also can be any entity, but the Notchian server only uses this for items, experience orbs, and the different varieties of arrows.
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Key
+
|rowspan="3"| 0x55
  ! Default
+
|rowspan="3"| Play
  ! Min
+
|rowspan="3"| Client
  ! Max
+
| Collected Entity ID
  ! Label
+
| VarInt
 +
|
 +
|-
 +
| Collector Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| Pickup Item Count
 +
| VarInt
 +
| Seems to be 1 for XP orbs, otherwise the number of items in the stack.
 +
|}
 +
 
 +
==== Entity Teleport ====
 +
 
 +
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
 
  |-
 
  |-
  | generic.maxHealth
+
  |rowspan="7"| 0x56
  | 20.0
+
|rowspan="7"| Play
  | 0.0
+
  |rowspan="7"| Client
  | 1024.0
+
  | Entity ID
  | Max Health
+
  | VarInt
 +
  |  
 
  |-
 
  |-
  | generic.followRange
+
  | X
  | 32.0
+
  | Double
  | 0.0
+
  |  
| 2048.0
 
| Follow Range
 
 
  |-
 
  |-
  | generic.knockbackResistance
+
  | Y
  | 0.0
+
  | Double
  | 0.0
+
  |  
| 1.0
 
| Knockback Resistance
 
 
  |-
 
  |-
  | generic.movementSpeed
+
  | Z
  | 0.699999988079071
+
  | Double
  | 0.0
+
  |  
| 1024.0
 
| Movement Speed
 
 
  |-
 
  |-
  | generic.attackDamage
+
  | Yaw
  | 2.0
+
  | Angle
  | 0.0
+
  | New angle, not a delta
| 2048.0
 
| Attack Damage
 
 
  |-
 
  |-
  | generic.attackSpeed
+
  | Pitch
  | 4.0
+
  | Angle
  | 0.0
+
  | New angle, not a delta
| 1024.0
 
| Attack Speed
 
 
  |-
 
  |-
  | generic.flyingSpeed
+
  | On Ground
  | 0.4000000059604645
+
  | Boolean
  | 0.0
+
  |  
  | 1024.0
+
  |}
  | Flying Speed
+
 
 +
==== Advancements ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
  !colspan="2"| Field Type
 +
! Notes
 
  |-
 
  |-
  | horse.jumpStrength
+
  |rowspan="9"| 0x57
  | 0.7
+
  |rowspan="9"| Play
  | 0.0
+
  |rowspan="9"| Client
  | 2.0
+
  |colspan="2"| Reset/Clear
  | Jump Strength
+
|colspan="2"| Boolean
 +
  | Whether to reset/clear the current advancements
 
  |-
 
  |-
  | zombie.spawnReinforcements
+
  |colspan="2"| Mapping size
| 0.0
+
  |colspan="2"| VarInt
  | 0.0
+
  | Size of the following array
| 1.0
 
  | Spawn Reinforcements Chance
 
 
  |-
 
  |-
  | generic.reachDistance
+
  |rowspan="2"| Advancement mapping
  | 5.0
+
  | Key
  | 0.0
+
  |rowspan="2"| Array
  | 1024.0
+
  | Identifier
  | Player Reach Distance (Forge only)
+
  | The identifier of the advancement
 
  |-
 
  |-
  | forge.swimSpeed
+
  | Value
  | 1.0
+
  | Advancement
  | 0.0
+
  | See below
| 1024.0
 
| Swimming Speed (Forge only)
 
|}
 
 
 
''Modifier Data'' structure:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Field Name
+
  |colspan="2"| List size
  ! Field Type
+
  |colspan="2"| VarInt
  ! Notes
+
  | Size of the following array
 
  |-
 
  |-
  | UUID
+
  |colspan="2"| Identifiers
  | UUID
+
  |colspan="2"| Array of Identifier
  |  
+
  | The identifiers of the advancements that should be removed
 
  |-
 
  |-
  | Amount
+
  |colspan="2"| Progress size
  | Double
+
|colspan="2"| VarInt
  | May be positive or negative
+
| Size of the following array
 +
|-
 +
|rowspan="2"| Progress mapping
 +
| Key
 +
|rowspan="2"| Array
 +
  | Identifier
 +
  | The identifier of the advancement
 
  |-
 
  |-
  | Operation
+
  | Value
  | Byte
+
  | Advancement progress
 
  | See below
 
  | See below
 
  |}
 
  |}
  
The operation controls how the base value of the modifier is changed.
+
Advancement structure:
 
 
* 0: Add/subtract amount
 
* 1: Add/subtract amount percent of the current value
 
* 2: Multiply by amount percent
 
 
 
All of the 0's are applied first, and then the 1's, and then the 2's.
 
 
 
==== Entity Effect ====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  !colspan="2"| Field Name
! State
+
  !colspan="2"| Field Type
! Bound To
 
! Field Name
 
  ! Field Type
 
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x53
+
  |colspan="2"| Has parent
  |rowspan="5"| Play
+
  |colspan="2"| Boolean
|rowspan="5"| Client
+
  | Indicates whether the next field exists.
| Entity ID
 
| VarInt
 
  |  
 
 
  |-
 
  |-
  | Effect ID
+
  |colspan="2"| Parent id
  | Byte
+
  |colspan="2"| Optional Identifier
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | The identifier of the parent advancement.
 
  |-
 
  |-
  | Amplifier
+
  |colspan="2"| Has display
  | Byte
+
  |colspan="2"| Boolean
  | Notchian client displays effect level as Amplifier + 1
+
  | Indicates whether the next field exists
 
  |-
 
  |-
  | Duration
+
  |colspan="2"| Display data
 +
|colspan="2"| Optional advancement display
 +
| See below.
 +
|-
 +
|colspan="2"| Number of criteria
 +
|colspan="2"| VarInt
 +
| Size of the following array
 +
|-
 +
|rowspan="2"| Criteria
 +
| Key
 +
|rowspan="2"| Array
 +
| Identifier
 +
| The identifier of the criterion
 +
|-
 +
| Value
 +
| '''Void'''
 +
| There is ''no'' content written here.  Perhaps this will be expanded in the future?
 +
|-
 +
|colspan="2"| Array length
 +
|colspan="2"| VarInt
 +
| Number of arrays in the following array
 +
|-
 +
|rowspan="2"| Requirements
 +
| Array length 2
 +
|rowspan="2"| Array
 
  | VarInt
 
  | VarInt
  | Seconds
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Flags
+
  | Requirement
  | Byte
+
  | Array of String
  | Bit field, see below.
+
  | Array of required criteria
 
  |}
 
  |}
  
Within flags:
+
Advancement display:
 
 
* 0x01: Is ambient - was the effect spawned from a beacon?  All beacon-generated effects are ambient.  Ambient effects use a different icon in the HUD (blue border rather than gray).  If all effects on an entity are ambient, the [[Entities#Living|"Is potion effect ambient" living metadata field]] should be set to true.  Usually should not be enabled.
 
* 0x02: Show particles - should all particles from this effect be hidden?  Effects with particles hidden are not included in the calculation of the effect color, and are not rendered on the HUD (but are still rendered within the inventory).  Usually should be enabled.
 
 
 
==== Declare Recipes ====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Field Name
! State
+
  ! Field Type
! Bound To
 
!colspan="2"| Field Name
 
  !colspan="2"| Field Type
 
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x54
+
  | Title
  |rowspan="4"| Play
+
| Chat
  |rowspan="4"| Client
+
  |
  |colspan="2"| Num Recipes
+
  |-
  |colspan="2"| VarInt
+
  | Description
  | Number of elements in the following array
+
  | Chat
 +
  |
 
  |-
 
  |-
  |rowspan="3"| Recipe
+
  | Icon
| Recipe ID
+
  | [[Slot]]
|rowspan="3"| Array
 
  | Identifier
 
 
  |
 
  |
 
  |-
 
  |-
  | Type
+
  | Frame type
  | String
+
  | VarInt enum
  | The recipe type, see below
+
  | 0 = <code>task</code>, 1 = <code>challenge</code>, 2 = <code>goal</code>
 +
|-
 +
| Flags
 +
| Integer
 +
| 0x1: has background texture; 0x2: <code>show_toast</code>; 0x4: <code>hidden</code>
 +
|-
 +
| Background texture
 +
| Optional Identifier
 +
| Background texture location.  Only if flags indicates it.
 +
|-
 +
| X coord
 +
| Float
 +
|
 
  |-
 
  |-
  | Data
+
  | Y coord
  | Optional, varies
+
  | Float
  | Additional data for the recipe.  For some types, there will be no data.
+
  |  
 
  |}
 
  |}
  
Recipe types:
+
Advancement progress:
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Type
+
  !colspan="2"| Field Name
  ! Description
+
!colspan="2"| Field Type
  ! Data
+
  ! Notes
 +
|-
 +
|colspan="2"| Size
 +
  |colspan="2"| VarInt
 +
| Size of the following array
 
  |-
 
  |-
  | <code>crafting_shapeless</code>
+
  |rowspan="2"| Criteria
  | Shapeless crafting recipe.  All items in the ingredient list must be present, but in any order/slot.
+
  | Criterion identifier
  | As follows:
+
  |rowspan="2"| Array
  {| class="wikitable"
+
| Identifier
    ! Name
+
| The identifier of the criterion.
    ! Type
+
  |-
    ! Description
+
| Criterion progress
    |-
+
| Criterion progress
    | Group
+
|
    | String
+
|}
    | Used to group similar recipes together in the recipe bookTag is present in recipe JSON.
+
 
    |-
+
Criterion progress:
    | Ingredient count
+
 
    | VarInt
+
{| class="wikitable"
    | Number of elements in the following array
+
! Field Name
    |-
+
! Field Type
    | Ingredients
+
! Notes
    | Array of Ingredient
 
    |
 
    |-
 
    | Result
 
    | [[Slot]]
 
    |
 
    |}
 
 
  |-
 
  |-
  | <code>crafting_shaped</code>
+
  | Achieved
  | Shaped crafting recipe.  All items must be present in the same pattern (which may be flipped horizontally or translated)
+
  | Boolean
  | As follows:
+
  | If true, next field is present
  {| class="wikitable"
 
    ! Name
 
    ! Type
 
    ! Description
 
    |-
 
    | Width
 
    | VarInt
 
    |
 
    |-
 
    | Height
 
    | VarInt
 
    |
 
    |-
 
    | Group
 
    | String
 
    | Used to group similar recipes together in the recipe book.  Tag is present in recipe JSON.
 
    |-
 
    | Ingredients
 
    | Array of Ingredient
 
    | Length is width * height.  Indexed by x + (y * width).
 
    |-
 
    | Result
 
    | [[Slot]]
 
    |
 
    |}
 
 
  |-
 
  |-
  | <code>crafting_special_armordye</code>
+
  | Date of achieving
  | Recipe for dying leather armor
+
| Optional Long
  | None
+
| As returned by [https://docs.oracle.com/javase/6/docs/api/java/util/Date.html#getTime() <code>Date.getTime</code>]
 +
  |}
 +
 
 +
==== Entity Properties ====
 +
 
 +
Sets {{Minecraft Wiki|Attribute|attributes}} on the given entity.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>crafting_special_bookcloning</code>
+
  |rowspan="6"| 0x58
  | Recipe for copying contents of written books
+
|rowspan="6"| Play
  | None
+
|rowspan="6"| Client
 +
  |colspan="2"| Entity ID
 +
|colspan="2"| VarInt
 +
  |  
 
  |-
 
  |-
  | <code>crafting_special_mapcloning</code>
+
  |colspan="2"| Number Of Properties
  | Recipe for copying maps
+
  |colspan="2"| Int
  | None
+
  | Number of elements in the following array
 
  |-
 
  |-
  | <code>crafting_special_mapextending</code>
+
  |rowspan="4"| Property
  | Recipe for adding paper to maps
+
| Key
  | None
+
|rowspan="4"| Array
 +
  | String (64)
 +
  | See below
 
  |-
 
  |-
  | <code>crafting_special_firework_rocket</code>
+
  | Value
  | Recipe for making firework rockets
+
  | Double
  | None
+
  | See below
 
  |-
 
  |-
  | <code>crafting_special_firework_star</code>
+
  | Number Of Modifiers
  | Recipe for making firework stars
+
  | VarInt
  | None
+
  | Number of elements in the following array
 
  |-
 
  |-
  | <code>crafting_special_firework_star_fade</code>
+
  | Modifiers
  | Recipe for making firework stars fade between multiple colors
+
  | Array of Modifier Data
  | None
+
  | See {{Minecraft Wiki|Attribute#Modifiers}}. Modifier Data defined below.
 +
|}
 +
 
 +
Known Key values (see also {{Minecraft Wiki|Attribute#Modifiers}}):
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  | <code>crafting_special_repairitem</code>
+
  ! Key
  | Recipe for repairing items via crafting
+
  ! Default
  | None
+
  ! Min
 +
! Max
 +
! Label
 
  |-
 
  |-
  | <code>crafting_special_tippedarrow</code>
+
  | generic.maxHealth
  | Recipe for crafting tipped arrows
+
  | 20.0
  | None
+
  | 0.0
 +
| 1024.0
 +
| Max Health
 
  |-
 
  |-
  | <code>crafting_special_bannerduplicate</code>
+
  | generic.followRange
  | Recipe for copying banner patterns
+
  | 32.0
  | None
+
  | 0.0
 +
| 2048.0
 +
| Follow Range
 +
|-
 +
| generic.knockbackResistance
 +
| 0.0
 +
| 0.0
 +
| 1.0
 +
| Knockback Resistance
 +
|-
 +
| generic.movementSpeed
 +
| 0.699999988079071
 +
| 0.0
 +
| 1024.0
 +
| Movement Speed
 
  |-
 
  |-
  | <code>crafting_special_banneraddpattern</code>
+
  | generic.attackDamage
  | Recipe for adding patterns to banners
+
  | 2.0
  | None
+
  | 0.0
 +
| 2048.0
 +
| Attack Damage
 
  |-
 
  |-
  | <code>crafting_special_shielddecoration</code>
+
  | generic.attackSpeed
  | Recipe for applying a banner's pattern to a shield
+
  | 4.0
  | None
+
  | 0.0
 +
| 1024.0
 +
| Attack Speed
 
  |-
 
  |-
  | <code>crafting_special_shulkerboxcoloring</code>
+
  | generic.flyingSpeed
  | Recipe for recoloring a shulker box
+
  | 0.4000000059604645
  | None
+
  | 0.0
 +
| 1024.0
 +
| Flying Speed
 
  |-
 
  |-
  | <code>smelting</code>
+
  | horse.jumpStrength
  | Smelting recipe
+
  | 0.7
  | As follows:
+
  | 0.0
  {| class="wikitable"
+
| 2.0
    ! Name
+
| Jump Strength
    ! Type
+
|-
    ! Description
+
| zombie.spawnReinforcements
    |-
+
| 0.0
    | Group
+
| 0.0
    | String
+
| 1.0
    | Used to group similar recipes together in the recipe book.
+
| Spawn Reinforcements Chance
    |-
+
|-
    | Ingredient
+
| generic.reachDistance
    | Ingredient
+
| 5.0
    |
+
| 0.0
    |-
+
| 1024.0
    | Result
+
| Player Reach Distance (Forge only)
    | [[Slot]]
+
|-
    |
+
| forge.swimSpeed
    |-
+
| 1.0
    | Experience
+
| 0.0
    | Float
+
| 1024.0
    |
+
| Swimming Speed (Forge only)
    |-
 
    | Cooking time
 
    | VarInt
 
    |
 
    |}
 
 
  |}
 
  |}
  
Ingredient is defined as:
+
''Modifier Data'' structure:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Name
 
! Type
 
! Description
 
 
  |-
 
  |-
  | Count
+
  ! Field Name
  | VarInt
+
  ! Field Type
  | Number of elements in the following array
+
  ! Notes
 
  |-
 
  |-
  | Items
+
  | UUID
  | Array of [[Slot]]
+
  | UUID
  | Any item in this array may be used for the recipe. The count of each item should be 1.
+
|
|}
+
|-
 +
| Amount
 +
| Double
 +
  | May be positive or negative
 +
|-
 +
| Operation
 +
| Byte
 +
| See below
 +
  |}
 +
 
 +
The operation controls how the base value of the modifier is changed.
 +
 
 +
* 0: Add/subtract amount
 +
* 1: Add/subtract amount percent of the current value
 +
* 2: Multiply by amount percent
  
==== Tags ====
+
All of the 0's are applied first, and then the 1's, and then the 2's.
 +
 
 +
==== Entity Effect ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,056: Line 5,084:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x55
+
  |rowspan="5"| 0x59
  |rowspan="3"| Play
+
  |rowspan="5"| Play
  |rowspan="3"| Client
+
  |rowspan="5"| Client
  | Block Tags
+
  | Entity ID
  | (See below)
+
| VarInt
  | IDs are block IDs
+
|
 +
|-
 +
| Effect ID
 +
| Byte
 +
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
 +
|-
 +
| Amplifier
 +
| Byte
 +
  | Notchian client displays effect level as Amplifier + 1
 
  |-
 
  |-
  | Item Tags
+
  | Duration
  | (See below)
+
  | VarInt
  | IDs are item IDs
+
  | Seconds
 
  |-
 
  |-
  | Fluid Tags
+
  | Flags
  | (See below)
+
  | Byte
  | IDs are fluid IDs
+
  | Bit field, see below.
 
  |}
 
  |}
  
Tags look like:
+
Within flags:
 +
 
 +
* 0x01: Is ambient - was the effect spawned from a beacon?  All beacon-generated effects are ambient.  Ambient effects use a different icon in the HUD (blue border rather than gray).  If all effects on an entity are ambient, the [[Entities#Living|"Is potion effect ambient" living metadata field]] should be set to true.  Usually should not be enabled.
 +
* 0x02: Show particles - should all particles from this effect be hidden?  Effects with particles hidden are not included in the calculation of the effect color, and are not rendered on the HUD (but are still rendered within the inventory).  Usually should be enabled.
 +
 
 +
==== Declare Recipes ====
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 
  !colspan="2"| Field Name
 
  !colspan="2"| Field Name
 
  !colspan="2"| Field Type
 
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |colspan="2"| Length
+
|rowspan="4"| 0x5A
 +
|rowspan="4"| Play
 +
|rowspan="4"| Client
 +
  |colspan="2"| Num Recipes
 
  |colspan="2"| VarInt
 
  |colspan="2"| VarInt
 
  | Number of elements in the following array
 
  | Number of elements in the following array
 
  |-
 
  |-
  |rowspan="3"| Tags
+
  |rowspan="3"| Recipe
  | Tag name
+
  | Recipe ID
 
  |rowspan="3"| Array
 
  |rowspan="3"| Array
 
  | Identifier
 
  | Identifier
 
  |
 
  |
 
  |-
 
  |-
  | Count
+
  | Type
  | VarInt
+
  | String
  | Number of elements in the following array
+
  | The recipe type, see below
 
  |-
 
  |-
  | Entries
+
  | Data
  | Array of VarInt
+
  | Optional, varies
  | Numeric ID of the block/item.
+
  | Additional data for the recipe.  For some types, there will be no data.
 
  |}
 
  |}
  
=== Serverbound ===
+
Recipe types:
 
 
==== Teleport Confirm ====
 
 
 
Sent by client as confirmation of [[#Player Position And Look (clientbound)|Player Position And Look]].
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Type
! State
+
  ! Description
  ! Bound To
+
  ! Data
! Field Name
 
! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  | 0x00
+
  | <code>crafting_shapeless</code>
  | Play
+
  | Shapeless crafting recipe.  All items in the ingredient list must be present, but in any order/slot.
  | Server
+
  | As follows:
| Teleport ID
+
  {| class="wikitable"
| VarInt
+
    ! Name
| The ID given by the [[#Player Position And Look (clientbound)|Player Position And Look]] packet
+
    ! Type
  |}
+
    ! Description
 
+
    |-
==== Query Block NBT ====
+
    | Group
 
+
    | String
Used when <kbd>Shift</kbd>+<kbd>F3</kbd>+<kbd>I</kbd> is pressed while looking at a block.
+
    | Used to group similar recipes together in the recipe book. Tag is present in recipe JSON.
 
+
    |-
{| class="wikitable"
+
    | Ingredient count
! Packet ID
+
    | VarInt
! State
+
    | Number of elements in the following array
! Bound To
+
    |-
! Field Name
+
    | Ingredients
! Field Type
+
    | Array of Ingredient
! Notes
+
    |
 +
    |-
 +
    | Result
 +
    | [[Slot]]
 +
    |
 +
    |}
 
  |-
 
  |-
  |rowspan="2"| 0x01
+
  | <code>crafting_shaped</code>
  |rowspan="2"| Play
+
| Shaped crafting recipe.  All items must be present in the same pattern (which may be flipped horizontally or translated)
|rowspan="2"| Server
+
  | As follows:
| Transaction ID
+
  {| class="wikitable"
| VarInt
+
    ! Name
| An incremental ID so that the client can verify that the response matches.
+
    ! Type
|-
+
    ! Description
| Location
+
    |-
| Position
+
    | Width
| The location of the block to check.
+
    | VarInt
|}
+
    |
 
+
    |-
==== Chat Message (serverbound) ====
+
    | Height
 
+
    | VarInt
Used to send a chat message to the serverThe message may not be longer than 256 characters or else the server will kick the client.
+
    |
 
+
    |-
If the message starts with a <code>/</code>, the server will attempt to interpret it as a commandOtherwise, the server will broadcast the same chat message to all players on the server (including the player that sent the message), prepended with player's name. Specifically, it will respond with a translate [[chat]] component, "<code>chat.type.text</code>" with the first parameter set to the display name of the player (including some chat component logic to support clicking the name to send a PM) and the second parameter set to the message. See [[Chat#Processing chat|processing chat]] for more information.
+
    | Group
 
+
    | String
{| class="wikitable"
+
    | Used to group similar recipes together in the recipe bookTag is present in recipe JSON.
  ! Packet ID
+
    |-
  ! State
+
    | Ingredients
  ! Bound To
+
    | Array of Ingredient
  ! Field Name
+
    | Length is width * heightIndexed by x + (y * width).
! Field Type
+
    |-
! Notes
+
    | Result
 +
    | [[Slot]]
 +
    |
 +
    |}
 +
|-
 +
| <code>crafting_special_armordye</code>
 +
  | Recipe for dying leather armor
 +
| None
 +
  |-
 +
  | <code>crafting_special_bookcloning</code>
 +
  | Recipe for copying contents of written books
 +
  | None
 
  |-
 
  |-
  |rowspan="1"| 0x02
+
  | <code>crafting_special_mapcloning</code>
  |rowspan="1"| Play
+
  | Recipe for copying maps
  |rowspan="1"| Server
+
  | None
  | Message
+
  |-
  | String (256)
+
  | <code>crafting_special_mapextending</code>
  | The client sends the raw input, not a [[Chat]] component
+
  | Recipe for adding paper to maps
  |}
+
  | None
 
 
==== Client Status ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x03
+
  | <code>crafting_special_firework_rocket</code>
|rowspan="1"| Play
+
  | Recipe for making firework rockets
|rowspan="1"| Server
+
  | None
| Action ID
 
| VarInt Enum
 
  | See below
 
  |}
 
 
 
''Action ID'' values:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Action ID
+
  | <code>crafting_special_firework_star</code>
  ! Action
+
  | Recipe for making firework stars
  ! Notes
+
  | None
 
  |-
 
  |-
  | 0
+
  | <code>crafting_special_firework_star_fade</code>
  | Perform respawn
+
  | Recipe for making firework stars fade between multiple colors
  | Sent when the client is ready to complete login and when the client is ready to respawn after death.
+
  | None
 
  |-
 
  |-
  | 1
+
  | <code>crafting_special_repairitem</code>
  | Request stats
+
  | Recipe for repairing items via crafting
  | Sent when the client opens the Statistics menu
+
  | None
|}
 
 
 
==== Client Settings ====
 
 
 
Sent when the player connects, or when settings are changed.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x04
+
  | <code>crafting_special_tippedarrow</code>
|rowspan="6"| Play
+
  | Recipe for crafting tipped arrows
|rowspan="6"| Server
+
  | None
| Locale
 
  | String (16)
 
  | e.g. en_GB
 
 
  |-
 
  |-
  | View Distance
+
  | <code>crafting_special_bannerduplicate</code>
  | Byte
+
  | Recipe for copying banner patterns
  | Client-side render distance, in chunks
+
  | None
 
  |-
 
  |-
  | Chat Mode
+
  | <code>crafting_special_banneraddpattern</code>
  | VarInt Enum
+
  | Recipe for adding patterns to banners
  | 0: enabled, 1: commands only, 2: hidden.  See [[Chat#Processing chat|processing chat]] for more information.
+
  | None
 
  |-
 
  |-
  | Chat Colors
+
  | <code>crafting_special_shielddecoration</code>
  | Boolean
+
  | Recipe for applying a banner's pattern to a shield
  | “Colors” multiplayer setting
+
  | None
 
  |-
 
  |-
  | Displayed Skin Parts
+
  | <code>crafting_special_shulkerboxcoloring</code>
  | Unsigned Byte
+
  | Recipe for recoloring a shulker box
  | Bit mask, see below
+
  | None
 
  |-
 
  |-
  | Main Hand
+
  | <code>smelting</code>
  | VarInt Enum
+
  | Smelting recipe
  | 0: Left, 1: Right
+
  | As follows:
  |}
+
  {| class="wikitable"
 
+
    ! Name
''Displayed Skin Parts'' flags:
+
    ! Type
 +
    ! Description
 +
    |-
 +
    | Group
 +
    | String
 +
    | Used to group similar recipes together in the recipe book.
 +
    |-
 +
    | Ingredient
 +
    | Ingredient
 +
    |
 +
    |-
 +
    | Result
 +
    | [[Slot]]
 +
    |
 +
    |-
 +
    | Experience
 +
    | Float
 +
    |
 +
    |-
 +
    | Cooking time
 +
    | VarInt
 +
    |
 +
    |}
 +
  |}
  
* Bit 0 (0x01): Cape enabled
+
Ingredient is defined as:
* Bit 1 (0x02): Jacket enabled
 
* Bit 2 (0x04): Left Sleeve enabled
 
* Bit 3 (0x08): Right Sleeve enabled
 
* Bit 4 (0x10): Left Pants Leg enabled
 
* Bit 5 (0x20): Right Pants Leg enabled
 
* Bit 6 (0x40): Hat enabled
 
  
The most significant bit (bit 7, 0x80) appears to be unused.
+
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Count
 +
| VarInt
 +
| Number of elements in the following array
 +
|-
 +
| Items
 +
| Array of [[Slot]]
 +
| Any item in this array may be used for the recipe.  The count of each item should be 1.
 +
|}
  
==== Tab-Complete (serverbound) ====
+
==== Tags ====
 
 
Sent when the client needs to tab-complete a <code>minecraft:ask_server</code> suggestion type.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,265: Line 5,314:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x05
+
  |rowspan="4"| 0x5B
  |rowspan="5"| Play
+
  |rowspan="4"| Play
  |rowspan="5"| Server
+
  |rowspan="4"| Client
  | Transaction Id
+
  | Block Tags
 +
| (See below)
 +
| IDs are block IDs
 +
|-
 +
| Item Tags
 +
| (See below)
 +
| IDs are item IDs
 +
|-
 +
| Fluid Tags
 +
| (See below)
 +
| IDs are fluid IDs
 +
|-
 +
| Entity Tags
 +
| (See below)
 +
| IDs are entity IDs
 +
|}
 +
 
 +
Tags look like:
 +
 
 +
{| class="wikitable"
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 +
|-
 +
|colspan="2"| Length
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array
 +
|-
 +
|rowspan="3"| Tags
 +
| Tag name
 +
|rowspan="3"| Array
 +
| Identifier
 +
|
 +
|-
 +
| Count
 
  | VarInt
 
  | VarInt
  | The id received in the tab completion request packet, must match or the client will ignore this packet.  Client generates this and increments it each time it sends another tab completion that doesn't get a response.
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Text
+
  | Entries
  | String (32500)
+
  | Array of VarInt
  | All text behind the cursor without the <code>/</code> (e.g. to the left of the cursor in left-to-right languages like English)
+
  | Numeric ID of the block/item.
 
  |}
 
  |}
  
==== Confirm Transaction (serverbound) ====
+
==== Acknowledge Player Digging ====
 
 
If a transaction sent by the client was not accepted, the server will reply with a [[#Confirm Transaction (clientbound)|Confirm Transaction (clientbound)]] packet with the Accepted field set to false. When this happens, the client must send this packet to apologize (as with movement), otherwise the server ignores any successive transactions.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,289: Line 5,370:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x06
+
  |rowspan="4"| 0x5C
  |rowspan="3"| Play
+
  |rowspan="4"| Play
  |rowspan="3"| Server
+
  |rowspan="4"| Client
  | Window ID
+
  | Location
  | Byte
+
| Position
  | The ID of the window that the action occurred in
+
| Position where the digging was happening
 +
|-
 +
| Block
 +
  | VarInt
 +
  | Block state ID of the block that should be at that position now.
 
  |-
 
  |-
  | Action Number
+
  | Status
  | Short
+
  | VarInt enum
  | Every action that is to be accepted has a unique number. This number is an incrementing integer (starting at 1) with separate counts for each window ID.
+
  | Same as Player Digging. Only Started digging (0), Cancelled digging (1), and Finished digging (2) are used.
 
  |-
 
  |-
  | Accepted
+
  | Successful
 
  | Boolean
 
  | Boolean
  | Whether the action was accepted
+
  | True if the digging succeeded; false if the client should undo any changes it made locally.  (How does this work?)
 +
|}
 +
 
 +
=== Serverbound ===
 +
 
 +
==== Teleport Confirm ====
 +
 
 +
Sent by client as confirmation of [[#Player Position And Look (clientbound)|Player Position And Look]].
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| 0x00
 +
| Play
 +
| Server
 +
| Teleport ID
 +
| VarInt
 +
| The ID given by the [[#Player Position And Look (clientbound)|Player Position And Look]] packet
 
  |}
 
  |}
  
==== Enchant Item ====
+
==== Query Block NBT ====
 +
 
 +
Used when <kbd>Shift</kbd>+<kbd>F3</kbd>+<kbd>I</kbd> is pressed while looking at a block.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,315: Line 5,424:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x07
+
  |rowspan="2"| 0x01
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Server
 
  |rowspan="2"| Server
  | Window ID
+
  | Transaction ID
  | Byte
+
  | VarInt
  | The ID of the enchantment table window sent by [[#Open Window|Open Window]]
+
  | An incremental ID so that the client can verify that the response matches.
 
  |-
 
  |-
  | Enchantment
+
  | Location
  | Byte
+
  | Position
  | The position of the enchantment on the enchantment table window, starting with 0 as the topmost one
+
  | The location of the block to check.
 
  |}
 
  |}
  
==== Click Window ====
+
==== Set Difficulty ====
  
This packet is sent by the player when it clicks on a slot in a window.
+
Must have at least op level 2 to use.  Appears to only be used on singleplayer; the difficulty buttons are still disabled in multiplayer.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,339: Line 5,448:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x08
+
  |rowspan="1"| 0x02
  |rowspan="6"| Play
+
  |rowspan="1"| Play
  |rowspan="6"| Server
+
  |rowspan="1"| Server
  | Window ID
+
  | New difficulty
| Unsigned Byte
 
| The ID of the window which was clicked. 0 for player inventory.
 
|-
 
| Slot
 
| Short
 
| The clicked slot number, see below
 
|-
 
| Button
 
 
  | Byte
 
  | Byte
  | The button used in the click, see below
+
  | 0: peaceful, 1: easy, 2: normal, 3: hard
|-
 
| Action Number
 
| Short
 
| A unique number for the action, implemented by Notchian as a counter, starting at 1 (different counter for every window ID). Used by the server to send back a [[#Confirm Transaction (clientbound)|Confirm Transaction (clientbound)]].
 
|-
 
| Mode
 
| VarInt Enum
 
| Inventory operation mode, see below
 
|-
 
| Clicked item
 
| [[Slot Data|Slot]]
 
| The clicked slot. Has to be empty (item ID = -1) for drop mode.
 
 
  |}
 
  |}
  
See [[Inventory]] for further information about how slots are indexed.
+
==== Chat Message (serverbound) ====
  
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.
+
Used to send a chat message to the server.  The message may not be longer than 256 characters or else the server will kick the client.
  
The distinct type of click performed by the client is determined by the combination of the Mode and Button fields.
+
If the message starts with a <code>/</code>, the server will attempt to interpret it as a command.  Otherwise, the server will broadcast the same chat message to all players on the server (including the player that sent the message), prepended with player's name.  Specifically, it will respond with a translate [[chat]] component, "<code>chat.type.text</code>" with the first parameter set to the display name of the player (including some chat component logic to support clicking the name to send a PM) and the second parameter set to the message.  See [[Chat#Processing chat|processing chat]] for more information.
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Mode
+
  ! Packet ID
  ! Button
+
  ! State
  ! Slot
+
  ! Bound To
  ! Trigger
+
  ! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  !rowspan="2"| 0
+
  |rowspan="1"| 0x03
  | 0
+
|rowspan="1"| Play
  | Normal
+
|rowspan="1"| Server
  | Left mouse click
+
| Message
 +
  | String (256)
 +
  | The client sends the raw input, not a [[Chat]] component
 +
  |}
 +
 
 +
==== Client Status ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1
+
  |rowspan="1"| 0x04
  | Normal
+
|rowspan="1"| Play
  | Right mouse click
+
|rowspan="1"| Server
 +
| Action ID
 +
  | VarInt Enum
 +
  | See below
 +
|}
 +
 
 +
''Action ID'' values:
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  !rowspan="2"| 1
+
  ! Action ID
  | 0
+
  ! Action
  | Normal
+
  ! Notes
| Shift + left mouse click
 
 
  |-
 
  |-
| 1
 
| Normal
 
| Shift + right mouse click ''(identical behavior)''
 
|-
 
!rowspan="5"| 2
 
 
  | 0
 
  | 0
  | Normal
+
  | Perform respawn
  | Number key 1
+
  | Sent when the client is ready to complete login and when the client is ready to respawn after death.
 
  |-
 
  |-
 
  | 1
 
  | 1
  | Normal
+
  | Request stats
  | Number key 2
+
  | Sent when the client opens the Statistics menu
  |-
+
  |}
  | 2
+
 
  | Normal
+
==== Client Settings ====
  | Number key 3
+
 
 +
Sent when the player connects, or when settings are changed.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  |
+
  |rowspan="6"| 0x05
  |
+
|rowspan="6"| Play
  |
+
|rowspan="6"| Server
 +
| Locale
 +
  | String (16)
 +
  | e.g. en_GB
 
  |-
 
  |-
  | 8
+
  | View Distance
  | Normal
+
  | Byte
  | Number key 9
+
  | Client-side render distance, in chunks
 
  |-
 
  |-
  !rowspan="1"| 3
+
  | Chat Mode
  | 2
+
  | VarInt Enum
  | Normal
+
  | 0: enabled, 1: commands only, 2: hidden. See [[Chat#Processing chat|processing chat]] for more information.
  | Middle click, only defined for creative players in non-player inventories.
 
 
  |-
 
  |-
  !rowspan="4"| 4
+
  | Chat Colors
  | 0
+
  | Boolean
  | Normal*
+
  | “Colors” multiplayer setting
| Drop key (Q) (* Clicked item is different, see above)
 
 
  |-
 
  |-
  | 1
+
  | Displayed Skin Parts
  | Normal*
+
  | Unsigned Byte
  | Ctrl + Drop key (Ctrl-Q) ''(drops full stack)''
+
  | Bit mask, see below
 
  |-
 
  |-
  | 0
+
  | Main Hand
  | -999
+
  | VarInt Enum
  | Left click outside inventory holding nothing ''(no-op)''
+
  | 0: Left, 1: Right
  |-
+
|}
  | 1
+
 
  | -999
+
''Displayed Skin Parts'' flags:
  | Right click outside inventory holding nothing ''(no-op)''
+
 
 +
* Bit 0 (0x01): Cape enabled
 +
* Bit 1 (0x02): Jacket enabled
 +
* Bit 2 (0x04): Left Sleeve enabled
 +
* Bit 3 (0x08): Right Sleeve enabled
 +
* Bit 4 (0x10): Left Pants Leg enabled
 +
* Bit 5 (0x20): Right Pants Leg enabled
 +
* Bit 6 (0x40): Hat enabled
 +
 
 +
The most significant bit (bit 7, 0x80) appears to be unused.
 +
 
 +
==== Tab-Complete (serverbound) ====
 +
 
 +
Sent when the client needs to tab-complete a <code>minecraft:ask_server</code> suggestion type.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  !rowspan="9"| 5
+
  |rowspan="5"| 0x06
  | 0
+
|rowspan="5"| Play
  | -999
+
|rowspan="5"| Server
  | Starting left mouse drag
+
  | Transaction Id
 +
  | VarInt
 +
  | The id received in the tab completion request packet, must match or the client will ignore this packet.  Client generates this and increments it each time it sends another tab completion that doesn't get a response.
 
  |-
 
  |-
  | 4
+
  | Text
  | -999
+
  | String (32500)
  | Starting right mouse drag
+
  | All text behind the cursor without the <code>/</code> (e.g. to the left of the cursor in left-to-right languages like English)
|-
+
  |}
| 8
+
 
| -999
+
==== Confirm Transaction (serverbound) ====
| Starting middle mouse drag, only defined for creative players in non-player inventories.  (Note: the vanilla client will still incorrectly send this for non-creative players - see [https://bugs.mojang.com/browse/MC-46584 MC-46584])
 
|-
 
| 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.  (Note: the vanilla client will still incorrectly send this for non-creative players - see [https://bugs.mojang.com/browse/MC-46584 MC-46584])
 
|-
 
| 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.  (Note: the vanilla client will still incorrectly send this for non-creative players - see [https://bugs.mojang.com/browse/MC-46584 MC-46584])
 
|-
 
! 6
 
| 0
 
| Normal
 
| Double click
 
|}
 
  
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):
+
If a transaction sent by the client was not accepted, the server will reply with a [[#Confirm Transaction (clientbound)|Confirm Transaction (clientbound)]] packet with the Accepted field set to false. When this happens, the client must send this packet to apologize (as with movement), otherwise the server ignores any successive transactions.
 
 
# 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.
 
 
 
The server will send back a [[#Confirm Transaction (clientbound)|Confirm Transaction]] packet. If the click was not accepted, the client must send a matching [[#Confirm Transaction (serverbound)|serverbound confirm transaction]] packet before sending more [[#Click Window|Click Window]] packets, otherwise the server will reject them silently. The Notchian server also sends a [[#Window Items|Window Items]] packet for the open window and [[#Set Slot|Set Slot]] packets for the clicked and cursor slot, but only when the click was not accepted, probably to resynchronize client and server.
 
 
 
==== Close Window (serverbound) ====
 
 
 
This packet is sent by the client when closing a window.
 
 
 
Notchian clients send a Close Window packet with Window ID 0 to close their inventory even though there is never an [[#Open Window|Open Window]] packet for the inventory.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,507: Line 5,601:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x09
+
  |rowspan="3"| 0x07
  | Play
+
  |rowspan="3"| Play
  | Server
+
  |rowspan="3"| Server
 
  | Window ID
 
  | Window ID
  | Unsigned Byte
+
  | Byte
  | This is the ID of the window that was closed. 0 for player inventory.
+
  | The ID of the window that the action occurred in
 +
|-
 +
| Action Number
 +
| Short
 +
| Every action that is to be accepted has a unique number. This number is an incrementing integer (starting at 1) with separate counts for each window ID.
 +
|-
 +
| Accepted
 +
| Boolean
 +
| Whether the action was accepted
 
  |}
 
  |}
  
==== Plugin Message (serverbound) ====
+
==== Click Window Button ====
 
 
{{Main|Plugin channels}}
 
 
 
Mods and plugins can use this to send their data. Minecraft itself uses some [[plugin channel]]s. These internal channels are in the <code>minecraft</code> namespace.
 
 
 
More documentation on this: [http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/]
 
  
Note that the length of Data is known only from the packet length, since the packet has no length field of any kind.
+
Used when clicking on window buttons.  Until 1.14, this was only used by enchantment tables.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,533: Line 5,629:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0A
+
  |rowspan="2"| 0x07
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Server
 
  |rowspan="2"| Server
  | Channel
+
  | Window ID
  | Identifier
+
  | Byte
  | Name of the [[plugin channel]] used to send the data
+
  | The ID of the window sent by [[#Open Window|Open Window]]
 +
|-
 +
| Button ID
 +
| Byte
 +
| Meaning depends on window type; see below
 +
|}
 +
 
 +
{| class="wikitable"
 +
! Window type
 +
! ID
 +
! Meaning
 +
|-
 +
|rowspan="3"| Enchantment Table
 +
| 0 || Topmost enchantment
 +
|-
 +
| 1 || Middle enchantment
 +
|-
 +
| 2 || Bottom enchantment
 +
|-
 +
|rowspan="4"| Lectern
 +
| 1 || Unknown - maybe previous page?  (which does give a redstone output)
 +
|-
 +
| 2 || Unknown - maybe next page?
 +
|-
 +
| 3 || Take Book
 +
|-
 +
| 100? || Unknown - actual value is 100 + some parameter, so there may be multiple
 +
|-
 +
| Stonecutter
 +
|colspan="2"| Recipe button number - 4*row + col.  Depends on the item.
 
  |-
 
  |-
  | Data
+
  | Loom
  | Byte Array
+
  |colspan="2"| Recipe button number - 4*row + colDepends on the item.
| Any data, depending on the channel. <code>minecraft:</code> channels are documented [[plugin channel|here]]The length of this array must be inferred from the packet length.
 
 
  |}
 
  |}
  
==== Edit Book ====
+
 
 +
==== Click Window ====
 +
 
 +
This packet is sent by the player when it clicks on a slot in a window.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,555: Line 5,682:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x0B
+
  |rowspan="6"| 0x09
  |rowspan="3"| Play
+
  |rowspan="6"| Play
  |rowspan="3"| Server
+
  |rowspan="6"| Server
  | New book
+
  | Window ID
  | [[Slot]]
+
  | Unsigned Byte
|
+
| The ID of the window which was clicked. 0 for player inventory.
 +
|-
 +
| Slot
 +
| Short
 +
| The clicked slot number, see below
 +
|-
 +
| Button
 +
| Byte
 +
| The button used in the click, see below
 +
|-
 +
| Action Number
 +
| Short
 +
| A unique number for the action, implemented by Notchian as a counter, starting at 1 (different counter for every window ID). Used by the server to send back a [[#Confirm Transaction (clientbound)|Confirm Transaction (clientbound)]].
 
  |-
 
  |-
  | Is signing
+
  | Mode
  | Boolean
+
  | VarInt Enum
  | True if the player is signing the book; false if the player is saving a draft.
+
  | Inventory operation mode, see below
 
  |-
 
  |-
  | Hand
+
  | Clicked item
  | VarInt enum
+
  | [[Slot Data|Slot]]
  | 0: Main hand, 1: Off hand
+
  | The clicked slot. Has to be empty (item ID = -1) for drop mode.
 
  |}
 
  |}
  
When editing a draft, the [[NBT]] section of the Slot contains this:
+
See [[Inventory]] for further information about how slots are indexed.
  
<pre>
+
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.
TAG_Compound(<nowiki>''</nowiki>): 1 entry
 
{
 
  TAG_List('pages'): 2 entries
 
  {
 
    TAG_String(0): 'Something on Page 1'
 
    TAG_String(1): 'Something on Page 2'
 
  }
 
}
 
</pre>
 
  
When signing the book, it instead looks like this:
+
The distinct type of click performed by the client is determined by the combination of the Mode and Button fields.
  
<pre>
+
{| class="wikitable"
TAG_Compound(<nowiki>''</nowiki>): 3 entires
+
  ! Mode
{
+
  ! Button
  TAG_String('author'): 'Steve'
+
  ! Slot
  TAG_String('title'): 'A Wonderful Book'
+
  ! Trigger
  TAG_List('pages'): 2 entries
 
  {
 
    TAG_String(0): 'Something on Page 1'
 
    TAG_String(1): 'Something on Page 2'
 
  }
 
}
 
</pre>
 
 
 
==== Query Entity NBT ====
 
 
 
Used when <kbd>Shift</kbd>+<kbd>F3</kbd>+<kbd>I</kbd> is pressed while looking at an entity.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
  ! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x0C
+
  !rowspan="2"| 0
|rowspan="2"| Play
+
  | 0
|rowspan="2"| Server
+
  | Normal
  | Transaction ID
+
  | Left mouse click
  | VarInt
 
  | An incremental ID so that the client can verify that the response matches.
 
 
  |-
 
  |-
  | Entity ID
+
  | 1
  | VarInt
+
  | Normal
  | The ID of the entity to query.
+
  | Right mouse click
|}
 
 
 
==== Use Entity ====
 
 
 
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
 
 
 
A Notchian server only accepts this packet if the entity being attacked/used is visible without obstruction and within a 4-unit radius of the player's position.
 
 
 
Note that middle-click in creative mode is interpreted by the client and sent as a [[#Creative Inventory Action|Creative Inventory Action]] packet instead.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x0D
+
  !rowspan="2"| 1
|rowspan="6"| Play
+
  | 0
|rowspan="6"| Server
+
  | Normal
  | Target
+
  | Shift + left mouse click
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Type
+
  | 1
  | VarInt Enum
+
  | Normal
  | 0: interact, 1: attack, 2: interact at
+
  | Shift + right mouse click ''(identical behavior)''
 
  |-
 
  |-
  | Target X
+
  !rowspan="5"| 2
  | Optional Float
+
  | 0
  | Only if Type is interact at
+
  | Normal
 +
| Number key 1
 
  |-
 
  |-
  | Target Y
+
  | 1
  | Optional Float
+
  | Normal
  | Only if Type is interact at
+
  | Number key 2
 
  |-
 
  |-
  | Target Z
+
  | 2
  | Optional Float
+
  | Normal
  | Only if Type is interact at
+
  | Number key 3
 
  |-
 
  |-
  | Hand
+
  |
  | Optional VarInt Enum
+
  |
  | Only if Type is interact or interact at; 0: main hand, 1: off hand
+
  |
|}
 
 
 
==== Keep Alive (serverbound) ====
 
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  | 0x0E
+
  | 8
  | Play
+
  | Normal
  | Server
+
  | Number key 9
  | Keep Alive ID
+
  |-
  | Long
+
  !rowspan="1"| 3
  |  
+
  | 2
  |}
+
  | Normal
 
+
| Middle click, only defined for creative players in non-player inventories.
==== Player ====
+
|-
 
+
!rowspan="4"| 4
This packet as well as [[#Player Position|Player Position]], [[#Player Look|Player Look]], and [[#Player Position And Look 2|Player Position And Look]] are called the “serverbound movement packets”. Vanilla clients will send Player Position once every 20 ticks even for a stationary player.
+
  | 0
 
+
| Normal*
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
+
  | Drop key (Q) (* Clicked item is different, see above)
 
+
  |-
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.
+
  | 1
 
+
  | Normal*
{| class="wikitable"
+
  | Ctrl + Drop key (Ctrl-Q) ''(drops full stack)''
  ! Packet ID
 
  ! State
 
  ! Bound To
 
  ! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x0F
+
  | 0
  |rowspan="1"| Play
+
  | -999
  |rowspan="1"| Server
+
  | Left click outside inventory holding nothing ''(no-op)''
  | On Ground
+
  |-
  | Boolean
+
  | 1
  | True if the client is on the ground, false otherwise
+
  | -999
  |}
+
  | Right click outside inventory holding nothing ''(no-op)''
 
 
==== Player Position ====
 
 
 
Updates the player's XYZ position on the server.
 
 
 
Checking for moving too fast is achieved like this:
 
 
 
* Each server tick, the player's current position is stored
 
* When a player moves, the changes in x, y, and z coordinates are compared with the positions from the previous tick (&Delta;x, &Delta;y, &Delta;z)
 
* Total movement distance squared is computed as &Delta;x&sup2; + &Delta;y&sup2; + &Delta;z&sup2;
 
* The expected movement distance squared is computed as velocityX&sup2; + veloctyY&sup2; + velocityZ&sup2;
 
* If the total movement distance squared value minus the expected movement distance squared value is more than 100 (300 if the player is using an elytra), they are moving too fast.
 
 
 
If the player is moving too fast, it will be logged that "<player> moved too quickly! " followed by the change in x, y, and z, and the player will be teleported back to their current (before this packet) serverside position.
 
 
 
Also, if the absolute value of X or the absolute value of Z is a value greater than 3.2×10<sup>7</sup>, or X, Y, or Z are not finite (either positive infinity, negative infinity, or NaN), the client will be kicked for “Invalid move player packet received”.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x10
+
  !rowspan="9"| 5
|rowspan="4"| Play
+
  | 0
|rowspan="4"| Server
+
  | -999
  | X
+
  | Starting left mouse drag
  | Double
 
  | Absolute position
 
 
  |-
 
  |-
  | Feet Y
+
  | 4
  | Double
+
  | -999
  | Absolute feet position, normally Head Y - 1.62
+
  | Starting right mouse drag
 
  |-
 
  |-
  | Z
+
  | 8
  | Double
+
  | -999
  | Absolute position
+
  | Starting middle mouse drag, only defined for creative players in non-player inventories.  (Note: the vanilla client will still incorrectly send this for non-creative players - see [https://bugs.mojang.com/browse/MC-46584 MC-46584])
 
  |-
 
  |-
  | On Ground
+
  | 1
  | Boolean
+
  | Normal
  | True if the client is on the ground, false otherwise
+
  | Add slot for left-mouse drag
|}
+
|-
 
+
| 5
==== Player Position And Look (serverbound) ====
+
| Normal
 +
| Add slot for right-mouse drag
 +
|-
 +
| 9
 +
| Normal
 +
| Add slot for middle-mouse drag, only defined for creative players in non-player inventories.  (Note: the vanilla client will still incorrectly send this for non-creative players - see [https://bugs.mojang.com/browse/MC-46584 MC-46584])
 +
|-
 +
| 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.  (Note: the vanilla client will still incorrectly send this for non-creative players - see [https://bugs.mojang.com/browse/MC-46584 MC-46584])
 +
|-
 +
! 6
 +
| 0
 +
| Normal
 +
| Double click
 +
|}
 +
 
 +
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.
 +
 
 +
The server will send back a [[#Confirm Transaction (clientbound)|Confirm Transaction]] packet. If the click was not accepted, the client must send a matching [[#Confirm Transaction (serverbound)|serverbound confirm transaction]] packet before sending more [[#Click Window|Click Window]] packets, otherwise the server will reject them silently. The Notchian server also sends a [[#Window Items|Window Items]] packet for the open window and [[#Set Slot|Set Slot]] packets for the clicked and cursor slot, but only when the click was not accepted, probably to resynchronize client and server.
 +
 
 +
==== Close Window (serverbound) ====
 +
 
 +
This packet is sent by the client when closing a window.
  
A combination of [[#Player Look|Player Look]] and [[#Player Position|Player Position]].
+
Notchian clients send a Close Window packet with Window ID 0 to close their inventory even though there is never an [[#Open Window|Open Window]] packet for the inventory.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,767: Line 5,850:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x11
+
  | 0x0A
  |rowspan="6"| Play
+
  | Play
  |rowspan="6"| Server
+
  | Server
  | X
+
  | Window ID
  | Double
+
  | Unsigned Byte
  | Absolute position
+
  | This is the ID of the window that was closed. 0 for player inventory.
|-
 
| 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
 
 
  |}
 
  |}
  
==== Player Look ====
+
==== Plugin Message (serverbound) ====
[[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.
+
{{Main|Plugin channels}}
  
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.
+
Mods and plugins can use this to send their data. Minecraft itself uses some [[plugin channel]]s. These internal channels are in the <code>minecraft</code> namespace.
  
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
+
More documentation on this: [http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/]
  
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:
+
Note that the length of Data is known only from the packet length, since the packet has no length field of any kind.
 
 
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"
 
{| class="wikitable"
Line 5,830: Line 5,876:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x12
+
  |rowspan="2"| 0x0B
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Server
+
  |rowspan="2"| Server
  | Yaw
+
  | Channel
  | Float
+
  | Identifier
  | Absolute rotation on the X Axis, in degrees
+
  | Name of the [[plugin channel]] used to send the data
 
  |-
 
  |-
  | Pitch
+
  | Data
  | Float
+
  | Byte Array
  | Absolute rotation on the Y Axis, in degrees
+
  | Any data, depending on the channel. <code>minecraft:</code> channels are documented [[plugin channel|here]]. The length of this array must be inferred from the packet length.
|-
 
| On Ground
 
  | Boolean
 
| True if the client is on the ground, False otherwise
 
 
  |}
 
  |}
  
==== Vehicle Move (serverbound) ====
+
==== Edit Book ====
 
 
Sent when a player moves in a vehicle. Fields are the same as in [[#Player Position And Look (serverbound)|Player Position And Look]]. Note that all fields use absolute positioning and do not allow for relative positioning.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,858: Line 5,898:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x13
+
  |rowspan="3"| 0x0C
  |rowspan="5"| Play
+
  |rowspan="3"| Play
  |rowspan="5"| Server
+
  |rowspan="3"| Server
  | X
+
  | New book
  | Double
+
  | [[Slot]]
  | Absolute position (X coordinate)
+
  |
 
  |-
 
  |-
  | Y
+
  | Is signing
  | Double
+
  | Boolean
  | Absolute position (Y coordinate)
+
  | True if the player is signing the book; false if the player is saving a draft.
 
  |-
 
  |-
  | Z
+
  | Hand
  | Double
+
  | VarInt enum
  | Absolute position (Z coordinate)
+
  | 0: Main hand, 1: Off hand
|-
+
|}
| Yaw
+
 
| Float
+
When editing a draft, the [[NBT]] section of the Slot contains this:
| Absolute rotation on the vertical axis, in degrees
+
 
|-
+
<pre>
| Pitch
+
TAG_Compound(<nowiki>''</nowiki>): 1 entry
| Float
+
{
| Absolute rotation on the horizontal axis, in degrees
+
  TAG_List('pages'): 2 entries
|}
+
  {
 +
    TAG_String(0): 'Something on Page 1'
 +
    TAG_String(1): 'Something on Page 2'
 +
  }
 +
}
 +
</pre>
 +
 
 +
When signing the book, it instead looks like this:
 +
 
 +
<pre>
 +
TAG_Compound(<nowiki>''</nowiki>): 3 entires
 +
{
 +
  TAG_String('author'): 'Steve'
 +
  TAG_String('title'): 'A Wonderful Book'
 +
  TAG_List('pages'): 2 entries
 +
  {
 +
    TAG_String(0): 'Something on Page 1'
 +
    TAG_String(1): 'Something on Page 2'
 +
  }
 +
}
 +
</pre>
  
==== Steer Boat ====
+
==== Query Entity NBT ====
  
Used to ''visually'' update whether boat paddles are turning.  The server will update the [[Entities#Boat|Boat entity metadata]] to match the values here.
+
Used when <kbd>Shift</kbd>+<kbd>F3</kbd>+<kbd>I</kbd> is pressed while looking at an entity.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,894: Line 5,954:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x14
+
  |rowspan="2"| 0x0D
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Server
 
  |rowspan="2"| Server
  | Left paddle turning
+
  | Transaction ID
  | Boolean
+
  | VarInt
  |
+
  | An incremental ID so that the client can verify that the response matches.
 
  |-
 
  |-
  | Right paddle turning
+
  | Entity ID
  | Boolean
+
  | VarInt
  |
+
  | The ID of the entity to query.
 
  |}
 
  |}
  
Right paddle turning is set to true when the left button or forward button is held; left paddle turning is set to true when the right button or forward button is set to true.
+
==== Use Entity ====
  
==== Pick Item ====
+
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
  
Used to swap out an empty space on the hotbar with the item in the given inventory slot.  The Notchain client uses this for pick block functionality (middle click) to retrieve items from the inventory.
+
A Notchian server only accepts this packet if the entity being attacked/used is visible without obstruction and within a 4-unit radius of the player's position.
  
 +
Note that middle-click in creative mode is interpreted by the client and sent as a [[#Creative Inventory Action|Creative Inventory Action]] packet instead.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,921: Line 5,982:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x15
+
  |rowspan="6"| 0x0E
  |rowspan="1"| Play
+
  |rowspan="6"| Play
  |rowspan="1"| Server
+
  |rowspan="6"| Server
  | Slot to use
+
  | Target
 
  | VarInt
 
  | VarInt
  | See [[Inventory]]
+
  |  
 +
|-
 +
| Type
 +
| VarInt Enum
 +
| 0: interact, 1: attack, 2: interact at
 +
|-
 +
| Target X
 +
| Optional Float
 +
| Only if Type is interact at
 +
|-
 +
| Target Y
 +
| Optional Float
 +
| Only if Type is interact at
 +
|-
 +
| Target Z
 +
| Optional Float
 +
| Only if Type is interact at
 +
|-
 +
| Hand
 +
| Optional VarInt Enum
 +
| Only if Type is interact or interact at; 0: main hand, 1: off hand
 
  |}
 
  |}
  
The server will first search the player's hotbar for an empty slot, starting from the current slot and looping around to the slot before it.  If there are no empty slots, it will start a second search from the current slot and find the first slot that does not contain an enchanted item.  If there still are no slots that meet that criteria, then the server will use the currently selected slot.
+
==== Keep Alive (serverbound) ====
  
After finding the appropriate slot, the server swaps the items and then send 3 packets:
+
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
 
 
* [[Protocol#Set slot|Set Slot]], with window ID set to -2 and slot set to the newly chosen slot and the item set to the item that is now in that slot (which was previously at the slot the client requested)
 
* Set Slot, with window ID set to -2 and slot set to the slot the player requested, with the item that is now in that slot and was previously on the hotbar slot
 
* [[Protocol#Held_Item_Change_.28clientbound.29|Held Item Change]], with the slot set to the newly chosen slot.
 
 
 
==== Craft Recipe Request ====
 
 
 
This packet is sent when a player clicks a recipe in the crafting book that is craftable (white border).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,949: Line 6,022:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x16
+
  | 0x0F
  |rowspan="3"| Play
+
  | Play
  |rowspan="3"| Server
+
  | Server
  | Window ID
+
  | Keep Alive ID
| Byte
+
  | Long
|
+
  |  
|-
 
| Recipe
 
| Identifier
 
| A recipe ID
 
  |-
 
| Make all
 
| Boolean
 
  | Affects the amount of items processed; true if shift is down when clicked
 
 
  |}
 
  |}
  
==== Player Abilities (serverbound) ====
+
==== Lock Difficulty ====
 
 
The latter 2 bytes are used to indicate the walking and flying speeds respectively, while the first byte is used to determine the value of 4 booleans.
 
  
The vanilla client sends this packet when the player starts/stops flying with the Flags parameter changed accordingly. All other parameters are ignored by the vanilla server.
+
Must have at least op level 2 to use.  Appears to only be used on singleplayer; the difficulty buttons are still disabled in multiplayer.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 5,979: Line 6,042:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x17
+
  |rowspan="1"| 0x10
  |rowspan="3"| Play
+
  |rowspan="1"| Play
  |rowspan="3"| Server
+