Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
(Fixed a link)
 
(79 intermediate revisions by 20 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 '''Java Edition''' ([[Protocol version numbers|1.15.2, protocol 578]]). For the Java Edition pre-releases, see [[Pre-release protocol]]. For the incomplete Bedrock Edition docs, see [[Bedrock Protocol]]. For the old 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.15.2.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 66: Line 66:
 
  | Length
 
  | Length
 
  | VarInt
 
  | VarInt
  | Length of packet data + length of the packet ID
+
  | Length of Packet ID + Data
 
  |-
 
  |-
 
  | Packet ID
 
  | Packet ID
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 578 in Minecraft 1.15.2)
 
  |-
 
  |-
 
  | 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 179: Line 179:
 
See [[Server List Ping#1.6]] for the details of the protocol that follows this packet.
 
See [[Server List Ping#1.6]] for the details of the protocol that follows this packet.
  
== Play ==
+
== Status ==
 +
{{Main|Server List Ping}}
  
 
=== Clientbound ===
 
=== Clientbound ===
  
==== Spawn Object ====
+
==== Response ====
 
 
Sent by the server when a vehicle or other object is created.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 195: Line 194:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="12"| 0x00
+
  |rowspan="2"| 0x00
  |rowspan="12"| Play
+
  |rowspan="2"| Status
  |rowspan="12"| Client
+
  |rowspan="2"| Client
| Entity ID
 
| VarInt
 
| EID of the object
 
 
  |-
 
  |-
  | Object UUID
+
  | JSON Response
  | UUID
+
  | String (32767)
  |  
+
  | See [[Server List Ping#Response]]; as with all strings this is prefixed by its length as a VarInt
 +
|}
 +
 
 +
==== Pong ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Type
+
  |rowspan="1"| 0x01
  | Byte
+
|rowspan="1"| Status
  | The type of object (see [[Entities#Objects]])
+
|rowspan="1"| Client
 +
| Payload
 +
| Long
 +
  | Should be the same as sent by the client
 +
  |}
 +
 
 +
=== Serverbound ===
 +
 
 +
==== Request ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | X
+
  |rowspan="1"| 0x00
| Double
+
  | Status
|
+
  | Server
|-
+
  |colspan="3"| ''no fields''
| Y
 
| Double
 
|  
 
  |-
 
  | Z
 
  | Double
 
|
 
|-
 
| Pitch
 
| Angle
 
|
 
|-
 
| Yaw
 
| Angle
 
|
 
|-
 
| Data
 
| Int
 
| Meaning dependent on the value of the Type field, see [[Object Data]] for details.
 
|-
 
| Velocity X
 
| Short
 
|rowspan="3"| Same units as [[#Entity Velocity|Entity Velocity]].  Always sent, but only used when Data is greater than 0 (except for some entities which always ignore it; see [[Object Data]] for details).
 
|-
 
| Velocity Y
 
| Short
 
|-
 
| Velocity Z
 
| Short
 
 
  |}
 
  |}
  
==== Spawn Experience Orb ====
+
==== Ping ====
 
 
Spawns one or more experience orbs.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 257: Line 249:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x01
+
  |rowspan="1"| 0x01
  |rowspan="5"| Play
+
  |rowspan="1"| Status
  |rowspan="5"| Client
+
  |rowspan="1"| Server
  | Entity ID
+
  | Payload
  | VarInt
+
  | Long
  |  
+
  | May be any number. Notchian clients use a system-dependent time value which is counted in milliseconds.
  |-
+
  |}
  | X
+
 
  | Double
+
== Login ==
  |
+
 
 +
The login process is as follows:
 +
 
 +
# C→S: [[#Handshake|Handshake]] with Next State set to 2 (login)
 +
# C→S: [[#Login Start|Login Start]]
 +
# S→C: [[#Encryption Request|Encryption Request]]
 +
# Client auth
 +
# C→S: [[#Encryption Response|Encryption Response]]
 +
# Server auth, both enable encryption
 +
# S→C: [[#Set Compression|Set Compression]] (optional)
 +
# S→C: [[#Login Success|Login Success]]
 +
 
 +
Set Compression, if present, must be sent before Login Success. Note that anything sent after Set Compression must use the [[#With_compression|Post Compression packet format]].
 +
 
 +
For unauthenticated ("cracked"/offline-mode) and localhost connections (either of the two conditions is enough for an unencrypted connection) there is no encryption. In that case [[#Login Start|Login Start]] is directly followed by [[#Login Success|Login Success]].
 +
 
 +
See [[Protocol Encryption]] for details.
 +
 
 +
=== Clientbound ===
 +
 
 +
==== Disconnect (login) ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Y
+
  |rowspan="1"| 0x00
  | Double
+
  |rowspan="1"| Login
  |  
+
  |rowspan="1"| Client
|-
+
  | Reason
  | Z
+
  | [[Chat]]
  | Double
 
 
  |  
 
  |  
|-
 
| Count
 
| Short
 
| The amount of experience this orb will reward once collected
 
 
  |}
 
  |}
  
==== Spawn Global Entity ====
+
==== Encryption Request ====
 
 
With this packet, the server notifies the client of thunderbolts striking within a 512 block radius around the player. The coordinates specify where exactly the thunderbolt strikes.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 293: Line 306:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x02
+
  |rowspan="5"| 0x01
  |rowspan="5"| Play
+
  |rowspan="5"| Login
 
  |rowspan="5"| Client
 
  |rowspan="5"| Client
  | Entity ID
+
  | Server ID
 +
| String (20)
 +
| Appears to be empty
 +
|-
 +
| Public Key Length
 
  | VarInt
 
  | VarInt
  | The EID of the thunderbolt
+
  | Length of Public Key
 
  |-
 
  |-
  | Type
+
  | Public Key
  | Byte Enum
+
  | Byte Array
| The global entity type, currently always 1 for thunderbolt
 
|-
 
| X
 
| Double
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Y
+
  | Verify Token Length
  | Double
+
  | VarInt
  |  
+
  | Length of Verify Token. Always 4 for Notchian servers.
 
  |-
 
  |-
  | Z
+
  | Verify Token
  | Double
+
  | Byte Array
  |  
+
  | A sequence of random bytes generated by the server
 
  |}
 
  |}
  
==== Spawn Mob ====
+
See [[Protocol Encryption]] for details.
  
Sent by the server when a mob entity is spawned.
+
==== Login Success ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 329: Line 342:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="13"| 0x03
+
  |rowspan="2"| 0x02
  |rowspan="13"| Play
+
  |rowspan="2"| Login
  |rowspan="13"| Client
+
  |rowspan="2"| Client
| Entity ID
 
| VarInt
 
|
 
|-
 
| Entity UUID
 
 
  | UUID
 
  | UUID
  |  
+
  | String (36)
 +
| Unlike in other packets, this field contains the UUID as a string with hyphens.
 
  |-
 
  |-
  | Type
+
  | Username
  | VarInt
+
  | String (16)
| The type of mob. See [[Entities#Mobs]]
 
|-
 
| X
 
| Double
 
 
  |  
 
  |  
  |-
+
  |}
| Y
+
 
| Double
+
This packet switches the connection state to [[#Play|play]].
|
+
 
|-
+
{{Warning2|The (notchian) server might take a bit to fully transition to the Play state, so it's recommended to wait before sendings Play packets, either by setting a timeout, or waiting for Play packets from the server (usually [[#Player Info|Player Info]]).
| Z
+
 
| Double
+
The notchian client doesn't send any (non-[[#Keep Alive|keep alive]]) packets until the next tick/[[#Time Update|time update]] packet.
|
+
}}
|-
 
| Yaw
 
| Angle
 
|
 
|-
 
| Pitch
 
| Angle
 
|
 
|-
 
| Head Pitch
 
| Angle
 
|
 
|-
 
| Velocity X
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]]
 
|-
 
| Velocity Y
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]]
 
|-
 
| Velocity Z
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]]
 
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Entity Metadata]]
 
|
 
|}
 
  
==== Spawn Painting ====
+
==== Set Compression ====
  
This packet shows location, name, and type of painting.
+
Enables compression.  If compression is enabled, all following packets are encoded in the [[#With compression|compressed packet format]].  Negative or zero values will disable compression, meaning the packet format should remain in the [[#Without compression|uncompressed packet format]].  However, this packet is entirely optional, and if not sent, compression will also not be enabled (the notchian server does not send the packet when compression is disabled).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 397: Line 373:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x04
+
  |rowspan="1"| 0x03
  |rowspan="5"| Play
+
  |rowspan="1"| Login
  |rowspan="5"| Client
+
  |rowspan="1"| Client
  | Entity ID
+
  | Threshold
 
  | VarInt
 
  | VarInt
  |  
+
  | Maximum size of a packet before it is compressed
  |-
+
  |}
  | Entity UUID
+
 
  | UUID
+
==== Login Plugin Request ====
  |
+
 
 +
Used to implement a custom handshaking flow together with [[#Login_Plugin_Response | Login Plugin Response]].
 +
 
 +
Unlike plugin messages in "play" mode, these messages follow a lock-step request/response scheme, where the client is expected to respond to a request indicating whether it understood. The notchian client always responds that it hasn't understood, and sends an empty payload.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Motive
+
  |rowspan="3"| 0x04
 +
|rowspan="3"| Login
 +
|rowspan="3"| Client
 +
| Message ID
 
  | VarInt
 
  | VarInt
  | Panting's ID, see below
+
  | Generated by the server - should be unique to the connection.
 
  |-
 
  |-
  | Location
+
  | Channel
  | Position
+
  | Identifier
  | Center coordinates (see below)
+
  | Name of the [[plugin channel]] used to send the data
 
  |-
 
  |-
  | Direction
+
  | Data
  | Byte Enum
+
  | Byte Array
  | Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
 
  |}
 
  |}
  
Calculating the center of an image: given a (width × height) grid of cells, with <code>(0, 0)</code> being the top left corner, the center is <code>(max(0, width / 2 - 1), height / 2)</code>. E.g. <code>(1, 0)</code> for a 2×1 painting, or <code>(1, 2)</code> for a 4×4 painting.
+
=== Serverbound ===
  
List of paintings by coordinates in <code>paintings_kristoffer_zetterstrand.png</code> (where x and y are in pixels from the top left and width and height are in pixels or 16ths of a block):
+
==== Login Start  ====
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Name
+
  ! Packet ID
  ! ID
+
  ! State
  ! x
+
  ! Bound To
  ! y
+
  ! Field Name
  ! width
+
  ! Field Type
  ! height
+
  ! Notes
 
  |-
 
  |-
  | <code>minecraft:kebab</code>
+
  |rowspan="1"| 0x00
  | 0
+
  |rowspan="1"| Login
  | 0
+
  |rowspan="1"| Server
  | 0
+
  | Name
  | 16
+
  | String (16)
  | 16
+
| Player's Username
 +
  |}
 +
 
 +
==== Encryption Response ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>minecraft:aztec</code>
+
  |rowspan="4"| 0x01
  | 1
+
  |rowspan="4"| Login
  | 16
+
  |rowspan="4"| Server
  | 0
+
  | Shared Secret Length
  | 16
+
  | VarInt
  | 16
+
  | Length of Shared Secret
 
  |-
 
  |-
  | <code>minecraft:alban</code>
+
  | Shared Secret
  | 2
+
  | Byte Array
  | 32
+
  |  
| 0
 
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>minecraft:aztec2</code>
+
  | Verify Token Length
  | 3
+
  | VarInt
  | 48
+
  | Length of Verify Token
| 0
 
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>minecraft:bomb</code>
+
  | Verify Token
  | 4
+
  | Byte Array
  | 64
+
  |  
  | 0
+
  |}
  | 16
+
 
  | 16
+
See [[Protocol Encryption]] for details.
 +
 
 +
==== Login Plugin Response ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>minecraft:plant</code>
+
  |rowspan="3"| 0x02
  | 5
+
  |rowspan="3"| Login
  | 80
+
  |rowspan="3"| Server
  | 0
+
  | Message ID
  | 16
+
  | VarInt
  | 16
+
  | Should match ID from server.
 
  |-
 
  |-
  | <code>minecraft:wasteland</code>
+
  | Successful
| 6
+
| Boolean
| 96
+
| <code>true</code> if the client understands the request, <code>false</code> otherwise. When <code>false</code>, no payload follows.
| 0
 
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>minecraft:pool</code>
+
  | Data
  | 7
+
  | Optional Byte Array
  | 0
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
  | 32
+
  |}
  | 32
+
 
  | 16
+
== Play ==
 +
 
 +
=== Clientbound ===
 +
 
 +
==== Spawn Entity ====
 +
 
 +
Sent by the server when a vehicle or other non-living entity is created.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>minecraft:courbet</code>
+
  |rowspan="12"| 0x00
  | 8
+
  |rowspan="12"| Play
  | 32
+
  |rowspan="12"| Client
  | 32
+
  | Entity ID
  | 32
+
  | VarInt
  | 16
+
  | EID of the entity
 
  |-
 
  |-
  | <code>minecraft:sea</code>
+
  | Object UUID
  | 9
+
  | UUID
  | 64
+
  |  
| 32
 
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>minecraft:sunset</code>
+
  | Type
  | 10
+
  | VarInt
  | 96
+
  | The type of entity (same as in [[#Spawn Living Entity|Spawn Living Entity]])
| 32
 
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>minecraft:creebet</code>
+
  | X
  | 11
+
  | Double
  | 128
+
  |  
| 32
 
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>minecraft:wanderer</code>
+
  | Y
  | 12
+
  | Double
  | 0
+
  |  
| 64
 
| 16
 
| 32
 
 
  |-
 
  |-
  | <code>minecraft:graham</code>
+
  | Z
  | 13
+
  | Double
  | 16
+
  |  
| 64
 
| 16
 
| 32
 
 
  |-
 
  |-
  | <code>minecraft:match</code>
+
  | Pitch
  | 14
+
  | Angle
  | 0
+
  |  
| 128
 
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>minecraft:bust</code>
+
  | Yaw
  | 15
+
  | Angle
  | 32
+
  |  
| 128
 
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>minecraft:stage</code>
+
  | Data
  | 16
+
  | Int
  | 64
+
  | Meaning dependent on the value of the Type field, see [[Object Data]] for details.
| 128
 
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>minecraft:void</code>
+
  | Velocity X
  | 17
+
  | Short
  | 96
+
  |rowspan="3"| Same units as [[#Entity Velocity|Entity Velocity]]. Always sent, but only used when Data is greater than 0 (except for some entities which always ignore it; see [[Object Data]] for details).
| 128
 
| 32
 
  | 32
 
 
  |-
 
  |-
  | <code>skull_and_roses</code>
+
  | Velocity Y
  | 18
+
  | Short
| 128
 
| 128
 
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>minecraft:wither</code>
+
  | Velocity Z
  | 19
+
  | Short
  | 160
+
  |}
  | 128
+
 
  | 32
+
==== Spawn Experience Orb ====
  | 32
+
 
 +
Spawns one or more experience orbs.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>minecraft:fighters</code>
+
  |rowspan="5"| 0x01
  | 20
+
  |rowspan="5"| Play
  | 0
+
  |rowspan="5"| Client
  | 96
+
  | Entity ID
  | 64
+
  | VarInt
  | 32
+
  |  
 
  |-
 
  |-
  | <code>minecraft:pointer</code>
+
  | X
  | 21
+
  | Double
  | 0
+
  |  
| 192
 
| 64
 
| 64
 
 
  |-
 
  |-
  | <code>minecraft:pigscene</code>
+
  | Y
  | 22
+
  | Double
  | 64
+
  |  
| 192
 
| 64
 
| 64
 
 
  |-
 
  |-
  | <code>minecraft:burning_skull</code>
+
  | Z
  | 23
+
  | Double
  | 128
+
  |  
| 192
 
| 64
 
| 64
 
 
  |-
 
  |-
  | <code>minecraft:skeleton</code>
+
  | Count
  | 24
+
  | Short
  | 192
+
  | The amount of experience this orb will reward once collected
| 64
 
| 64
 
| 48
 
|-
 
| <code>minecraft:donkey_kong</code>
 
| 25
 
| 192
 
| 112
 
| 64
 
| 48
 
 
  |}
 
  |}
  
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
+
==== Spawn Weather Entity ====
  
==== Spawn Player ====
+
With this packet, the server notifies the client of thunderbolts striking within a 512 block radius around the player. The coordinates specify where exactly the thunderbolt strikes.
 
 
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.
 
 
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 634: Line 603:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x05
+
  |rowspan="5"| 0x02
  |rowspan="8"| Play
+
  |rowspan="5"| Play
  |rowspan="8"| Client
+
  |rowspan="5"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player's EID
+
  | The EID of the thunderbolt
 
  |-
 
  |-
  | Player UUID
+
  | Type
  | UUID
+
  | Byte Enum
  | See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
+
  | The global entity type, currently always 1 for thunderbolt
 
  |-
 
  |-
 
  | X
 
  | X
Line 656: Line 625:
 
  | Double
 
  | Double
 
  |  
 
  |  
  |-
+
  |}
| Yaw
+
 
| Angle
+
==== Spawn Living Entity ====
|
 
|-
 
| Pitch
 
| Angle
 
|
 
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Entity Metadata]]
 
|
 
|}
 
  
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs.
+
Sent by the server when a living entity is spawned.
 
 
In offline mode, [[Wikipedia:Universally unique identifier#Versions 3 and 5 (namespace name-based)|UUID v3]] is used with the String <code>OfflinePlayer:&lt;player name&gt;</code>, encoded in UTF-8 (and case-sensitive).
 
 
 
For NPCs UUID v2 should be used. Note:
 
 
 
<+Grum> i will never confirm this as a feature you know that :)
 
 
 
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 
 
 
==== Animation (clientbound) ====
 
 
 
Sent whenever an entity should change animation.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 692: Line 639:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x06
+
  |rowspan="12"| 0x03
  |rowspan="2"| Play
+
  |rowspan="12"| Play
  |rowspan="2"| Client
+
  |rowspan="12"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player ID
+
  |  
 
  |-
 
  |-
  | Animation
+
  | Entity UUID
  | Unsigned Byte
+
  | UUID
  | Animation ID (see below)
+
  |  
|}
 
 
 
Animation can be one of the following values:
 
 
 
{| class="wikitable"
 
! ID
 
! Animation
 
 
  |-
 
  |-
  | 0
+
  | Type
  | Swing main arm
+
  | VarInt
 +
| The type of mob. See [[Entities#Mobs]]
 
  |-
 
  |-
  | 1
+
  | X
  | Take damage
+
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
  |  
 
  |-
 
  |-
  | 2
+
  | Yaw
  | Leave bed
+
| Angle
 +
|
 +
|-
 +
| Pitch
 +
| Angle
 +
|
 +
|-
 +
| Head Pitch
 +
| Angle
 +
  |  
 
  |-
 
  |-
  | 3
+
  | Velocity X
  | Swing offhand
+
  | Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 
  |-
 
  |-
  | 4
+
  | Velocity Y
  | Critical effect
+
  | Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 
  |-
 
  |-
  | 5
+
  | Velocity Z
  | Magic critical effect
+
  | Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 
  |}
 
  |}
  
==== Statistics ====
+
==== Spawn Painting ====
  
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1).
+
This packet shows location, name, and type of painting.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
  ! Bound To  
+
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x07
+
  |rowspan="5"| 0x04
  |rowspan="4"| Play
+
  |rowspan="5"| Play
  |rowspan="4"| Client
+
  |rowspan="5"| Client
  |colspan="2"| Count
+
  | Entity ID
  |colspan="2"| VarInt
+
| VarInt
  | Number of elements in the following array
+
|
 +
|-
 +
  | Entity UUID
 +
| UUID
 +
  |  
 
  |-
 
  |-
  |rowspan="2"| Statistic
+
  | Motive
| Category ID
 
|rowspan="2"| Array
 
 
  | VarInt
 
  | VarInt
  | See below
+
  | Panting's ID, see below
 
  |-
 
  |-
  | Statistic ID
+
  | Location
  | VarInt
+
  | Position
  | See below
+
  | Center coordinates (see below)
 
  |-
 
  |-
  |colspan="2"| Value
+
  | Direction
  |colspan="2"| VarInt
+
| Byte Enum
| The amount to set it to
+
  | Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
 
  |}
 
  |}
  
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
+
Calculating the center of an image: given a (width × height) grid of cells, with <code>(0, 0)</code> being the top left corner, the center is <code>(max(0, width / 2 - 1), height / 2)</code>. E.g. <code>(1, 0)</code> for a 2×1 painting, or <code>(1, 2)</code> for a 4×4 painting.
 +
 
 +
List of paintings by coordinates in <code>paintings_kristoffer_zetterstrand.png</code> (where x and y are in pixels from the top left and width and height are in pixels or 16ths of a block):
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Name
 
  ! Name
 
  ! ID
 
  ! ID
  ! Registry
+
  ! x
 +
! y
 +
! width
 +
! height
 
  |-
 
  |-
  | <code>minecraft.mined</code>
+
  | <code>minecraft:kebab</code>
 +
| 0
 +
| 0
 
  | 0
 
  | 0
  | Blocks
+
  | 16
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.crafted</code>
+
  | <code>minecraft:aztec</code>
 
  | 1
 
  | 1
  | Items
+
  | 16
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.used</code>
+
  | <code>minecraft:alban</code>
 
  | 2
 
  | 2
  | Items
+
  | 32
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.broken</code>
+
  | <code>minecraft:aztec2</code>
 
  | 3
 
  | 3
  | Items
+
  | 48
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.picked_up</code>
+
  | <code>minecraft:bomb</code>
 
  | 4
 
  | 4
  | Items
+
  | 64
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.dropped</code>
+
  | <code>minecraft:plant</code>
 
  | 5
 
  | 5
  | Items
+
  | 80
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.killed</code>
+
  | <code>minecraft:wasteland</code>
 
  | 6
 
  | 6
  | Entities
+
  | 96
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.killed_by</code>
+
  | <code>minecraft:pool</code>
 
  | 7
 
  | 7
  | Entities
+
  | 0
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.custom</code>
+
  | <code>minecraft:courbet</code>
 
  | 8
 
  | 8
  | Custom
+
  | 32
  |}
+
  | 32
 
+
| 32
Blocks, Items, and Entities use block (not block state), item, and entity ids.
+
| 16
 
+
|-
Custom has the following (unit only matters for clients):
+
| <code>minecraft:sea</code>
 
+
| 9
{| class="wikitable"
+
| 64
  ! Name
+
  | 32
  ! ID
+
  | 32
  ! Unit
+
  | 16
 
  |-
 
  |-
  | <code>minecraft.leave_game</code>
+
  | <code>minecraft:sunset</code>
  | 0
+
  | 10
  | None
+
  | 96
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.play_one_minute</code>
+
  | <code>minecraft:creebet</code>
  | 1
+
  | 11
  | Time
+
  | 128
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | <code>minecraft.time_since_death</code>
+
  | <code>minecraft:wanderer</code>
  | 2
+
  | 12
  | Time
+
  | 0
 +
| 64
 +
| 16
 +
| 32
 
  |-
 
  |-
  | <code>minecraft.sneak_Time</code>
+
  | <code>minecraft:graham</code>
  | 3
+
  | 13
  | Time
+
  | 16
 +
| 64
 +
| 16
 +
| 32
 
  |-
 
  |-
  | <code>minecraft.walk_one_cm</code>
+
  | <code>minecraft:match</code>
  | 4
+
  | 14
  | Distance
+
  | 0
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | <code>minecraft.crouch_one_cm</code>
+
  | <code>minecraft:bust</code>
  | 5
+
  | 15
  | Distance
+
  | 32
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | <code>minecraft.sprint_one_cm</code>
+
  | <code>minecraft:stage</code>
  | 6
+
  | 16
  | Distance
+
  | 64
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | <code>minecraft.swim_one_cm</code>
+
  | <code>minecraft:void</code>
  | 7
+
  | 17
  | Distance
+
  | 96
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | <code>minecraft.fall_one_cm</code>
+
  | <code>skull_and_roses</code>
  | 8
+
  | 18
  | Distance
+
  | 128
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | <code>minecraft.climb_one_cm</code>
+
  | <code>minecraft:wither</code>
  | 9
+
  | 19
  | Distance
+
  | 160
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | <code>minecraft.fly_one_cm</code>
+
  | <code>minecraft:fighters</code>
  | 10
+
  | 20
  | Distance
+
  | 0
 +
| 96
 +
| 64
 +
| 32
 
  |-
 
  |-
  | <code>minecraft.dive_one_cm</code>
+
  | <code>minecraft:pointer</code>
  | 11
+
  | 21
  | Distance
+
  | 0
 +
| 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  | <code>minecraft.minecart_one_cm</code>
+
  | <code>minecraft:pigscene</code>
  | 12
+
  | 22
  | Distance
+
  | 64
 +
| 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  | <code>minecraft.boat_one_cm</code>
+
  | <code>minecraft:burning_skull</code>
  | 13
+
  | 23
  | Distance
+
  | 128
 +
| 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  | <code>minecraft.pig_one_cm</code>
+
  | <code>minecraft:skeleton</code>
  | 14
+
  | 24
  | Distance
+
  | 192
 +
| 64
 +
| 64
 +
| 48
 
  |-
 
  |-
  | <code>minecraft.horse_one_cm</code>
+
  | <code>minecraft:donkey_kong</code>
  | 15
+
  | 25
  | Distance
+
| 192
  |-
+
| 112
  | <code>minecraft.aviate_one_cm</code>
+
  | 64
  | 16
+
  | 48
  | Distance
+
  |}
 +
 
 +
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
 +
 
 +
==== Spawn Player ====
 +
 
 +
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 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>minecraft.jump</code>
+
  |rowspan="7"| 0x05
  | 17
+
|rowspan="7"| Play
  | None
+
|rowspan="7"| Client
 +
| Entity ID
 +
  | VarInt
 +
  | Player's EID
 
  |-
 
  |-
  | <code>minecraft.drop</code>
+
  | Player UUID
  | 18
+
  | UUID
  | None
+
  | See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
 
  |-
 
  |-
  | <code>minecraft.damage_dealt</code>
+
  | X
  | 19
+
  | Double
  | Damage
+
  |  
 
  |-
 
  |-
  | <code>minecraft.damage_taken</code>
+
  | Y
  | 20
+
  | Double
  | Damage
+
  |  
 
  |-
 
  |-
  | <code>minecraft.deaths</code>
+
  | Z
  | 21
+
  | Double
  | None
+
  |  
 
  |-
 
  |-
  | <code>minecraft.mob_kills</code>
+
  | Yaw
  | 22
+
  | Angle
  | None
+
  |  
 
  |-
 
  |-
  | <code>minecraft.animals_bred</code>
+
  | Pitch
  | 23
+
| Angle
  | None
+
|
 +
|}
 +
 
 +
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs.
 +
 
 +
In offline mode, [[Wikipedia:Universally unique identifier#Versions 3 and 5 (namespace name-based)|UUID v3]] is used with the String <code>OfflinePlayer:&lt;player name&gt;</code>, encoded in UTF-8 (and case-sensitive).
 +
 
 +
For NPCs UUID v2 should be used. Note:
 +
 
 +
<+Grum> i will never confirm this as a feature you know that :)
 +
 
 +
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 +
 
 +
==== Entity Animation (clientbound) ====
 +
 
 +
Sent whenever an entity should change animation.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
! Field Name
 +
! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>minecraft.player_kills</code>
+
  |rowspan="2"| 0x06
  | 24
+
|rowspan="2"| Play
  | None
+
|rowspan="2"| Client
 +
| Entity ID
 +
  | VarInt
 +
  | Player ID
 
  |-
 
  |-
  | <code>minecraft.fish_caught</code>
+
  | Animation
  | 25
+
  | Unsigned Byte
  | None
+
  | Animation ID (see below)
 +
|}
 +
 
 +
Animation can be one of the following values:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Animation
 
  |-
 
  |-
  | <code>minecraft.talked_to_villager</code>
+
  | 0
  | 26
+
  | Swing main arm
| None
 
 
  |-
 
  |-
  | <code>minecraft.traded_with_villager</code>
+
  | 1
  | 27
+
  | Take damage
| None
 
 
  |-
 
  |-
  | <code>minecraft.eat_cake_slice</code>
+
  | 2
  | 28
+
  | Leave bed
| None
 
 
  |-
 
  |-
  | <code>minecraft.fill_cauldron</code>
+
  | 3
  | 29
+
  | Swing offhand
| None
 
 
  |-
 
  |-
  | <code>minecraft.use_cauldron</code>
+
  | 4
  | 30
+
  | Critical effect
| None
 
 
  |-
 
  |-
  | <code>minecraft.clean_armor</code>
+
  | 5
  | 31
+
| Magic critical effect
  | None
+
|}
 +
 
 +
==== Statistics ====
 +
 
 +
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1).
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
  !colspan="2"| Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>minecraft.clean_banner</code>
+
  |rowspan="4"| 0x07
  | 32
+
|rowspan="4"| Play
  | None
+
|rowspan="4"| Client
 +
  |colspan="2"| Count
 +
|colspan="2"| VarInt
 +
  | Number of elements in the following array
 
  |-
 
  |-
  | <code>minecraft.interact_with_brewingstand</code>
+
  |rowspan="3"| Statistic
  | 33
+
| Category ID
  | None
+
|rowspan="3"| Array
 +
  | VarInt
 +
  | See below
 
  |-
 
  |-
  | <code>minecraft.interact_with_beacon</code>
+
  | Statistic ID
  | 34
+
  | VarInt
  | None
+
  | See below
 
  |-
 
  |-
  | <code>minecraft.inspect_dropper</code>
+
  | Value
  | 35
+
| VarInt
  | None
+
| The amount to set it to
 +
|}
 +
 
 +
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 +
 
 +
{| class="wikitable"
 +
! Name
 +
  ! ID
 +
  ! Registry
 
  |-
 
  |-
  | <code>minecraft.inspect_hopper</code>
+
  | <code>minecraft.mined</code>
  | 36
+
  | 0
  | None
+
  | Blocks
 
  |-
 
  |-
  | <code>minecraft.inspect_dispenser</code>
+
  | <code>minecraft.crafted</code>
  | 37
+
  | 1
  | None
+
  | Items
 
  |-
 
  |-
  | <code>minecraft.play_noteblock</code>
+
  | <code>minecraft.used</code>
  | 38
+
  | 2
  | None
+
  | Items
 
  |-
 
  |-
  | <code>minecraft.tune_noteblock</code>
+
  | <code>minecraft.broken</code>
  | 39
+
  | 3
  | None
+
  | Items
 
  |-
 
  |-
  | <code>minecraft.pot_flower</code>
+
  | <code>minecraft.picked_up</code>
  | 40
+
  | 4
  | None
+
  | Items
 
  |-
 
  |-
  | <code>minecraft.trigger_trapped_chest</code>
+
  | <code>minecraft.dropped</code>
  | 41
+
  | 5
  | None
+
  | Items
 
  |-
 
  |-
  | <code>minecraft.open_enderchest</code>
+
  | <code>minecraft.killed</code>
  | 42
+
  | 6
  | None
+
  | Entities
 
  |-
 
  |-
  | <code>minecraft.enchant_item</code>
+
  | <code>minecraft.killed_by</code>
  | 43
+
  | 7
  | None
+
  | Entities
 
  |-
 
  |-
  | <code>minecraft.play_record</code>
+
  | <code>minecraft.custom</code>
  | 44
+
  | 8
  | None
+
  | Custom
 +
|}
 +
 
 +
Blocks, Items, and Entities use block (not block state), item, and entity ids.
 +
 
 +
Custom has the following (unit only matters for clients):
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! ID
 +
! Unit
 
  |-
 
  |-
  | <code>minecraft.interact_with_furnace</code>
+
  | <code>minecraft.leave_game</code>
  | 45
+
  | 0
 
  | None
 
  | None
 
  |-
 
  |-
  | <code>minecraft.interact_with_crafting_table</code>
+
  | <code>minecraft.play_one_minute</code>
  | 46
+
  | 1
  | None
+
  | Time
 
  |-
 
  |-
  | <code>minecraft.open_chest</code>
+
  | <code>minecraft.time_since_death</code>
  | 47
+
  | 2
  | None
+
  | Time
 
  |-
 
  |-
  | <code>minecraft.sleep_in_bed</code>
+
  | <code>minecraft.sneak_Time</code>
  | 48
+
  | 3
  | None
+
  | Time
 
  |-
 
  |-
  | <code>minecraft.open_shulker_box</code>
+
  | <code>minecraft.walk_one_cm</code>
  | 49
+
  | 4
  | None
+
  | Distance
|}
 
 
 
Units:
 
 
 
* None: just a normal number (formatted with 0 decimal places)
 
* Damage: value is 10 times the normal amount
 
* Distance: a distance in centimeters (hundredths of blocks)
 
* Time: a time span in ticks
 
 
 
==== Block Break Animation ====
 
 
 
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 
 
 
Block break animations can still be applied on air; the animation will remain visible although there is no block being broken.  However, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency.  (An effect similar to this can be seen in normal gameplay when breaking ice blocks)
 
 
 
If you need to display several break animations at the same time you have to give each of them a unique Entity ID. The entity ID does not need to correspond to an actual entity on the client. It is valid to use a randomly generated number.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x08
+
  | <code>minecraft.crouch_one_cm</code>
|rowspan="3"| Play
+
  | 5
|rowspan="3"| Client
+
  | Distance
| Entity ID
 
  | VarInt
 
  | Entity ID of the entity breaking the block
 
 
  |-
 
  |-
  | Location
+
  | <code>minecraft.sprint_one_cm</code>
  | Position
+
  | 6
  | Block Position
+
  | Distance
 
  |-
 
  |-
  | Destroy Stage
+
  | <code>minecraft.swim_one_cm</code>
  | Byte
+
  | 7
  | 0–9 to set it, any other value to remove it
+
  | Distance
  |}
+
  |-
 
+
| <code>minecraft.fall_one_cm</code>
==== Update Block Entity ====
+
| 8
 
+
| Distance
Sets the block entity associated with the block at the given location.
+
|-
 
+
| <code>minecraft.climb_one_cm</code>
{| class="wikitable"
+
  | 9
  ! Packet ID
+
  | Distance
  ! State
+
  |-
  ! Bound To
+
  | <code>minecraft.fly_one_cm</code>
  ! Field Name
+
  | 10
  ! Field Type
+
  | Distance
  ! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x09
+
  | <code>minecraft.dive_one_cm</code>
|rowspan="3"| Play
+
  | 11
|rowspan="3"| Client
+
  | Distance
| Location
 
  | Position
 
  |  
 
 
  |-
 
  |-
  | Action
+
  | <code>minecraft.minecart_one_cm</code>
  | Unsigned Byte
+
  | 12
  | The type of update to perform, see below
+
  | Distance
 
  |-
 
  |-
  | NBT Data
+
  | <code>minecraft.boat_one_cm</code>
  | [[NBT|NBT Tag]]
+
  | 13
  | Data to set.  May be a TAG_END (0), in which case the block entity at the given location is removed (though this is not required since the client will remove the block entity automatically on chunk unload or block removal)
+
  | Distance
  |}
+
  |-
 
+
| <code>minecraft.pig_one_cm</code>
''Action'' field:
+
  | 14
 
+
  | Distance
* '''1''': Set data of a mob spawner (everything except for SpawnPotentials: current delay, min/max delay, mob to be spawned, spawn count, spawn range, etc.)
 
* '''2''': Set command block text (command and last execution status)
 
* '''3''': Set the level, primary, and secondary powers of a beacon
 
* '''4''': Set rotation and skin of mob head
 
* '''5''': Declare a conduit
 
* '''6''': Set base color and patterns on a banner
 
* '''7''': Set the data for a Structure tile entity
 
* '''8''': Set the destination for a end gateway
 
* '''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?
 
* '''11''': Declare a bed
 
 
 
==== Block Action ====
 
 
 
This packet is used for a number of actions and animations performed by blocks, usually non-persistent.
 
 
 
See [[Block Actions]] for a list of values.
 
 
 
{{Warning2|This packet uses a block ID, not a block state. Unfortunately, block IDs are not directly included in the output from [[Data Generators]], but can manually be calculated.}}
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x0A
+
  | <code>minecraft.horse_one_cm</code>
|rowspan="4"| Play
+
  | 15
|rowspan="4"| Client
+
  | Distance
| Location
 
  | Position
 
  | Block coordinates
 
 
  |-
 
  |-
  | Action ID (Byte 1)
+
  | <code>minecraft.aviate_one_cm</code>
  | Unsigned Byte
+
  | 16
  | Varies depending on block — see [[Block Actions]]
+
  | Distance
 
  |-
 
  |-
  | Action Param (Byte 2)
+
  | <code>minecraft.jump</code>
  | Unsigned Byte
+
  | 17
  | Varies depending on block — see [[Block Actions]]
+
  | None
 
  |-
 
  |-
  | Block Type
+
  | <code>minecraft.drop</code>
| VarInt
+
  | 18
| The block type ID for the block.  This must match the block at the given coordinates.
+
  | None
  |}
 
 
 
==== Block Change ====
 
 
 
Fired whenever a block is changed within the render distance.
 
 
 
{{Warning2|Changing a block in a chunk that is not loaded is not a stable action.  The Notchian client currently uses a ''shared'' empty chunk which is modified for all block changes in unloaded chunks; while in 1.9 this chunk never renders in older versions the changed block will appear in all copies of the empty chunk. Servers should avoid sending block changes in unloaded chunks and clients should ignore such packets.}}
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x0B
+
  | <code>minecraft.damage_dealt</code>
|rowspan="2"| Play
+
  | 19
|rowspan="2"| Client
+
  | Damage
| Location
 
  | Position
 
  | Block Coordinates
 
 
  |-
 
  |-
  | Block ID
+
  | <code>minecraft.damage_taken</code>
| VarInt
+
  | 20
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
+
  | Damage
  |}
 
 
 
==== Boss Bar ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
  !colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="14"| 0x0C
+
  | <code>minecraft.deaths</code>
|rowspan="14"| Play
+
  | 21
|rowspan="14"| Client
+
  | None
|colspan="2"| UUID
 
  | UUID
 
  | Unique ID for this bar
 
 
  |-
 
  |-
  |colspan="2"| Action
+
  | <code>minecraft.mob_kills</code>
  | VarInt Enum
+
  | 22
  | Determines the layout of the remaining packet
+
  | None
 
  |-
 
  |-
  ! Action
+
  | <code>minecraft.animals_bred</code>
  ! Field Name
+
  | 23
  !
+
  | None
!
 
 
  |-
 
  |-
  |rowspan="5"| 0: add
+
  | <code>minecraft.player_kills</code>
| Title
+
  | 24
  | [[Chat]]
+
  | None
  |  
 
 
  |-
 
  |-
  | Health
+
  | <code>minecraft.fish_caught</code>
  | Float
+
  | 25
  | From 0 to 1. Values greater than 1 do not crash a Notchian client, and start [https://i.johni0702.de/nA.png rendering part of a second health bar] at around 1.5.
+
  | None
 
  |-
 
  |-
  | Color
+
  | <code>minecraft.talked_to_villager</code>
  | VarInt Enum
+
  | 26
  | Color ID (see below)
+
  | None
 
  |-
 
  |-
  | Division
+
  | <code>minecraft.traded_with_villager</code>
  | VarInt Enum
+
  | 27
  | Type of division (see below)
+
  | None
 
  |-
 
  |-
  | Flags
+
  | <code>minecraft.eat_cake_slice</code>
  | Unsigned Byte
+
  | 28
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02)
+
  | None
 
  |-
 
  |-
  | 1: remove
+
  | <code>minecraft.fill_cauldron</code>
  | ''no fields''
+
  | 29
  | ''no fields''
+
  | None
| Removes this boss bar
 
 
  |-
 
  |-
  | 2: update health
+
  | <code>minecraft.use_cauldron</code>
  | Health
+
  | 30
  | Float
+
  | None
| as above
 
 
  |-
 
  |-
  | 3: update title
+
  | <code>minecraft.clean_armor</code>
  | Title
+
  | 31
| [[Chat]]
+
  | None
  |  
 
 
  |-
 
  |-
  |rowspan="2"| 4: update style
+
  | <code>minecraft.clean_banner</code>
| Color
+
  | 32
  | VarInt Enum
+
  | None
  | Color ID (see below)
 
 
  |-
 
  |-
  | Dividers
+
  | <code>minecraft.interact_with_brewingstand</code>
  | VarInt Enum
+
  | 33
  | as above
+
  | None
 
  |-
 
  |-
  | 5: update flags
+
  | <code>minecraft.interact_with_beacon</code>
  | Flags
+
  | 34
  | Unsigned Byte
+
  | None
| as above
 
 
  |-
 
  |-
  |}
+
  | <code>minecraft.inspect_dropper</code>
 
+
| 35
{| class="wikitable"
+
  | None
  ! ID
 
! Color
 
 
  |-
 
  |-
  | 0
+
  | <code>minecraft.inspect_hopper</code>
  | Pink
+
  | 36
 +
| None
 
  |-
 
  |-
  | 1
+
  | <code>minecraft.inspect_dispenser</code>
  | Blue
+
  | 37
 +
| None
 
  |-
 
  |-
  | 2
+
  | <code>minecraft.play_noteblock</code>
  | Red
+
  | 38
 +
| None
 
  |-
 
  |-
  | 3
+
  | <code>minecraft.tune_noteblock</code>
  | Green
+
  | 39
 +
| None
 +
|-
 +
| <code>minecraft.pot_flower</code>
 +
| 40
 +
| None
 
  |-
 
  |-
  | 4
+
  | <code>minecraft.trigger_trapped_chest</code>
  | Yellow
+
  | 41
 +
| None
 
  |-
 
  |-
  | 5
+
  | <code>minecraft.open_enderchest</code>
  | Purple
+
  | 42
 +
| None
 
  |-
 
  |-
  | 6
+
  | <code>minecraft.enchant_item</code>
  | White
+
  | 43
  |}
+
  | None
 
 
{| class="wikitable"
 
! ID
 
! Type of division
 
 
  |-
 
  |-
  | 0
+
  | <code>minecraft.play_record</code>
  | No division
+
  | 44
 +
| None
 
  |-
 
  |-
  | 1
+
  | <code>minecraft.interact_with_furnace</code>
  | 6 notches
+
  | 45
 +
| None
 
  |-
 
  |-
  | 2
+
  | <code>minecraft.interact_with_crafting_table</code>
  | 10 notches
+
  | 46
 +
| None
 
  |-
 
  |-
  | 3
+
  | <code>minecraft.open_chest</code>
  | 12 notches
+
  | 47
 +
| None
 
  |-
 
  |-
  | 4
+
  | <code>minecraft.sleep_in_bed</code>
  | 20 notches
+
  | 48
  |}
+
| None
 
+
|-
==== Server Difficulty ====
+
| <code>minecraft.open_shulker_box</code>
 +
| 49
 +
| None
 +
  |}
 +
 
 +
Units:
  
Changes the difficulty setting in the client's option menu
+
* None: just a normal number (formatted with 0 decimal places)
 +
* Damage: value is 10 times the normal amount
 +
* Distance: a distance in centimeters (hundredths of blocks)
 +
* Time: a time span in ticks
 +
 
 +
==== Acknowledge Player Digging ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,296: Line 1,336:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x0D
+
  |rowspan="4"| 0x08
  |rowspan="1"| Play
+
  |rowspan="4"| Play
  |rowspan="1"| Client
+
  |rowspan="4"| Client
  | Difficulty
+
  | Location
  | Unsigned Byte
+
| Position
  | 0: peaceful, 1: easy, 2: normal, 3: hard
+
| Position where the digging was happening
 +
|-
 +
| Block
 +
| VarInt
 +
| Block state ID of the block that should be at that position now.
 +
|-
 +
  | Status
 +
  | VarInt enum
 +
| Same as Player Digging.  Only Started digging (0), Cancelled digging (1), and Finished digging (2) are used.
 +
|-
 +
| Successful
 +
| Boolean
 +
| True if the digging succeeded; false if the client should undo any changes it made locally.  (How does this work?)
 
  |}
 
  |}
  
==== Chat Message (clientbound) ====  
+
==== Block Break Animation ====
 +
 
 +
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
  
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility optionsSee [[Chat#Processing chat|processing chat]] for more info about these positions.
+
Block break animations can still be applied on air; the animation will remain visible although there is no block being brokenHowever, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency. (An effect similar to this can be seen in normal gameplay when breaking ice blocks)
  
{{warning2|Game info accepts json formatting but does not display it, although the deprecated §-based formatting works. This is not an issue when using the [[#Title|Title]] packet, so prefer that packet for displaying information in that slot. See [https://bugs.mojang.com/browse/MC-119145 MC-119145] for more information.}}
+
If you need to display several break animations at the same time you have to give each of them a unique Entity ID. The entity ID does not need to correspond to an actual entity on the client. It is valid to use a randomly generated number.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,318: Line 1,372:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0E
+
  |rowspan="3"| 0x09
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | JSON Data
+
  | Entity ID
  | [[Chat]]
+
  | VarInt
  | Limited to 32767 bytes
+
  | Entity ID of the entity breaking the block
 
  |-
 
  |-
 +
| Location
 
  | Position
 
  | Position
 +
| Block Position
 +
|-
 +
| Destroy Stage
 
  | Byte
 
  | Byte
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
+
  | 0–9 to set it, any other value to remove it
 
  |}
 
  |}
  
==== Multi Block Change ====
+
==== Block Entity Data ====
  
Fired whenever 2 or more blocks are changed within the same chunk on the same tick.
+
Sets the block entity associated with the block at the given location.
 
 
{{Warning|Changing blocks in chunks not loaded by the client is unsafe (see note on [[#Block Change|Block Change]]).}}
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,340: Line 1,396:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x0F
+
  |rowspan="3"| 0x0A
  |rowspan="6"| Play
+
  |rowspan="3"| Play
  |rowspan="6"| Client
+
  |rowspan="3"| Client
  |colspan="2"| Chunk X
+
  | Location
  |colspan="2"| Int
+
  | Position
  | Chunk X coordinate
+
  |  
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  | Action
|colspan="2"| Int
 
| Chunk Z coordinate
 
|-
 
|colspan="2"| Record Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array, i.e. the number of blocks affected
 
|-
 
|rowspan="3"| Record
 
| Horizontal Position
 
|rowspan="3"| Array
 
 
  | Unsigned Byte
 
  | Unsigned Byte
  | The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
+
  | The type of update to perform, see below
 
  |-
 
  |-
  | Y Coordinate
+
  | NBT Data
  | Unsigned Byte
+
  | [[NBT|NBT Tag]]
| Y coordinate of the block
+
  | Data to set. May be a TAG_END (0), in which case the block entity at the given location is removed (though this is not required since the client will remove the block entity automatically on chunk unload or block removal)
  |-
 
  | Block ID
 
| VarInt
 
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
 
 
  |}
 
  |}
  
To decode the position into a world position:
+
''Action'' field:
  
<syntaxhighlight lang="java">
+
* '''1''': Set data of a mob spawner (everything except for SpawnPotentials: current delay, min/max delay, mob to be spawned, spawn count, spawn range, etc.)
worldX = (horizPos >> 4 & 15) + (chunkX * 16);
+
* '''2''': Set command block text (command and last execution status)
worldY = vertPos;
+
* '''3''': Set the level, primary, and secondary powers of a beacon
worldZ = (horizPos & 15) + (chunkZ * 16);
+
* '''4''': Set rotation and skin of mob head
</syntaxhighlight>
+
* '''5''': Declare a conduit
 +
* '''6''': Set base color and patterns on a banner
 +
* '''7''': Set the data for a Structure tile entity
 +
* '''8''': Set the destination for a end gateway
 +
* '''9''': Set the text on a sign
 +
* '''10''': Unused
 +
* '''11''': Declare a bed
 +
* '''12''': Set data of a jigsaw block
 +
* '''13''': Set items in a campfire
 +
* '''14''': Behive information
 +
 
 +
==== Block Action ====
 +
 
 +
This packet is used for a number of actions and animations performed by blocks, usually non-persistent.
  
==== Tab-Complete (clientbound) ====
+
See [[Block Actions]] for a list of values.
  
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported. The client sorts these alphabetically before listing them.
+
{{Warning2|This packet uses a block ID, not a block state. Unfortunately, block IDs are not directly included in the output from [[Data Generators]], but can manually be calculated.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,390: Line 1,445:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x10
+
  |rowspan="4"| 0x0B
  |rowspan="8"| Play
+
  |rowspan="4"| Play
  |rowspan="8"| Client
+
  |rowspan="4"| Client
 +
| Location
 +
| Position
 +
| Block coordinates
 
  |-
 
  |-
  |colspan="2"| ID
+
  | Action ID (Byte 1)
  |colspan="2"| VarInt
+
  | Unsigned Byte
  | Transaction ID
+
  | Varies depending on block — see [[Block Actions]]
 
  |-
 
  |-
  |colspan="2"| Start
+
  | Action Param (Byte 2)
  |colspan="2"| VarInt
+
  | Unsigned Byte
  | Start of the text to replace
+
  | Varies depending on block — see [[Block Actions]]
 
  |-
 
  |-
  |colspan="2"| Length
+
  | Block Type
  |colspan="2"| VarInt
+
  | VarInt
  | Length of the text to replace
+
  | The block type ID for the block. This must match the block at the given coordinates.
  |-
+
  |}
|colspan="2"| Count
+
 
|colspan="2"| VarInt
+
==== Block Change ====
| Number of elements in the following array
 
|-
 
|rowspan="3"| Matches
 
| Match
 
|rowspan="3"| Array
 
| String (32767)
 
| One eligible value to insert, note that each command is sent separately instead of in a single string, hence the need for Count.  Note that for instance this doesn't include a leading <code>/</code> on commands.
 
  |-
 
| Has tooltip
 
| Boolean
 
| True if the following is present
 
|-
 
| Tooltip
 
| Optional [[Chat]]
 
| Tooltip to display; only present if previous boolean is true
 
|}
 
  
==== Declare Commands ====
+
Fired whenever a block is changed within the render distance.
  
Lists all of the commands on the server, and how they are parsed.
+
{{Warning2|Changing a block in a chunk that is not loaded is not a stable action.  The Notchian client currently uses a ''shared'' empty chunk which is modified for all block changes in unloaded chunks; while in 1.9 this chunk never renders in older versions the changed block will appear in all copies of the empty chunkServers should avoid sending block changes in unloaded chunks and clients should ignore such packets.}}
 
 
This is a directed graph, with one root nodeEach redirect or child node must refer only to nodes that have already been declared.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,443: Line 1,483:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x11
+
  |rowspan="2"| 0x0C
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Count
+
  | Location
  | VarInt
+
  | Position
  | Number of elements in the following array
+
  | Block Coordinates
 
  |-
 
  |-
  | Nodes
+
  | Block ID
| Array of [[Command Data|Node]]
 
| An array of nodes
 
|-
 
| Root index
 
 
  | VarInt
 
  | VarInt
  | Index of the <code>root</code> node in the previous array
+
  | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
 
  |}
 
  |}
  
For more information on this packet, see the [[Command Data]] article.
+
==== Boss Bar ====  
 
 
==== Confirm Transaction (clientbound) ====
 
 
 
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag).  If the packet was not accepted, the client must respond with a [[#Confirm Transaction (serverbound)|serverbound confirm transaction]] packet.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,469: Line 1,501:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x12
+
  |rowspan="14"| 0x0D
  |rowspan="3"| Play
+
  |rowspan="14"| Play
  |rowspan="3"| Client
+
  |rowspan="14"| Client
  | Window ID
+
  |colspan="2"| UUID
  | Byte
+
  | UUID
  | The ID of the window that the action occurred in
+
  | Unique ID for this bar
 
  |-
 
  |-
  | Action Number
+
  |colspan="2"| Action
  | Short
+
  | VarInt Enum
  | Every action that is to be accepted has a unique number. This number is an incrementing integer (starting at 0) with separate counts for each window ID.
+
  | Determines the layout of the remaining packet
 
  |-
 
  |-
| Accepted
+
  ! Action
| Boolean
 
| Whether the action was accepted
 
|}
 
 
 
==== Close Window (clientbound) ====
 
 
 
This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
 
  ! Field Name
 
  ! Field Name
  ! Field Type
+
  !  
  ! Notes
+
  !  
 +
|-
 +
|rowspan="5"| 0: add
 +
| Title
 +
| [[Chat]]
 +
|
 +
|-
 +
| Health
 +
| Float
 +
| From 0 to 1. Values greater than 1 do not crash a Notchian client, and start [https://i.johni0702.de/nA.png rendering part of a second health bar] at around 1.5.
 +
|-
 +
| Color
 +
| VarInt Enum
 +
| Color ID (see below)
 +
|-
 +
| Division
 +
| VarInt Enum
 +
| Type of division (see below)
 
  |-
 
  |-
  | 0x13
+
  | Flags
| Play
 
| Client
 
| Window ID
 
 
  | Unsigned Byte
 
  | Unsigned Byte
  | This is the ID of the window that was closed. 0 for inventory.
+
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02)
|}
 
 
 
==== 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
+
  | 1: remove
  |rowspan="5"| Play
+
  | ''no fields''
  |rowspan="5"| Client
+
  | ''no fields''
  | Window ID
+
  | Removes this boss bar
| Unsigned Byte
 
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
 
  |-
 
  |-
  | Window Type
+
  | 2: update health
  | String (32)
+
  | Health
  | The window type to use for display. See [[Inventory]] for a list.
+
  | Float
 +
| as above
 
  |-
 
  |-
  | Window Title
+
  | 3: update title
 +
| Title
 
  | [[Chat]]
 
  | [[Chat]]
  | The title of the window
+
  |  
 +
|-
 +
|rowspan="2"| 4: update style
 +
| Color
 +
| VarInt Enum
 +
| Color ID (see below)
 +
|-
 +
| Dividers
 +
| VarInt Enum
 +
| as above
 
  |-
 
  |-
  | Number Of Slots
+
  | 5: update flags
 +
| Flags
 
  | Unsigned Byte
 
  | 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).
+
  | as above
 
  |-
 
  |-
| Entity ID
 
| Optional Int
 
| EntityHorse's EID. Only sent when Window Type is “EntityHorse”
 
 
  |}
 
  |}
 
See [[Inventory]] for further information.
 
 
==== Window Items ====
 
[[File:Inventory-slots.png|thumb|The inventory slots]]
 
 
Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Color
  ! Bound To
+
  |-
  ! Field Name
+
| 0
  ! Field Type
+
| Pink
  ! Notes
+
|-
 +
| 1
 +
| Blue
 +
|-
 +
| 2
 +
| Red
 +
  |-
 +
  | 3
 +
  | Green
 
  |-
 
  |-
  |rowspan="3"| 0x15
+
  | 4
|rowspan="3"| Play
+
  | Yellow
|rowspan="3"| Client
 
| Window ID
 
| Unsigned Byte
 
  | The ID of window which items are being sent for. 0 for player inventory.
 
 
  |-
 
  |-
  | Count
+
  | 5
  | Short
+
  | Purple
| Number of elements in the following array
 
 
  |-
 
  |-
  | Slot Data
+
  | 6
| Array of [[Slot Data|Slot]]
+
  | White
  |  
 
 
  |}
 
  |}
 
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 
 
==== Window Property ====
 
 
This packet is used to inform the client that part of a GUI window should be updated.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Type of division
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x16
+
  | 0
  |rowspan="3"| Play
+
| No division
  |rowspan="3"| Client
+
  |-
  | Window ID
+
| 1
  | Unsigned Byte
+
  | 6 notches
  |  
+
  |-
 +
  | 2
 +
  | 10 notches
 
  |-
 
  |-
  | Property
+
  | 3
  | Short
+
  | 12 notches
| The property to be updated, see below
 
 
  |-
 
  |-
  | Value
+
  | 4
  | Short
+
  | 20 notches
| The new value for the property, see below
 
 
  |}
 
  |}
  
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
+
==== Server Difficulty ====
 +
 
 +
Changes the difficulty setting in the client's option menu
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Window type
+
  |rowspan="2"| 0x0E
  ! Property
+
  |rowspan="2"| Play
  ! Value
+
  |rowspan="2"| Client
 +
| Difficulty
 +
| Unsigned Byte
 +
| 0: peaceful, 1: easy, 2: normal, 3: hard
 
  |-
 
  |-
  |rowspan="4"| Furnace
+
  | Difficulty locked?
  | 0: Fire icon (fuel left)
+
| Boolean
  | counting from fuel burn time down to 0 (in-game ticks)
+
  |
  |-
+
  |}
  | 1: Maximum fuel burn time
+
 
  | fuel burn time or 0 (in-game ticks)
+
==== Chat Message (clientbound) ====
 +
 
 +
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options. See [[Chat#Processing chat|processing chat]] for more info about these positions.
 +
 
 +
{{warning2|Game info accepts json formatting but does not display it, although the deprecated §-based formatting works. This is not an issue when using the [[#Title|Title]] packet, so prefer that packet for displaying information in that slot.  See [https://bugs.mojang.com/browse/MC-119145 MC-119145] for more information.}}
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 2: Progress arrow
+
  |rowspan="2"| 0x0F
  | counting from 0 to maximum progress (in-game ticks)
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| JSON Data
 +
| [[Chat]]
 +
  | Limited to 32767 bytes
 
  |-
 
  |-
  | 3: Maximum progress
+
  | Position
  | always 200 on the notchian server
+
| Byte
 +
| 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
 +
  |}
 +
 
 +
==== Multi Block Change ====
 +
 
 +
Fired whenever 2 or more blocks are changed within the same chunk on the same tick.
 +
 
 +
{{Warning|Changing blocks in chunks not loaded by the client is unsafe (see note on [[#Block Change|Block Change]]).}}
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 
  |-
 
  |-
  |rowspan="10"| Enchantment Table
+
  |rowspan="6"| 0x10
  | 0: Level requirement for top enchantment slot
+
  |rowspan="6"| Play
  |rowspan="3"| The enchantment's xp level requirement
+
  |rowspan="6"| Client
 +
|colspan="2"| Chunk X
 +
|colspan="2"| Int
 +
| Chunk X coordinate
 
  |-
 
  |-
  | 1: Level requirement for middle enchantment slot
+
  |colspan="2"| Chunk Z
 +
|colspan="2"| Int
 +
| Chunk Z coordinate
 
  |-
 
  |-
  | 2: Level requirement for bottom enchantment slot
+
  |colspan="2"| Record Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array, i.e. the number of blocks affected
 
  |-
 
  |-
  | 3: The enchantment seed
+
  |rowspan="3"| Record
  | Used for drawing the enchantment names (in [[Wikipedia:Standard Galactic Alphabet|SGA]]) clientside. The same seed ''is'' used to calculate enchantments, but some of the data isn't sent to the client to prevent easily guessing the entire list (the seed value here is the regular seed bitwise and <code>0xFFFFFFF0</code>).
+
| Horizontal Position
 +
  |rowspan="3"| Array
 +
| Unsigned Byte
 +
  | The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
 
  |-
 
  |-
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
+
  | Y Coordinate
  |rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
+
  | Unsigned Byte
 +
| Y coordinate of the block
 
  |-
 
  |-
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
+
  | Block ID
 +
| VarInt
 +
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
 +
|}
 +
 
 +
To decode the position into a world position:
 +
 
 +
<syntaxhighlight lang="java">
 +
worldX = (horizPos >> 4 & 15) + (chunkX * 16);
 +
worldY = vertPos;
 +
worldZ = (horizPos & 15) + (chunkZ * 16);
 +
</syntaxhighlight>
 +
 
 +
==== Tab-Complete (clientbound) ====
 +
 
 +
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported. The client sorts these alphabetically before listing them.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 
  |-
 
  |-
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
+
  |rowspan="8"| 0x11
 +
|rowspan="8"| Play
 +
|rowspan="8"| Client
 
  |-
 
  |-
  | 7: Enchantment level shown on mouse hover over the top slot
+
  |colspan="2"| ID
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
+
  |colspan="2"| VarInt
 +
| Transaction ID
 
  |-
 
  |-
  | 8: Enchantment level shown on mouse hover over the middle slot
+
  |colspan="2"| Start
 +
|colspan="2"| VarInt
 +
| Start of the text to replace
 
  |-
 
  |-
  | 9: Enchantment level shown on mouse hover over the bottom slot
+
  |colspan="2"| Length
 +
|colspan="2"| VarInt
 +
| Length of the text to replace
 
  |-
 
  |-
  |rowspan="3"| Beacon
+
  |colspan="2"| Count
  | 0: Power level
+
  |colspan="2"| VarInt
  | 0-4, controls what effect buttons are enabled
+
  | Number of elements in the following array
 
  |-
 
  |-
  | 1: First potion effect
+
  |rowspan="3"| Matches
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
+
| Match
 +
  |rowspan="3"| Array
 +
| String (32767)
 +
| One eligible value to insert, note that each command is sent separately instead of in a single string, hence the need for Count.  Note that for instance this doesn't include a leading <code>/</code> on commands.
 
  |-
 
  |-
  | 2: Second potion effect
+
  | Has tooltip
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
+
  | Boolean
 +
| True if the following is present
 
  |-
 
  |-
  | Anvil
+
  | Tooltip
  | 0: Repair cost
+
  | Optional [[Chat]]
  | The repair's cost in xp levels
+
  | Tooltip to display; only present if previous boolean is true
|-
 
|rowspan="2"| Brewing Stand
 
| 0: Brew time
 
| 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
|-
 
| 1: Fuel time
 
| 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
 
 
  |}
 
  |}
  
For an enchanting table, the following numerical IDs are used:
+
==== Declare Commands ====
 +
 
 +
Lists all of the commands on the server, and how they are parsed.
 +
 
 +
This is a directed graph, with one root node.  Each redirect or child node must refer only to nodes that have already been declared.
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Numerical ID
+
  ! Packet ID
  ! Enchantment ID
+
  ! State
  ! Enchantment Name
+
! Bound To
 +
  ! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 0
+
  |rowspan="3"| 0x12
  | minecraft:protection
+
|rowspan="3"| Play
  | Protection
+
|rowspan="3"| Client
 +
| Count
 +
  | VarInt
 +
  | Number of elements in the following array
 
  |-
 
  |-
  | 1
+
  | Nodes
  | minecraft:fire_protection
+
  | Array of [[Command Data|Node]]
  | Fire Protection
+
  | An array of nodes
 
  |-
 
  |-
  | 2
+
  | Root index
  | minecraft:feather_falling
+
  | VarInt
  | Feather Falling
+
  | Index of the <code>root</code> node in the previous array
 +
|}
 +
 
 +
For more information on this packet, see the [[Command Data]] article.
 +
 
 +
==== Window Confirmation (clientbound) ====
 +
 
 +
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag).  If the packet was not accepted, the client must respond with a [[#Window Confirmation (serverbound)|serverbound window confirmation]] packet.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 3
+
  |rowspan="3"| 0x13
  | minecraft:blast_protection
+
|rowspan="3"| Play
  | Blast Protection
+
|rowspan="3"| Client
 +
| Window ID
 +
  | Byte
 +
  | The ID of the window that the action occurred in
 
  |-
 
  |-
  | 4
+
  | Action Number
  | minecraft:projectile_protection
+
  | Short
  | Projectile Protection
+
  | Every action that is to be accepted has a unique number. This number is an incrementing integer (starting at 0) with separate counts for each window ID.
 
  |-
 
  |-
  | 5
+
  | Accepted
  | minecraft:respiration
+
  | Boolean
  | Respiration
+
  | Whether the action was accepted
  |-
+
  |}
  | 6
+
 
  | minecraft:aqua_affinity
+
==== Close Window (clientbound) ====
  | Aqua Affinity
+
 
 +
This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | 7
+
  | 0x14
  | minecraft:thorns
+
  | Play
  | Thorns
+
| Client
 +
| Window ID
 +
| Unsigned Byte
 +
| This is the ID of the window that was closed. 0 for inventory.
 +
|}
 +
 
 +
==== Window Items ====
 +
[[File:Inventory-slots.png|thumb|The inventory slots]]
 +
 
 +
Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 8
+
  |rowspan="3"| 0x15
  | minecraft:depth_strider
+
|rowspan="3"| Play
  | Depth Strider
+
|rowspan="3"| Client
 +
| Window ID
 +
  | Unsigned Byte
 +
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  | 9
+
  | Count
  | minecraft:frost_walker
+
  | Short
  | Frost Walker
+
  | Number of elements in the following array
 
  |-
 
  |-
  | 10
+
  | Slot Data
  | minecraft:binding_curse
+
  | Array of [[Slot Data|Slot]]
  | Curse of Binding
+
  |  
 +
|}
 +
 
 +
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 +
 
 +
==== Window Property ====
 +
 
 +
This packet is used to inform the client that part of a GUI window should be updated.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 11
+
  |rowspan="3"| 0x16
  | minecraft:sharpness
+
|rowspan="3"| Play
  | Sharpness
+
|rowspan="3"| Client
 +
| Window ID
 +
  | Unsigned Byte
 +
  |  
 
  |-
 
  |-
  | 12
+
  | Property
  | minecraft:smite
+
  | Short
  | Smite
+
  | The property to be updated, see below
 
  |-
 
  |-
  | 13
+
  | Value
  | minecraft:bane_of_arthropods
+
  | Short
  | Bane of Arthropods
+
  | The new value for the property, see below
 +
|}
 +
 
 +
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  | 14
+
  ! Window type
  | minecraft:knockback
+
  ! Property
  | Knockback
+
  ! Value
 
  |-
 
  |-
  | 15
+
  |rowspan="4"| Furnace
  | minecraft:fire_aspect
+
  | 0: Fire icon (fuel left)
  | Fire Aspect
+
  | counting from fuel burn time down to 0 (in-game ticks)
 
  |-
 
  |-
  | 16
+
  | 1: Maximum fuel burn time
| minecraft:looting
+
  | fuel burn time or 0 (in-game ticks)
  | Looting
 
 
  |-
 
  |-
  | 17
+
  | 2: Progress arrow
| minecraft:sweeping
+
  | counting from 0 to maximum progress (in-game ticks)
  | Sweeping Edge
 
 
  |-
 
  |-
  | 18
+
  | 3: Maximum progress
| minecraft:efficiency
+
  | always 200 on the notchian server
  | Efficiency
 
 
  |-
 
  |-
  | 19
+
  |rowspan="10"| Enchantment Table
  | minecraft:silk_touch
+
  | 0: Level requirement for top enchantment slot
  | Silk Touch
+
  |rowspan="3"| The enchantment's xp level requirement
 
  |-
 
  |-
  | 20
+
  | 1: Level requirement for middle enchantment slot
| minecraft:unbreaking
 
| Unbreaking
 
 
  |-
 
  |-
  | 21
+
  | 2: Level requirement for bottom enchantment slot
| minecraft:fortune
 
| Fortune
 
 
  |-
 
  |-
  | 22
+
  | 3: The enchantment seed
  | minecraft:power
+
  | Used for drawing the enchantment names (in [[Wikipedia:Standard Galactic Alphabet|SGA]]) clientside. The same seed ''is'' used to calculate enchantments, but some of the data isn't sent to the client to prevent easily guessing the entire list (the seed value here is the regular seed bitwise and <code>0xFFFFFFF0</code>).
  | Power
 
 
  |-
 
  |-
  | 23
+
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
  | minecraft:punch
+
  |rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
| Punch
 
 
  |-
 
  |-
  | 24
+
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
| minecraft:flame
 
| Flame
 
 
  |-
 
  |-
  | 25
+
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
| minecraft:infinity
 
| Infinity
 
 
  |-
 
  |-
  | 26
+
  | 7: Enchantment level shown on mouse hover over the top slot
  | minecraft:luck_of_the_sea
+
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
| Luck of the Sea
 
 
  |-
 
  |-
  | 27
+
  | 8: Enchantment level shown on mouse hover over the middle slot
  | minecraft:lure
+
|-
  | Lure
+
  | 9: Enchantment level shown on mouse hover over the bottom slot
 +
|-
 +
|rowspan="3"| Beacon
 +
  | 0: Power level
 +
| 0-4, controls what effect buttons are enabled
 +
|-
 +
| 1: First potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
 
  |-
 
  |-
  | 28
+
  | 2: Second potion effect
  | minecraft:loyalty
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
| Loyalty
 
 
  |-
 
  |-
  | 29
+
  | Anvil
  | minecraft:impaling
+
  | 0: Repair cost
  | Impaling
+
  | The repair's cost in xp levels
 
  |-
 
  |-
  | 30
+
  |rowspan="2"| Brewing Stand
  | minecraft:riptide
+
  | 0: Brew time
  | Riptide
+
  | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
  |-
 
  |-
  | 31
+
  | 1: Fuel time
| minecraft:channeling
+
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
  | Channeling
 
 
  |-
 
  |-
  | 32
+
  | Stonecutter
  | minecraft:mending
+
  | 0: Selected recipe
  | Mending
+
  | The index of the selected recipe. -1 means none is selected.
 
  |-
 
  |-
  | 33
+
  | Loom
  | minecraft:vanishing_curse
+
  | 0: Selected pattern
  | Curse of Vanishing
+
  | The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern.
 
  |}
 
  |}
  
==== Set Slot ====
+
For an enchanting table, the following numerical IDs are used:
 
 
Sent by the server when an item in a slot (in a window) is added/removed.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Numerical ID
  ! State
+
  ! Enchantment ID
  ! Bound To
+
  ! Enchantment Name
  ! Field Name
+
|-
  ! Field Type
+
  | 0
  ! Notes
+
  | minecraft:protection
 +
  | Protection
 
  |-
 
  |-
  |rowspan="3"| 0x17
+
  | 1
|rowspan="3"| Play
+
  | minecraft:fire_protection
|rowspan="3"| Client
+
  | Fire Protection
| Window ID
 
  | Byte
 
  | The window which is being updated. 0 for player inventory. Note that all known window types include the player inventory. This packet will only be sent for the currently opened window while the player is performing actions, even if it affects the player inventory. After the window is closed, a number of these packets are sent to update the player's inventory window (0).
 
 
  |-
 
  |-
  | Slot
+
  | 2
  | Short
+
  | minecraft:feather_falling
  | The slot that should be updated
+
  | Feather Falling
 
  |-
 
  |-
  | Slot Data
+
  | 3
  | [[Slot Data|Slot]]
+
  | minecraft:blast_protection
|
+
  | Blast Protection
|}
 
 
 
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
 
 
 
This packet can only be used to edit the hotbar of the player's inventory if window ID is set to 0 (slots 36 through 44).  If the window ID is set to -2, then any slot in the inventory can be used but no add item animation will be played.
 
 
 
==== Set Cooldown ====
 
 
 
Applies a cooldown period to all items with the given type.  Used by the Notchian server with enderpearls. This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing).
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x18
+
  | 4
|rowspan="2"| Play
+
  | minecraft:projectile_protection
|rowspan="2"| Client
+
  | Projectile Protection
| Item ID
 
  | VarInt
 
  | Numeric ID of the item to apply a cooldown to.
 
 
  |-
 
  |-
  | Cooldown Ticks
+
  | 5
  | VarInt
+
  | minecraft:respiration
| Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
+
| Respiration
|}
 
 
 
==== Plugin Message (clientbound) ====
 
 
 
{{Main|Plugin channels}}
 
 
 
Mods and plugins can use this to send their data. Minecraft itself uses several [[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/]
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x19
+
  | 6
|rowspan="2"| Play
+
  | minecraft:aqua_affinity
|rowspan="2"| Client
+
  | Aqua Affinity
| Channel
 
  | Identifier
 
  | Name of the [[plugin channel]] used to send the data
 
 
  |-
 
  |-
  | Data
+
  | 7
  | Byte Array
+
  | minecraft:thorns
| 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.
+
  | Thorns
  |}
 
 
 
==== Named Sound Effect ====
 
{{See also|#Sound Effect}}
 
 
 
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x1A
+
  | 8
  |rowspan="7"| Play
+
| minecraft:depth_strider
  |rowspan="7"| Client
+
| Depth Strider
  | Sound Name
+
|-
  | Identifier
+
  | 9
  | All sound effect names as of 1.13.2 can be seen [https://pokechu22.github.io/Burger/1.13.2.html#sounds here].
+
| minecraft:frost_walker
 +
  | Frost Walker
 +
|-
 +
  | 10
 +
  | minecraft:binding_curse
 +
  | Curse of Binding
 
  |-
 
  |-
  | Sound Category
+
  | 11
  | VarInt Enum
+
  | minecraft:sharpness
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
+
  | Sharpness
 
  |-
 
  |-
  | Effect Position X
+
  | 12
  | Int
+
  | minecraft:smite
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | Smite
 
  |-
 
  |-
  | Effect Position Y
+
  | 13
  | Int
+
  | minecraft:bane_of_arthropods
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | Bane of Arthropods
 
  |-
 
  |-
  | Effect Position Z
+
  | 14
  | Int
+
  | minecraft:knockback
  | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | Knockback
 
  |-
 
  |-
  | Volume
+
  | 15
  | Float
+
  | minecraft:fire_aspect
  | 1 is 100%, can be more
+
  | Fire Aspect
 
  |-
 
  |-
  | Pitch
+
  | 16
  | Float
+
  | minecraft:looting
  | Float between 0.5 and 2.0 by Notchian clients
+
  | Looting
  |}
+
  |-
 
+
| 17
==== Disconnect (play) ====
+
  | minecraft:sweeping
 
+
  | Sweeping Edge
Sent by the server before it disconnects a client. The client assumes that the server has already closed the connection by the time the packet arrives.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  | 0x1B
+
  | 18
  | Play
+
  | minecraft:efficiency
  | Client
+
  | Efficiency
| Reason
 
| [[Chat]]
 
| Displayed to the client when the connection terminates.
 
|}
 
 
 
==== Entity Status ====
 
 
 
Entity statuses generally trigger an animation for an entity.  The available statuses vary by the entity's type (and are available to subclasses of that type as well).
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x1C
+
  | 19
|rowspan="2"| Play
+
  | minecraft:silk_touch
|rowspan="2"| Client
+
  | Silk Touch
| Entity ID
 
  | Int
 
  |  
 
 
  |-
 
  |-
  | Entity Status
+
  | 20
  | Byte Enum
+
  | minecraft:unbreaking
  | See below
+
  | Unbreaking
|}
 
 
 
See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
 
 
 
==== NBT Query Response ====
 
 
 
Sent in response to [[#Query Block NBT|Query Block NBT]] or [[#Query Entity NBT|Query Entity NBT]].
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x1D
+
  | 21
|rowspan="2"| Play
+
  | minecraft:fortune
|rowspan="2"| Client
+
  | Fortune
| Transaction ID
 
  | VarInt
 
  | Can be compared to the one sent in the original query packet.
 
 
  |-
 
  |-
  | NBT
+
  | 22
  | [[NBT|NBT Tag]]
+
  | minecraft:power
  | The NBT of the block or entity.  May be a TAG_END (0) in which case no NBT is present.
+
  | Power
|}
 
 
 
==== 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
+
  | 23
|rowspan="9"| Play
+
  | minecraft:punch
|rowspan="9"| Client
+
  | Punch
| X
 
  | Float
 
  |  
 
 
  |-
 
  |-
  | Y
+
  | 24
  | Float
+
  | minecraft:flame
  |  
+
  | Flame
 +
|-
 +
| 25
 +
| minecraft:infinity
 +
| Infinity
 +
|-
 +
| 26
 +
| minecraft:luck_of_the_sea
 +
| Luck of the Sea
 
  |-
 
  |-
  | Z
+
  | 27
  | Float
+
  | minecraft:lure
  |  
+
  | Lure
 
  |-
 
  |-
  | Radius
+
  | 28
  | Float
+
  | minecraft:loyalty
  | Currently unused in the client
+
  | Loyalty
 
  |-
 
  |-
  | Record Count
+
  | 29
  | Int
+
  | minecraft:impaling
  | Number of elements in the following array
+
  | Impaling
 
  |-
 
  |-
  | Records
+
  | 30
  | Array of (Byte, Byte, Byte)
+
  | minecraft:riptide
  | Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
+
  | Riptide
 
  |-
 
  |-
  | Player Motion X
+
  | 31
  | Float
+
  | minecraft:channeling
  | X velocity of the player being pushed by the explosion
+
  | Channeling
 
  |-
 
  |-
  | Player Motion Y
+
  | 32
  | Float
+
  | minecraft:mending
  | Y velocity of the player being pushed by the explosion
+
  | Mending
 
  |-
 
  |-
  | Player Motion Z
+
  | 33
  | Float
+
  | minecraft:vanishing_curse
  | Z velocity of the player being pushed by the explosion
+
  | Curse of Vanishing
 
  |}
 
  |}
  
==== Unload Chunk ====
+
==== Set Slot ====
  
Tells the client to unload a chunk column.
+
Sent by the server when an item in a slot (in a window) is added/removed.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,083: Line 2,139:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1F
+
  |rowspan="3"| 0x17
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Chunk X
+
  | Window ID
  | Int
+
  | Byte
  | Block coordinate divided by 16, rounded down
+
  | The window which is being updated. 0 for player inventory. Note that all known window types include the player inventory. This packet will only be sent for the currently opened window while the player is performing actions, even if it affects the player inventory. After the window is closed, a number of these packets are sent to update the player's inventory window (0).
 +
|-
 +
| Slot
 +
| Short
 +
| The slot that should be updated
 
  |-
 
  |-
  | Chunk Z
+
  | Slot Data
  | Int
+
  | [[Slot Data|Slot]]
  | Block coordinate divided by 16, rounded down
+
  |  
 
  |}
 
  |}
  
It is legal to send this packet even if the given chunk is not currently loaded.
+
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
 +
 
 +
This packet can only be used to edit the hotbar of the player's inventory if window ID is set to 0 (slots 36 through 44).  If the window ID is set to -2, then any slot in the inventory can be used but no add item animation will be played.
  
==== Change Game State ====
+
==== Set Cooldown ====
  
Used for a wide variety of game state things, from whether to bed use to gamemode to demo messages.
+
Applies a cooldown period to all items with the given type.  Used by the Notchian server with enderpearls.  This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,109: Line 2,171:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x20
+
  |rowspan="2"| 0x18
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Reason
+
  | Item ID
  | Unsigned Byte
+
  | VarInt
  | See below
+
  | Numeric ID of the item to apply a cooldown to.
 
  |-
 
  |-
  | Value
+
  | Cooldown Ticks
  | Float
+
  | VarInt
  | Depends on Reason
+
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
 
  |}
 
  |}
  
''Reason codes'':
+
==== Plugin Message (clientbound) ====
 
+
 
{| class="wikitable"
+
{{Main|Plugin channels}}
! Reason
+
 
! Effect
+
Mods and plugins can use this to send their data. Minecraft itself uses several [[plugin channel]]s. These internal channels are in the <code>minecraft</code> namespace.
! Value
+
 
|-
+
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/]
| 0
 
| Invalid Bed
 
| Would be used to switch between messages, but the only used message is 0 for invalid bed
 
|-
 
| 1
 
| End raining
 
|
 
|-
 
| 2
 
| Begin raining
 
|
 
|-
 
| 3
 
| Change gamemode
 
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 
|-
 
| 4
 
| Exit end
 
| 0: Immediately send Client Status of respawn without showing end credits; 1: Show end credits and respawn at the end (or when esc is pressed). 1 is sent if the player has not yet received the "The end?" advancement, while if they do have it 0 is used.
 
|-
 
| 5
 
| Demo message
 
| 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
 
|-
 
| 6
 
| Arrow hitting player
 
| Appears to be played when an arrow strikes another player in Multiplayer
 
|-
 
| 7
 
| Fade value
 
| The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
 
|-
 
| 8
 
| Fade time
 
| Time in ticks for the sky to fade
 
|-
 
| 9
 
| Play pufferfish sting sound
 
|-
 
| 10
 
| Play elder guardian mob appearance (effect and sound)
 
|
 
|}
 
 
 
==== Keep Alive (clientbound) ====
 
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
 
 
 
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,186: Line 2,199:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x21
+
  |rowspan="2"| 0x19
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Keep Alive ID
+
  | Channel
  | Long
+
  | Identifier
  |  
+
  | Name of the [[plugin channel]] used to send the data
 +
|-
 +
| Data
 +
| Byte Array
 +
| 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.
 
  |}
 
  |}
  
==== Chunk Data ====
+
==== Named Sound Effect ====
{{Main|Chunk Format}}
+
{{See also|#Sound Effect}}
{{See also|#Unload Chunk}}
 
  
The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which dimenison the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent. This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with [[#Update Block Entity|Update Block Entity]] later).
+
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,208: Line 2,224:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x22
+
  |rowspan="7"| 0x1A
  |rowspan="8"| Play
+
  |rowspan="7"| Play
  |rowspan="8"| Client
+
  |rowspan="7"| Client
  | Chunk X
+
  | Sound Name
 +
| Identifier
 +
| All sound effect names as of 1.15.2 can be seen [https://pokechu22.github.io/Burger/1.15.2.html#sounds here].
 +
|-
 +
| Sound Category
 +
| VarInt Enum
 +
| The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 +
|-
 +
| Effect Position X
 
  | Int
 
  | Int
  | Chunk coordinate (block coordinate divided by 16, rounded down)
+
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | Chunk Z
+
  | Effect Position Y
 
  | Int
 
  | Int
  | Chunk coordinate (block coordinate divided by 16, rounded down)
+
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | Full chunk
+
  | Effect Position Z
  | Boolean
+
  | Int
  | See [[Chunk Format#Full chunk|Chunk Format]]
+
  | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | Primary Bit Mask
+
  | Volume
  | VarInt
+
  | Float
  | 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).
+
  | 1 is 100%, can be more
|-
 
| Size
 
| VarInt
 
| Size of Data in bytes
 
 
  |-
 
  |-
  | Data
+
  | Pitch
  | Byte array
+
  | Float
  | See [[Chunk Format#Data structure|data structure]] in Chunk Format
+
  | Float between 0.5 and 2.0 by Notchian clients
|-
 
| Number of block entities
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Block entities
 
| Array of [[NBT|NBT Tag]]
 
| All block entities in the chunk. Use the x, y, and z tags in the NBT to determine their positions.
 
 
  |}
 
  |}
  
==== Effect ====
+
==== Disconnect (play) ====
  
Sent when a client is to play a sound or particle effect.
+
Sent by the server before it disconnects a client. The client assumes that the server has already closed the connection by the time the packet arrives.
 
 
By default, the Minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1023 (wither spawn) and effect 1028 (enderdragon death); it is ignored on other effects.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,258: Line 2,268:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x23
+
  | 0x1B
  |rowspan="4"| Play
+
  | Play
  |rowspan="4"| Client
+
  | Client
  | Effect ID
+
  | Reason
  | Int
+
  | [[Chat]]
  | The ID of the effect, see below
+
  | Displayed to the client when the connection terminates.
|-
 
| Location
 
| Position
 
| The location of the effect
 
|-
 
| Data
 
| Int
 
| Extra data for certain effects, see below
 
|-
 
| Disable Relative Volume
 
| Boolean
 
| See above
 
 
  |}
 
  |}
  
Effect IDs:
+
==== Entity Status ====
 +
 
 +
Entity statuses generally trigger an animation for an entity.  The available statuses vary by the entity's type (and are available to subclasses of that type as well).
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! ID
+
  ! Packet ID
  ! Name
+
  ! State
  ! Data
+
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
! Notes
 
  |-
 
  |-
  !colspan="3"| Sound
+
  |rowspan="2"| 0x1C
  |-
+
|rowspan="2"| Play
  | 1000
+
  |rowspan="2"| Client
  | Dispenser dispenses
+
  | Entity ID
 +
  | Int
 
  |  
 
  |  
 
  |-
 
  |-
  | 1001
+
  | Entity Status
  | Dispenser fails to dispense
+
  | Byte Enum
  |
+
| See below
 +
|}
 +
 
 +
See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
 +
 
 +
==== 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
 
  |-
 
  |-
  | 1002
+
  |rowspan="9"| 0x1D
  | Dispenser shoots
+
|rowspan="9"| Play
 +
|rowspan="9"| Client
 +
| X
 +
  | Float
 
  |  
 
  |  
 
  |-
 
  |-
  | 1003
+
  | Y
  | Ender eye launched
+
  | Float
 
  |  
 
  |  
 
  |-
 
  |-
  | 1004
+
  | Z
  | Firework shot
+
  | Float
 
  |  
 
  |  
 
  |-
 
  |-
  | 1005
+
  | Strength
  | Iron door opened
+
  | Float
  |  
+
  | A strength greater than or equal to 2.0 spawns a <code>minecraft:explosion_emitter</code> particle, while a lesser strength spawns a <code>minecraft:explosion</code> particle.
 
  |-
 
  |-
  | 1006
+
  | Record Count
  | Wooden door opened
+
  | Int
  |  
+
  | Number of elements in the following array
 
  |-
 
  |-
  | 1007
+
  | Records
  | Wooden trapdoor opened
+
  | Array of (Byte, Byte, Byte)
  |  
+
  | Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
 
  |-
 
  |-
  | 1008
+
  | Player Motion X
  | Fence gate opened
+
  | Float
  |  
+
  | X velocity of the player being pushed by the explosion
 
  |-
 
  |-
  | 1009
+
  | Player Motion Y
  | Fire extinguished
+
  | Float
  |  
+
  | Y velocity of the player being pushed by the explosion
 
  |-
 
  |-
  | 1010
+
  | Player Motion Z
  | Play record
+
  | Float
  | Special case, see below for more info
+
  | Z velocity of the player being pushed by the explosion
 +
|}
 +
 
 +
==== Unload Chunk ====
 +
 
 +
Tells the client to unload a chunk column.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1011
+
  |rowspan="2"| 0x1E
  | Iron door closed
+
|rowspan="2"| Play
  |  
+
|rowspan="2"| Client
 +
| Chunk X
 +
  | Int
 +
  | Block coordinate divided by 16, rounded down
 
  |-
 
  |-
  | 1012
+
  | Chunk Z
  | Wooden door closed
+
  | Int
  |  
+
  | Block coordinate divided by 16, rounded down
 +
|}
 +
 
 +
It is legal to send this packet even if the given chunk is not currently loaded.
 +
 
 +
==== Change Game State ====
 +
 
 +
Used for a wide variety of game state things, from whether to bed use to gamemode to demo messages.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1013
+
  |rowspan="2"| 0x1F
  | Wooden trapdoor closed
+
|rowspan="2"| Play
  |  
+
|rowspan="2"| Client
 +
| Reason
 +
  | Unsigned Byte
 +
  | See below
 
  |-
 
  |-
  | 1014
+
  | Value
  | Fence gate closed
+
  | Float
  |  
+
  | Depends on Reason
 +
|}
 +
 
 +
''Reason codes'':
 +
 
 +
{| class="wikitable"
 +
! Reason
 +
! Effect
 +
! Value
 
  |-
 
  |-
  | 1015
+
  | 0
  | Ghast warns
+
  | No respawn block available
  |  
+
  | Note: Sends message 'block.minecraft.spawn.not_valid'(You have no home bed or charged respawn anchor, or it was obstructed) to the client.
 
  |-
 
  |-
  | 1016
+
  | 1
  | Ghast shoots
+
  | End raining
 
  |  
 
  |  
 
  |-
 
  |-
  | 1017
+
  | 2
  | Enderdragon shoots
+
  | Begin raining
 
  |  
 
  |  
 
  |-
 
  |-
  | 1018
+
  | 3
  | Blaze shoots
+
  | Change gamemode
  |  
+
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 +
|-
 +
| 4
 +
| Win game
 +
| 0: Just respawn player. <br>1: Roll the credits and respawn player. <br> Note that 1 is only sent by notchian server when player has not yet achieved advancement "The end?", else 0 is sent.
 
  |-
 
  |-
  | 1019
+
  | 5
  | Zombie attacks wood door
+
  | Demo event
  |  
+
  | 0: Show welcome to demo screen<br> 101: Tell movement controls<br> 102: Tell jump control<br> 103: Tell inventory control<br> 104: Tell that the demo is over and print a message about how to take a screenshot
 +
|-
 +
| 6
 +
| Arrow hit player
 +
| Note: Sent when any player is struck by an arrow.
 
  |-
 
  |-
  | 1020
+
  | 7
  | Zombie attacks iron door
+
  | Rain level change
  |  
+
  | Note: Seems to change both skycolor and lightning. <strong>[https://imgur.com/a/K6wSrkW You can see some level images here]</strong><br>This can cause [https://imgur.com/gallery/ZQX0Wd5 <strong>HUD color change in client</strong>], when level is higher than 20. It goes away only when game is restarted or client receives same packet (from any server) but with value of 0. Is this a bug?<br><br>Rain level starting from 0.
 
  |-
 
  |-
  | 1021
+
  | 8
  | Zombie breaks wood door
+
  | Thunder level change
  |
+
  | Note: Seems to change both skycolor and lightning (same as Rain level change, but doesn't start rain). It also requires rain to render by notchian client. ()<br>This can cause [https://imgur.com/gallery/ZQX0Wd5 <strong>HUD color change in client</strong>], when level is higher than 20. It goes away only when game is restarted or client receives same packet (from any server) but with value of 0. Is this a bug?<br><br>Thunder level starting from 0.
 
  |-
 
  |-
  | 1022
+
  | 9
| Wither breaks block
+
  | Play pufferfish sting sound
  |
 
 
  |-
 
  |-
  | 1023
+
  | 10
  | Wither spawned
+
  | Play elder guardian mob appearance (effect and sound)
 
  |  
 
  |  
 
  |-
 
  |-
  | 1024
+
  | 11
  | Wither shoots
+
  | Enable respawn screen
 +
|  0: Enable respawn screen, 1: Immediately respawn (sent when the doImmediateRespawn gamerule changes)
 +
|}
 +
 
 +
==== 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"| 0x20
 +
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Window ID?
 +
| Byte
 
  |
 
  |
 
  |-
 
  |-
  | 1025
+
  | Number of slots?
  | Bat takes off
+
  | VarInt
 
  |
 
  |
 
  |-
 
  |-
  | 1026
+
  | Entity ID?
  | Zombie infects
+
  | Integer
|
 
|-
 
| 1027
 
| Zombie villager converted
 
 
  |
 
  |
 +
|}
 +
 +
==== Keep Alive (clientbound) ====
 +
 +
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
 +
 +
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
 +
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1028
+
  |rowspan="1"| 0x21
  | Ender dragon death
+
  |rowspan="1"| Play
  |
+
  |rowspan="1"| Client
|-
+
  | Keep Alive ID
  | 1029
+
  | Long
  | Anvil destroyed
 
 
  |  
 
  |  
 +
|}
 +
 +
==== Chunk Data ====
 +
{{Main|Chunk Format}}
 +
{{See also|#Unload Chunk}}
 +
 +
{{Need Info|How do biomes work now?  The biome change happened at the same time as the seed change, but it's not clear how/if biomes could be computed given that it's not the actual seed...  ([https://www.reddit.com/r/Mojira/comments/e5at6i/a_discussion_for_the_changes_to_how_biomes_are/ /r/mojira discussion] which notes that it seems to be some kind of interpolation, and 3D biomes are only used in the nether)}}
 +
 +
The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which dimenison the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent.  This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with [[#Update Block Entity|Update Block Entity]] later).
 +
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1030
+
  |rowspan="10"| 0x22
  | Anvil used
+
|rowspan="10"| Play
  |  
+
|rowspan="10"| Client
 +
| Chunk X
 +
  | Int
 +
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | 1031
+
  | Chunk Z
  | Anvil landed
+
  | Int
  |
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | 1032
+
  | Full chunk
  | Portal travel
+
  | Boolean
  |  
+
  | See [[Chunk Format#Full chunk|Chunk Format]]
 
  |-
 
  |-
  | 1033
+
  | Primary Bit Mask
  | Chorus flower grown
+
  | 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).
 
  |-
 
  |-
  | 1034
+
  | Heightmaps
  | Chorus flower died
+
  | [[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.
 
  |-
 
  |-
  | 1035
+
  | Biomes
  | Brewing stand brewed
+
  | Optional array of Integer
  |
+
  | 1024 biome IDs, ordered by x then z then y, in 4&times;4&times;4 blocks.  Not present if full chunk is false.
 +
|-
 +
| Size
 +
| VarInt
 +
| Size of Data in bytes
 
  |-
 
  |-
  | 1036
+
  | Data
  | Iron trapdoor opened
+
  | Byte array
  |  
+
  | See [[Chunk Format#Data structure|data structure]] in Chunk Format
 
  |-
 
  |-
  | 1037
+
  | Number of block entities
  | Iron trapdoor closed
+
  | VarInt
  |
+
  | Number of elements in the following array
 
  |-
 
  |-
  !colspan="3"| Particle
+
| Block entities
  |-
+
| Array of [[NBT|NBT Tag]]
  | 2000
+
| All block entities in the chunk.  Use the x, y, and z tags in the NBT to determine their positions.
  | Spawns 10 smoke particles, e.g. from a fire
+
|}
  | Direction, see below
+
 
  |-
+
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.
  | 2001
+
 
  | Block break + block break sound
+
==== Effect ====
  | Block state, as an index into the global palette
+
Sent when a client is to play a sound or particle effect.
 +
 
 +
By default, the Minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1023 (wither spawn), effect 1028 (enderdragon death), and effect 1038 (end portal opening); it is ignored on other effects.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
  ! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="4"| 0x23
 +
|rowspan="4"| Play
 +
|rowspan="4"| Client
 +
| Effect ID
 +
| Int
 +
| The ID of the effect, see below
 +
|-
 +
| Location
 +
| Position
 +
| The location of the effect
 +
  |-
 +
  | Data
 +
  | Int
 +
  | Extra data for certain effects, see below
 +
  |-
 +
  | Disable Relative Volume
 +
| Boolean
 +
  | See above
 +
  |}
 +
 
 +
Effect IDs:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Name
 +
! Data
 
  |-
 
  |-
  | 2002
+
  !colspan="3"| Sound
| Splash potion. Particle effect + glass break sound.
 
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
 
  |-
 
  |-
  | 2003
+
  | 1000
  | Eye of Ender entity break animation — particles and sound
+
  | Dispenser dispenses
 
  |  
 
  |  
 
  |-
 
  |-
  | 2004
+
  | 1001
  | Mob spawn particle effect: smoke + flames
+
  | Dispenser fails to dispense
 
  |  
 
  |  
 
  |-
 
  |-
  | 2005
+
  | 1002
  | Bonemeal particles
+
  | Dispenser shoots
  | How many particles to spawn (if set to 0, 15 are spawned)
+
  |  
 
  |-
 
  |-
  | 2006
+
  | 1003
  | Dragon breath
+
  | Ender eye launched
  |
+
  |  
 
  |-
 
  |-
  | 2007
+
  | 1004
  | Instant splash potion
+
  | Firework shot
  | [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
+
  |  
 
  |-
 
  |-
  | 3000
+
  | 1005
  | End gateway spawn
+
  | Iron door opened
 
  |  
 
  |  
 
  |-
 
  |-
  | 3001
+
  | 1006
  | Enderdragon growl
+
  | Wooden door opened
  |
+
  |  
|}
 
 
 
Smoke directions:
 
 
 
{| class="wikitable"
 
! ID
 
! Direction
 
 
  |-
 
  |-
  | 0
+
  | 1007
  | South-East
+
| Wooden trapdoor opened
 +
  |  
 
  |-
 
  |-
  | 1
+
  | 1008
  | South
+
| Fence gate opened
 +
  |  
 
  |-
 
  |-
  | 2
+
  | 1009
  | South-West
+
| Fire extinguished
 +
  |  
 
  |-
 
  |-
  | 3
+
  | 1010
  | East
+
  | Play record
 +
| Special case, see below for more info
 
  |-
 
  |-
  | 4
+
  | 1011
  | (Up or middle ?)
+
| Iron door closed
 +
  |  
 
  |-
 
  |-
  | 5
+
  | 1012
  | West
+
| Wooden door closed
 +
  |  
 
  |-
 
  |-
  | 6
+
  | 1013
  | North-East
+
| Wooden trapdoor closed
 +
  |  
 
  |-
 
  |-
  | 7
+
  | 1014
  | North
+
| Fence gate closed
 +
  |  
 
  |-
 
  |-
  | 8
+
  | 1015
  | North-West
+
  | Ghast warns
  |}
+
  |  
 
 
Play record: This is actually a special case within this packet. You can start/stop a record at a specific location. Use a valid {{Minecraft Wiki|Music Discs|Record ID}} to start a record (or overwrite a currently playing one), any other value will stop the record.  See [[Data Generators]] for information on item IDs.
 
 
 
==== Particle ====
 
 
 
Displays the named particle
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="11"| 0x24
+
  | 1016
  |rowspan="11"| Play
+
  | Ghast shoots
  |rowspan="11"| Client
+
  |  
| Particle ID
 
| Int
 
| The particle ID listed in [[#Particle|the particle data type]].
 
 
  |-
 
  |-
  | Long Distance
+
  | 1017
  | Boolean
+
  | Enderdragon shoots
  | If true, particle distance increases from 256 to 65536
+
  |  
 
  |-
 
  |-
  | X
+
  | 1018
  | Float
+
  | Blaze shoots
  | X position of the particle
+
  |  
 
  |-
 
  |-
  | Y
+
  | 1019
  | Float
+
  | Zombie attacks wood door
  | Y position of the particle
+
  |  
 
  |-
 
  |-
  | Z
+
  | 1020
  | Float
+
  | Zombie attacks iron door
  | Z position of the particle
+
  |  
 
  |-
 
  |-
  | Offset X
+
  | 1021
  | Float
+
  | Zombie breaks wood door
  | This is added to the X position after being multiplied by random.nextGaussian()
+
  |
 
  |-
 
  |-
  | Offset Y
+
  | 1022
  | Float
+
  | Wither breaks block
  | This is added to the Y position after being multiplied by random.nextGaussian()
+
  |
 
  |-
 
  |-
  | Offset Z
+
  | 1023
  | Float
+
  | Wither spawned
  | This is added to the Z position after being multiplied by random.nextGaussian()
+
  |  
 
  |-
 
  |-
  | Particle Data
+
  | 1024
  | Float
+
  | Wither shoots
  | The data of each particle
+
  |
 
  |-
 
  |-
  | Particle Count
+
  | 1025
  | Int
+
  | Bat takes off
  | The number of particles to create
+
  |
 
  |-
 
  |-
  | Data
+
  | 1026
  | Varies
+
  | Zombie infects
  | The variable data listed in [[#Particle|the particle data type]].
+
  |
|}
 
 
 
==== Join Game ====
 
 
 
See [[Protocol Encryption]] for information on logging in.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x25
+
  | 1027
|rowspan="7"| Play
+
  | Zombie villager converted
|rowspan="7"| Client
+
  |
| Entity ID
 
  | Int
 
  | The player's Entity ID (EID)
 
 
  |-
 
  |-
  | Gamemode
+
  | 1028
  | Unsigned Byte
+
  | Ender dragon death
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
+
  |
 
  |-
 
  |-
  | Dimension
+
  | 1029
  | Int Enum
+
  | Anvil destroyed
  | -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
+
  |  
 
  |-
 
  |-
  | Difficulty
+
  | 1030
  | Unsigned Byte
+
  | Anvil used
  | 0: peaceful, 1: easy, 2: normal, 3: hard
+
  |  
 
  |-
 
  |-
  | Max Players
+
  | 1031
  | Unsigned Byte
+
  | Anvil landed
  | Was once used by the client to draw the player list, but now is ignored
+
  |
 
  |-
 
  |-
  | Level Type
+
  | 1032
  | String Enum (16)
+
  | Portal travel
  | default, flat, largeBiomes, amplified, default_1_1
+
  |  
 
  |-
 
  |-
  | Reduced Debug Info
+
  | 1033
  | Boolean
+
  | Chorus flower grown
  | If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}.  For servers in development, this should almost always be false.
+
  |
|}
 
 
 
==== Map Data ====
 
 
 
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
!colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="16"| 0x26
+
  | 1034
|rowspan="16"| Play
+
  | Chorus flower died
|rowspan="16"| Client
+
  |  
  |colspan="2"| Map ID
 
|colspan="2"| VarInt
 
  | Map ID of the map being modified
 
 
  |-
 
  |-
  |colspan="2"| Scale
+
  | 1035
|colspan="2"| Byte
+
  | Brewing stand brewed
| From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
+
  |
|-
 
|colspan="2"| Tracking Position
 
|colspan="2"| Boolean
 
| Specifies whether player and item frame icons are shown
 
  |-
 
|colspan="2"| Icon Count
 
|colspan="2"| VarInt
 
  | Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="5"| Icon
+
  | 1036
| Type
+
  | Iron trapdoor opened
|rowspan="6"| Array
+
  |  
  | VarInt enum
 
  | See below
 
 
  |-
 
  |-
  | X
+
  | 1037
  | Byte
+
  | Iron trapdoor closed
  | Map coordinates: -128 for furthest left, +127 for furthest right
+
  |
 
  |-
 
  |-
  | Z
+
  | 1038
  | Byte
+
  | End portal created in overworld
  | Map coordinates: -128 for highest, +127 for lowest
+
  |
 
  |-
 
  |-
  | Direction
+
  | 1039
  | Byte
+
  | Phantom bites
  | 0-15
+
  |
 
  |-
 
  |-
  | Has Display Name
+
  | 1040
  | Boolean
+
  | Zombie converts to drowned
 
  |
 
  |
 
  |-
 
  |-
  | Display Name
+
  | 1041
  | Optional [[Chat]]
+
  | Husk converts to zombie by drowning
  | Only present if previous Boolean is true
+
  |
|-
 
|colspan="2"| Columns
 
|colspan="2"| Byte
 
| Number of columns updated
 
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | 1042
  |colspan="2"| Optional Byte
+
  | Grindstone used
  | Only if Columns is more than 0; number of rows updated
+
  |
 
  |-
 
  |-
  |colspan="2"| X
+
  | 1043
  |colspan="2"| Optional Byte
+
  | Book page turned
  | Only if Columns is more than 0; x offset of the westernmost column
+
  |
 
  |-
 
  |-
|colspan="2"| Z
 
|colspan="2"| Optional Byte
 
| Only if Columns is more than 0; z offset of the northernmost row
 
 
  |-
 
  |-
  |colspan="2"| Length
+
  !colspan="3"| Particle
|colspan="2"| Optional VarInt
 
| Only if Columns is more than 0; length of the following array
 
 
  |-
 
  |-
  |colspan="2"| Data
+
  | 1500
  |colspan="2"| Optional Array of Unsigned Byte
+
  | Composter composts
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
+
  |
|}
 
 
 
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
 
 
 
Types are based off of rows and columns in <code>map_icons.png</code>:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Icon type
+
  | 1501
  ! Result
+
  | Lava converts block (either water to stone, or removes existing blocks such as torches)
 +
|
 
  |-
 
  |-
  | 0
+
  | 1502
  | White arrow (players)
+
| Redstone torch burns out
 +
|
 +
|-
 +
| 1503
 +
| Ender eye placed
 +
  |
 
  |-
 
  |-
  | 1
+
  | 2000
  | Green arrow (item frames)
+
  | Spawns 10 smoke particles, e.g. from a fire
 +
| Direction, see below
 
  |-
 
  |-
  | 2
+
  | 2001
  | Red arrow
+
  | Block break + block break sound
 +
| Block state, as an index into the global palette
 
  |-
 
  |-
  | 3
+
  | 2002
  | Blue arrow
+
  | Splash potion. Particle effect + glass break sound.
 +
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
  |-
 
  |-
  | 4
+
  | 2003
  | White cross
+
| Eye of Ender entity break animation — particles and sound
 +
  |  
 
  |-
 
  |-
  | 5
+
  | 2004
  | Red pointer
+
| Mob spawn particle effect: smoke + flames
 +
  |  
 
  |-
 
  |-
  | 6
+
  | 2005
  | White circle (off-map players)
+
  | Bonemeal particles
 +
| How many particles to spawn (if set to 0, 15 are spawned)
 
  |-
 
  |-
  | 7
+
  | 2006
  | Small white circle (far-off-map players)
+
| Dragon breath
 +
  |
 
  |-
 
  |-
  | 8
+
  | 2007
  | Mansion
+
  | Instant splash potion
 +
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
  |-
 
  |-
  | 9
+
  | 2008
  | Temple
+
| Ender dragon destroys block
 +
  |
 
  |-
 
  |-
  | 10
+
  | 2009
  | White Banner
+
| Wet sponge vaporizes in nether
 +
  |
 
  |-
 
  |-
  | 11
+
  | 3000
  | Orange Banner
+
| End gateway spawn
 +
  |  
 
  |-
 
  |-
  | 12
+
  | 3001
  | Magenta Banner
+
  | Enderdragon growl
 +
|
 +
|}
 +
 
 +
Smoke directions:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Direction
 
  |-
 
  |-
  | 13
+
  | 0
  | Light Blue Banner
+
  | South-East
 
  |-
 
  |-
  | 14
+
  | 1
  | Yellow Banner
+
  | South
 
  |-
 
  |-
  | 15
+
  | 2
  | Lime Banner
+
  | South-West
 
  |-
 
  |-
  | 16
+
  | 3
  | Pink Banner
+
  | East
 
  |-
 
  |-
  | 17
+
  | 4
  | Gray Banner
+
  | (Up or middle ?)
 
  |-
 
  |-
  | 18
+
  | 5
  | Light Gray Banner
+
  | West
 
  |-
 
  |-
  | 19
+
  | 6
  | Cyan Banner
+
  | North-East
 
  |-
 
  |-
  | 20
+
  | 7
  | Purple Banner
+
  | North
 
  |-
 
  |-
  | 21
+
  | 8
| Blue Banner
+
  | North-West
  |-
+
  |}
  | 22
+
 
| Brown Banner
+
Play record: This is actually a special case within this packet. You can start/stop a record at a specific location. Use a valid {{Minecraft Wiki|Music Discs|Record ID}} to start a record (or overwrite a currently playing one), any other value will stop the record. See [[Data Generators]] for information on item IDs.
|-
+
 
| 23
+
==== Particle ====
| Green Banner
 
|-
 
| 24
 
| Red Banner
 
|-
 
  | 25
 
| Black Banner
 
|-
 
| 26
 
| Treasure marker
 
|}
 
  
==== Entity ====
+
Displays the named particle
 
 
This packet may be used to initialize an entity.
 
 
 
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,809: Line 2,907:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x27
+
  |rowspan="11"| 0x24
  |rowspan="1"| Play
+
  |rowspan="11"| Play
  |rowspan="1"| Client
+
  |rowspan="11"| Client
  | Entity ID
+
  | Particle ID
  | VarInt
+
  | Int
  |  
+
  | The particle ID listed in [[#Particle|the particle data type]].
|}
 
 
 
==== 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
+
  | Long Distance
|rowspan="5"| Play
+
  | Boolean
|rowspan="5"| Client
+
  | If true, particle distance increases from 256 to 65536
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Delta X
+
  | X
  | Short
+
  | Double
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
  | X position of the particle
 +
|-
 +
| Y
 +
| Double
 +
| Y position of the particle
 +
|-
 +
| Z
 +
| Double
 +
| Z position of the particle
 +
|-
 +
| Offset X
 +
| Float
 +
| This is added to the X position after being multiplied by random.nextGaussian()
 +
|-
 +
| Offset Y
 +
| Float
 +
| This is added to the Y position after being multiplied by random.nextGaussian()
 +
|-
 +
| Offset Z
 +
| Float
 +
| This is added to the Z position after being multiplied by random.nextGaussian()
 
  |-
 
  |-
  | Delta Y
+
  | Particle Data
  | Short
+
  | Float
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
  | The data of each particle
 
  |-
 
  |-
  | Delta Z
+
  | Particle Count
  | Short
+
  | Int
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
+
  | The number of particles to create
 
  |-
 
  |-
  | On Ground
+
  | Data
  | Boolean
+
  | Varies
  |  
+
  | The variable data listed in [[#Particle|the particle data type]].
 
  |}
 
  |}
  
==== Entity Look And Relative Move ====
+
==== Update Light ====
  
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>)
+
Updates light levels for a chunk.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,863: Line 2,963:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x29
+
  |rowspan="10"| 0x25
  |rowspan="7"| Play
+
  |rowspan="10"| Play
  |rowspan="7"| Client
+
  |rowspan="10"| Client
  | Entity ID
+
  |colspan="2"| Chunk X
  | VarInt
+
|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
 
  |-
 
  |-
  | Delta X
+
  |colspan="2"| Empty Sky Light Mask
  | Short
+
  |colspan="2"| VarInt
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
  | 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.
 
  |-
 
  |-
  | Delta Y
+
  |colspan="2"| Empty Block Light Mask
  | Short
+
  |colspan="2"| VarInt
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
  | 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.
 
  |-
 
  |-
  | Delta Z
+
  |rowspan="2"| Sky Light arrays
  | Short
+
| Length
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
+
|rowspan="2"| Array
 +
  | VarInt
 +
  | Length of the following array in bytes (always 2048)
 
  |-
 
  |-
  | Yaw
+
  | Sky Light array
  | Angle
+
  | Array of 2048 bytes
  | New angle, not a delta
+
  | 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.
 
  |-
 
  |-
  | Pitch
+
  |rowspan="2"| Block Light arrays
  | Angle
+
| Length
  | New angle, not a delta
+
|rowspan="2"| Array
 +
  | VarInt
 +
  | Length of the following array in bytes (always 2048)
 
  |-
 
  |-
  | On Ground
+
  | Block Light array
  | Boolean
+
  | 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.
 
  |}
 
  |}
  
==== Entity Look ====
+
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 ====
  
This packet is sent by the server when an entity rotates.
+
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,911: Line 3,029:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x2A
+
  |rowspan="9"| 0x26
  |rowspan="4"| Play
+
  |rowspan="9"| Play
  |rowspan="4"| Client
+
  |rowspan="9"| Client
 
  | Entity ID
 
  | Entity ID
  | VarInt
+
  | Int
  |  
+
  | The player's Entity ID (EID)
 
  |-
 
  |-
  | Yaw
+
  | Gamemode
  | Angle
+
  | Unsigned Byte
  | New angle, not a delta
+
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
 +
|-
 +
| Dimension
 +
| Int Enum
 +
| -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
 +
|-
 +
| Hashed seed
 +
| Long
 +
| First 8 bytes of the SHA-256 hash of the world's seed.
 +
|-
 +
| Max Players
 +
| Unsigned Byte
 +
| Was once used by the client to draw the player list, but now is ignored
 +
|-
 +
| Level Type
 +
| String Enum (16)
 +
| default, flat, largeBiomes, amplified, customized, buffet, default_1_1
 +
|-
 +
| View Distance
 +
| VarInt
 +
| Render distance (2-32)
 
  |-
 
  |-
  | Pitch
+
  | Reduced Debug Info
  | Angle
+
  | Boolean
  | New angle, not a delta
+
  | If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}.  For servers in development, this should almost always be false.
 
  |-
 
  |-
  | On Ground
+
  | Enable respawn screen
 
  | Boolean
 
  | Boolean
  |  
+
  | Set to false when the doImmediateRespawn gamerule is true
 
  |}
 
  |}
  
==== Vehicle Move (clientbound) ====
+
==== Map Data ====
  
Note that all fields use absolute positioning and do not allow for relative positioning.
+
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,939: Line 3,077:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x2B
+
  |rowspan="17"| 0x27
  |rowspan="5"| Play
+
  |rowspan="17"| Play
  |rowspan="5"| Client
+
  |rowspan="17"| Client
  | X
+
  |colspan="2"| Map ID
  | Double
+
  |colspan="2"| VarInt
  | Absolute position (X coordinate)
+
  | Map ID of the map being modified
 
  |-
 
  |-
  | Y
+
  |colspan="2"| Scale
  | Double
+
  |colspan="2"| Byte
  | Absolute position (Y coordinate)
+
  | From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
 +
|-
 +
|colspan="2"| Tracking Position
 +
|colspan="2"| Boolean
 +
| 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"| VarInt
 +
| Number of elements in the following array
 +
|-
 +
|rowspan="6"| Icon
 +
| Type
 +
|rowspan="6"| Array
 +
| VarInt enum
 +
| See below
 +
|-
 +
| X
 +
| Byte
 +
| Map coordinates: -128 for furthest left, +127 for furthest right
 
  |-
 
  |-
 
  | Z
 
  | Z
  | Double
+
  | Byte
  | Absolute position (Z coordinate)
+
  | Map coordinates: -128 for highest, +127 for lowest
 
  |-
 
  |-
  | Yaw
+
  | Direction
  | Float
+
  | Byte
  | Absolute rotation on the vertical axis, in degrees
+
  | 0-15
 
  |-
 
  |-
  | Pitch
+
  | Has Display Name
| Float
+
  | Boolean
| Absolute rotation on the horizontal axis, in degrees
+
  |
  |}
 
 
 
==== 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"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x2C
+
  | Display Name
  |rowspan="1"| Play
+
| Optional [[Chat]]
  |rowspan="1"| Client
+
| Only present if previous Boolean is true
  | Location
+
|-
  | Position
+
  |colspan="2"| Columns
  |  
+
  |colspan="2"| Unsigned Byte
  |}
+
  | Number of columns updated
 
+
  |-
==== Craft Recipe Response ====
+
  |colspan="2"| Rows
 
+
  |colspan="2"| Optional Byte
Response to the serverbound packet ([[#Craft Recipe Request|Craft Recipe Request]]), with the same recipe ID. Appears to be used to notify the UI.
+
| Only if Columns is more than 0; number of rows updated
 
+
|-
{| class="wikitable"
+
  |colspan="2"| X
  ! Packet ID
+
  |colspan="2"| Optional Byte
  ! State
+
  | Only if Columns is more than 0; x offset of the westernmost column
  ! Bound To
+
  |-
  ! Field Name
+
  |colspan="2"| Z
  ! Field Type
+
  |colspan="2"| Optional Byte
  ! Notes
+
  | Only if Columns is more than 0; z offset of the northernmost row
 
  |-
 
  |-
  |rowspan="2"| 0x2D
+
  |colspan="2"| Length
  |rowspan="2"| Play
+
  |colspan="2"| Optional VarInt
|rowspan="2"| Client
+
  | Only if Columns is more than 0; length of the following array
| Window ID
 
| Byte
 
  |
 
 
  |-
 
  |-
  | Recipe
+
  |colspan="2"| Data
  | Identifier
+
  |colspan="2"| Optional Array of Unsigned Byte
  | A recipe ID
+
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
  |}
 
  |}
  
==== Player Abilities (clientbound) ====
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
  
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.
+
Types are based off of rows and columns in <code>map_icons.png</code>:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x2E
+
  ! Icon type
  |rowspan="3"| Play
+
  ! Result
|rowspan="3"| Client
 
| Flags
 
| Byte
 
| Bit field, see below
 
 
  |-
 
  |-
  | Flying Speed
+
  | 0
| Float
+
  | White arrow (players)
  |  
 
 
  |-
 
  |-
  | Field of View Modifier
+
  | 1
  | Float
+
  | Green arrow (item frames)
| 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:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Field
+
  | 2
  ! Bit
+
  | Red arrow
 
  |-
 
  |-
  | Invulnerable
+
  | 3
  | 0x01
+
  | Blue arrow
 
  |-
 
  |-
  | Flying
+
  | 4
  | 0x02
+
  | White cross
 
  |-
 
  |-
  | Allow Flying
+
  | 5
  | 0x04
+
  | Red pointer
 
  |-
 
  |-
  | Creative Mode (Instant Break)
+
  | 6
  | 0x08
+
  | White circle (off-map players)
|}
 
 
 
==== Combat Event ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="8"| 0x2F
+
  | 7
  |rowspan="8"| Play
+
| Small white circle (far-off-map players)
  |rowspan="8"| Client
+
  |-
  |colspan="2"| Event
+
  | 8
  | VarInt Enum
+
| Mansion
  | Determines the layout of the remaining packet
+
  |-
 +
  | 9
 +
  | Temple
 
  |-
 
  |-
  ! Event
+
  | 10
  ! Field Name
+
  | White Banner
!
 
!
 
 
  |-
 
  |-
  | 0: enter combat
+
  | 11
| ''no fields''
+
  | Orange Banner
| ''no fields''
 
  |  
 
 
  |-
 
  |-
  |rowspan="2"| 1: end combat
+
  | 12
| Duration
+
  | Magenta Banner
| VarInt
 
  |  
 
 
  |-
 
  |-
  | Entity ID
+
  | 13
| Int
+
  | Light Blue Banner
  |  
 
 
  |-
 
  |-
  |rowspan="3"| 2: entity dead
+
  | 14
| Player ID
+
  | Yellow Banner
| VarInt
 
  |  
 
 
  |-
 
  |-
  | Entity ID
+
  | 15
| Int
+
  | Lime Banner
  |  
 
 
  |-
 
  |-
  | Message
+
  | 16
  | [[Chat]]
+
  | Pink Banner
  |  
+
  |-
  |}
+
| 17
 
+
| Gray Banner
==== Player Info ====
+
|-
 
+
| 18
Sent by the server to update the user list (<tab> in the client).
+
| Light Gray Banner
 +
|-
 +
| 19
 +
| Cyan Banner
 +
|-
 +
| 20
 +
| Purple Banner
 +
|-
 +
| 21
 +
| Blue Banner
 +
|-
 +
| 22
 +
| Brown Banner
 +
|-
 +
| 23
 +
| Green Banner
 +
|-
 +
| 24
 +
| Red Banner
 +
|-
 +
| 25
 +
| Black Banner
 +
|-
 +
| 26
 +
| Treasure marker
 +
  |}
 +
 
 +
==== Trade List ====
 +
 
 +
The list of trades a villager NPC is offering.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,117: Line 3,254:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="4"| Field Name
+
  !colspan="2"| Field Name
  !colspan="3"| Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="19"| 0x30
+
  |rowspan="18"| 0x28
  |rowspan="19"| Play
+
  |rowspan="18"| Play
  |rowspan="19"| Client
+
  |rowspan="18"| Client
|colspan="4"| Action
 
|colspan="3"| VarInt
 
| Determines the rest of the Player format after the UUID
 
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  | colspan="2" | Window ID
  |colspan="3"| VarInt
+
  | colspan="2" | VarInt
  | Number of elements in the following array
+
  | The ID of the window that is open; this is an int rather than a byte.
 
  |-
 
  |-
|rowspan="17"| Player
+
  | colspan="2" | Size
  |colspan="3"| UUID
+
  | colspan="2" | Byte
|rowspan="17"| Array
+
  | The number of trades in the following array
  |colspan="2"| UUID
 
  |  
 
 
  |-
 
  |-
  ! Action
+
  | rowspan="11" | Trades
!colspan="2"| Field Name
+
  | Input item 1
  !colspan="2"|  
+
| rowspan="11" | Array
  !
+
  | [[Slot]]
 +
| The first item the villager is buying
 
  |-
 
  |-
  |rowspan="10"| 0: add player
+
  | Output item
|colspan="2"| Name
+
  | [[Slot]]
  |colspan="2"| String (16)
+
  | The item the villager is selling
  |  
 
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | Has second item
  |colspan="2"| VarInt
+
  | Boolean
  | Number of elements in the following array
+
  | Whether there is a second item
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | Input item 2
| Name
+
  | Optional [[Slot]]
|rowspan="4"| Array
+
  | The second item the villager is buying; only present if they have a second item.
  | String (32767)
 
  |  
 
 
  |-
 
  |-
  | Value
+
  | Trade disabled
| String (32767)
 
|
 
|-
 
| Is Signed
 
 
  | Boolean
 
  | 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
 +
  |
 
  |-
 
  |-
  | Signature
+
  | Demand
  | Optional String (32767)
+
  | Integer
  | Only if Is Signed is true
+
  |
 
  |-
 
  |-
  |colspan="2"| Gamemode
+
  |colspan="2"| Villager level
 
  |colspan="2"| VarInt
 
  |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"| Ping
+
  |colspan="2"| Experience
 
  |colspan="2"| VarInt
 
  |colspan="2"| VarInt
  | Measured in milliseconds
+
  | Total experience for this villager (always 0 for the wandering trader)
 
  |-
 
  |-
  |colspan="2"| Has Display Name
+
  |colspan="2"| Is regular villager
 
  |colspan="2"| Boolean
 
  |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"| Display Name
+
  |colspan="2"| Can restock
|colspan="2"| Optional [[Chat]]
+
  |colspan="2"| Boolean
| Only if Has Display Name is true
+
  | 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.
|-
+
  |}
| 1: update gamemode
 
|colspan="2"| Gamemode
 
|colspan="2"| VarInt
 
|
 
|-
 
| 2: update latency
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
| Measured in milliseconds
 
|-
 
|rowspan="2"| 3: update display name
 
|colspan="2"| Has Display Name
 
  |colspan="2"| Boolean
 
  |  
 
  |-
 
|colspan="2"| Display Name
 
|colspan="2"| Optional [[Chat]]
 
| Only send if Has Display Name is true
 
|-
 
| 4: remove player
 
|colspan="2"| ''no fields''
 
|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.
+
[[File:1.14-merchant-slots.png|thumb|The merchant UI, for reference]]
 +
{{-}}
  
Ping values correspond with icons in the following way:
+
==== Entity Position ====
* 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 ====
+
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.
  
Used to rotate the client player to face the given location or entity (for <code>/teleport [<targets>] <x> <y> <z> facing</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 3,233: Line 3,351:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x31
+
  |rowspan="5"| 0x29
  |rowspan="8"| Play
+
  |rowspan="5"| Play
  |rowspan="8"| Client
+
  |rowspan="5"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 
  |-
 
  |-
  | Feet/eyes
+
  | Delta X
  | VarInt enum
+
  | Short
  | Values are feet=0, eyes=1.  If set to eyes, aims using the head position; otherwise aims using the feet position.
+
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
 
  |-
 
  |-
  | Target x
+
  | Delta Y
  | Double
+
  | Short
  | x coordinate of the point to face towards
+
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
 
  |-
 
  |-
  | Target y
+
  | Delta Z
  | Double
+
  | Short
  | y coordinate of the point to face towards
+
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 
  |-
 
  |-
  | Target z
+
  | On Ground
| Double
 
| z coordinate of the point to face towards
 
|-
 
| Is entity
 
 
  | Boolean
 
  | Boolean
  | If true, additional information about an entity is provided.
+
  |  
|-
 
| Entity ID
 
| Optional VarInt
 
| Only if is entity is true &mdash; the entity to face towards
 
|-
 
| Entity feet/eyes
 
| 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.
 
 
  |}
 
  |}
  
If the entity given by entity ID cannot be found, this packet should be treated as if is entity was false.
+
==== Entity Position and Rotation ====
  
==== Player Position And Look (clientbound) ====
+
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>)
 
 
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"
 
{| class="wikitable"
Line 3,288: Line 3,387:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x32
+
  |rowspan="7"| 0x2A
 
  |rowspan="7"| Play
 
  |rowspan="7"| Play
 
  |rowspan="7"| Client
 
  |rowspan="7"| Client
  | X
+
  | Entity ID
  | Double
+
  | VarInt
  | Absolute or relative position, depending on Flags
+
  |  
 
  |-
 
  |-
  | Y
+
  | Delta X
  | Double
+
  | Short
  | Absolute or relative position, depending on Flags
+
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
 
  |-
 
  |-
  | Z
+
  | Delta Y
  | Double
+
| Short
  | Absolute or relative position, depending on Flags
+
| 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
  | Float
+
  | Angle
  | Absolute or relative rotation on the X axis, in degrees
+
  | New angle, not a delta
 
  |-
 
  |-
 
  | Pitch
 
  | Pitch
  | Float
+
  | Angle
  | Absolute or relative rotation on the Y axis, in degrees
+
  | New angle, not a delta
 
  |-
 
  |-
  | Flags
+
  | On Ground
  | Byte
+
  | Boolean
  | Bit field, see below
+
  |  
|-
 
| Teleport ID
 
| VarInt
 
| Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
 
 
  |}
 
  |}
  
About the Flags field:
+
==== Entity Rotation ====
  
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
+
This packet is sent by the server when an entity rotates.
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Field
+
  |rowspan="4"| 0x2B
  ! Bit
+
  |rowspan="4"| Play
 +
|rowspan="4"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 
  |-
 
  |-
  | X
+
  | Yaw
  | 0x01
+
  | Angle
 +
| New angle, not a delta
 
  |-
 
  |-
  | Y
+
  | Pitch
  | 0x02
+
  | Angle
 +
| New angle, not a delta
 
  |-
 
  |-
  | Z
+
  | On Ground
  | 0x04
+
  | Boolean
  |-
+
  |  
| Y_ROT
 
| 0x08
 
|-
 
| X_ROT
 
| 0x10
 
 
  |}
 
  |}
  
==== Use Bed ====  
+
==== Entity Movement ====
  
This packet tells that a player goes to bed.
+
This packet may be used to initialize an entity.
  
The client with the matching Entity ID will go into bed mode.
+
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.
 
 
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,465:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x33
+
  |rowspan="1"| 0x2C
  |rowspan="2"| Play
+
  |rowspan="1"| Play
  |rowspan="2"| Client
+
  |rowspan="1"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Sleeping player's EID
+
  |  
|-
 
| Location
 
| Position
 
| Block location of the head part of the bed
 
 
  |}
 
  |}
  
==== Unlock Recipes ====
+
==== Vehicle Move (clientbound) ====
 +
 
 +
Note that all fields use absolute positioning and do not allow for relative positioning.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,385: Line 3,485:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="10"| 0x34
+
  |rowspan="5"| 0x2D
  |rowspan="10"| Play
+
  |rowspan="5"| Play
  |rowspan="10"| Client
+
  |rowspan="5"| Client
 +
| X
 +
| Double
 +
| Absolute position (X coordinate)
 
  |-
 
  |-
  | Action
+
  | Y
  | VarInt
+
  | Double
  | 0: init, 1: add, 2: remove
+
  | Absolute position (Y coordinate)
 
  |-
 
  |-
  | Crafting Recipe Book Open
+
  | Z
  | Boolean
+
  | Double
  | If true, then the crafting recipe book will be open when the player opens its inventory.
+
  | Absolute position (Z coordinate)
 
  |-
 
  |-
  | Crafting Recipe Book Filter Active
+
  | Yaw
  | Boolean
+
  | Float
  | If true, then the filtering option is active when the players opens its inventory.
+
  | Absolute rotation on the vertical axis, in degrees
 
  |-
 
  |-
  | Smelting Recipe Book Open
+
  | Pitch
  | Boolean
+
  | Float
  | If true, then the smelting recipe book will be open when the player opens its inventory.
+
  | Absolute rotation on the horizontal axis, in degrees
|-
 
| 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
 
| Number of elements in the following array, only present if mode is 0 (init)
 
|-
 
| 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.
 
  
==== Destroy Entities ====
+
==== Open Book ====
  
Sent by the server when a list of entities is to be destroyed on the client.
+
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,442: Line 3,521:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x35
+
  |rowspan="1"| 0x2E
  |rowspan="2"| Play
+
  |rowspan="1"| Play
  |rowspan="2"| Client
+
  |rowspan="1"| Client
  | Count
+
  | Hand
  | VarInt
+
  | VarInt enum
  | Number of elements in the following array
+
  | 0: Main hand, 1: Off hand
|-
 
| Entity IDs
 
| Array of VarInt
 
| The list of entities of destroy
 
 
  |}
 
  |}
  
==== Remove Entity Effect ====
+
==== 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"
Line 3,464: Line 3,541:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x36
+
  |rowspan="3"| 0x2F
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Entity ID
+
  | Window ID
 
  | VarInt
 
  | VarInt
 +
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 +
|-
 +
| Window Type
 +
| VarInt
 +
| The window type to use for display. Contained in the <code>minecraft:menu</code> regisry; see [[Inventory]] for the different values.
 +
|-
 +
| Window Title
 +
| [[Chat]]
 +
| The title of the window
 +
|}
 +
 +
==== 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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x30
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Location
 +
| Position
 
  |  
 
  |  
|-
 
| Effect ID
 
| Byte
 
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 
 
  |}
 
  |}
  
==== Resource Pack Send ====  
+
==== Craft Recipe Response ====
 +
 
 +
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,486: Line 3,589:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x37
+
  |rowspan="2"| 0x31
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | URL
+
  | Window ID
  | String (32767)
+
  | Byte
  | The URL to the resource pack.
+
  |
 
  |-
 
  |-
  | Hash
+
  | Recipe
  | String (40)
+
  | Identifier
  | 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
+
  | A recipe ID
 
  |}
 
  |}
  
==== Respawn ====
+
==== Player Abilities (clientbound) ====
  
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.
+
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"
 
{| class="wikitable"
Line 3,510: Line 3,613:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x38
+
  |rowspan="3"| 0x32
  |rowspan="4"| Play
+
  |rowspan="3"| Play
  |rowspan="4"| Client
+
  |rowspan="3"| Client
  | Dimension
+
  | Flags
  | Int Enum
+
  | Byte
  | -1: The Nether, 0: The Overworld, 1: The End
+
  | Bit field, see below
 
  |-
 
  |-
  | Difficulty
+
  | Flying Speed
  | Unsigned Byte
+
  | Float
  | 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
+
  | 0.05 by default
 
  |-
 
  |-
  | Gamemode
+
  | Field of View Modifier
  | Unsigned Byte
+
  | Float
  | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
+
  | Modifies the field of view, like a speed potion. A Notchian server will use the same value as the movement speed sent in the [[#Entity_Properties|Entity Properties]] packet, which defaults to 0.1 for players.
|-
 
| Level Type
 
| String (16)
 
| 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).
+
About the flags:
  
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.}}
+
{| class="wikitable"
 +
|-
 +
! Field
 +
! Bit
 +
|-
 +
| Invulnerable
 +
| 0x01
 +
|-
 +
| Flying
 +
| 0x02
 +
|-
 +
| Allow Flying
 +
| 0x04
 +
|-
 +
| Creative Mode (Instant Break)
 +
| 0x08
 +
|}
  
==== Entity Head Look ====
+
==== Combat Event ====
  
Changes the direction an entity's head is facing.
+
Originally used for metadata for twitch streaming circa 1.8.  Now only used to display the game over screen (with enter combat and end combat completely ignored by the Notchain client)
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,542: Line 3,657:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x39
+
  |rowspan="8"| 0x33
  |rowspan="2"| Play
+
|rowspan="8"| Play
  |rowspan="2"| Client
+
  |rowspan="8"| Client
  | Entity ID
+
|colspan="2"| Event
 +
| VarInt Enum
 +
| Determines the layout of the remaining packet
 +
|-
 +
! Event
 +
! Field Name
 +
!
 +
!
 +
|-
 +
| 0: enter combat
 +
| ''no fields''
 +
| ''no fields''
 +
|
 +
|-
 +
  |rowspan="2"| 1: end combat
 +
  | Duration
 
  | VarInt
 
  | VarInt
  |  
+
  | Length of the combat in ticks.
 +
|-
 +
| Entity ID
 +
| Int
 +
| ID of the primary opponent of the ended combat, or -1 if there is no obvious primary opponent.
 +
|-
 +
|rowspan="3"| 2: entity dead
 +
| Player ID
 +
| VarInt
 +
| Entity ID of the player that died (should match the client's entity ID).
 +
|-
 +
| Entity ID
 +
| Int
 +
| The killing entity's ID, or -1 if there is no obvious killer.
 
  |-
 
  |-
  | Head Yaw
+
  | Message
  | Angle
+
  | [[Chat]]
  | New angle, not a delta
+
  | The death message
 
  |}
 
  |}
  
==== Select Advancement Tab ====
+
==== Player Info ====
  
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.
+
Sent by the server to update the user list (<tab> in the client).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,566: Line 3,709:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="4"| Field Name
  ! Field Type
+
  !colspan="3"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  |rowspan="19"| 0x34
  |rowspan="2"| Play
+
  |rowspan="19"| Play
  |rowspan="2"| Client
+
  |rowspan="19"| Client
  | Has id
+
  |colspan="4"| Action
  | Boolean
+
  |colspan="3"| VarInt
  | Indicates if the next field is present
+
  | Determines the rest of the Player format after the UUID
 
  |-
 
  |-
  | Optional Identifier
+
  |colspan="4"| Number Of Players
  | String (32767)
+
  |colspan="3"| VarInt
| See below
+
  | Number of elements in the following array
  |}
 
 
 
The Identifier can be one of the following:
 
 
 
{| class="wikitable"
 
! Optional Identifier
 
 
  |-
 
  |-
  | minecraft:story/root
+
  |rowspan="17"| Player
 +
|colspan="3"| UUID
 +
|rowspan="17"| Array
 +
|colspan="2"| UUID
 +
|
 
  |-
 
  |-
  | minecraft:nether/root
+
  ! Action
 +
!colspan="2"| Field Name
 +
!colspan="2"|
 +
!
 
  |-
 
  |-
  | minecraft:end/root
+
  |rowspan="10"| 0: add player
 +
|colspan="2"| Name
 +
|colspan="2"| String (16)
 +
|
 
  |-
 
  |-
  | minecraft:adventure/root
+
  |colspan="2"| Number Of Properties
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array
 
  |-
 
  |-
  | minecraft:husbandry/root
+
  |rowspan="4"| Property
|}
+
  | Name
 
+
  |rowspan="4"| Array
If no or an invalid identifier is sent, the client will switch to the first tab in the GUI.
+
  | String (32767)
 
+
  |
==== World Border ====
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
!colspan="2"| Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="18"| 0x3B
+
  | Value
  |rowspan="18"| Play
+
  | String (32767)
  |rowspan="18"| Client
+
  |  
  |colspan="2"| Action
+
  |-
  | VarInt Enum
+
  | Is Signed
  | Determines the format of the rest of the packet
+
  | Boolean
  |-
+
  |  
! Action
 
! Field Name
 
!
 
!
 
 
  |-
 
  |-
  | 0: set size
+
  | Signature
  | Diameter
+
  | Optional String (32767)
  | Double
+
  | Only if Is Signed is true
| Length of a single side of the world border, in meters
 
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
  |colspan="2"| Gamemode
  | Old Diameter
+
  |colspan="2"| VarInt
| Double
+
  |  
  | Current length of a single side of the world border, in meters
 
 
  |-
 
  |-
  | New Diameter
+
  |colspan="2"| Ping
  | Double
+
  |colspan="2"| VarInt
  | Target length of a single side of the world border, in meters
+
  | Measured in milliseconds
 
  |-
 
  |-
  | Speed
+
  |colspan="2"| Has Display Name
| VarLong
+
  |colspan="2"| Boolean
  | 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"| 2: set center
 
| X
 
| Double
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Z
+
  |colspan="2"| Display Name
  | Double
+
  |colspan="2"| Optional [[Chat]]
  |  
+
  | Only if Has Display Name is true
 
  |-
 
  |-
  |rowspan="8"| 3: initialize
+
  | 1: update gamemode
  | X
+
|colspan="2"| Gamemode
| Double
+
  |colspan="2"| VarInt
 
  |  
 
  |  
  |-
+
  |-  
  | Z
+
  | 2: update latency
  | Double
+
  |colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
| Measured in milliseconds
 +
|-
 +
|rowspan="2"| 3: update display name
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 
  |  
 
  |  
 
  |-
 
  |-
  | Old Diameter
+
  |colspan="2"| Display Name
  | Double
+
  |colspan="2"| Optional [[Chat]]
  | Current length of a single side of the world border, in meters
+
  | Only send if Has Display Name is true
 
  |-
 
  |-
  | New Diameter
+
  | 4: remove player
  | Double
+
  |colspan="2"| ''no fields''
| Target length of a single side of the world border, in meters
+
  |colspan="2"| ''no fields''
|-
+
  |  
| 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:
+
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.
  
<syntaxhighlight lang="java">
+
Ping values correspond with icons in the following way:
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
+
* A ping that negative (i.e. not known to the server yet) will result in the no connection icon.
if (playerDistance < distance) {
+
* A ping under 150 milliseconds will result in 5 bars
    warning = 1.0 - playerDistance / distance;
+
* A ping under 300 milliseconds will result in 4 bars
} else {
+
* A ping under 600 milliseconds will result in 3 bars
    warning = 0.0;
+
* 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.
</syntaxhighlight>
 
  
==== Camera ====
+
==== Face Player ====
  
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
+
Used to rotate the client player to face the given location or entity (for <code>/teleport [<targets>] <x> <y> <z> facing</code>).
 
 
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).
 
 
 
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,825:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x3C
+
  |rowspan="8"| 0x35
  |rowspan="1"| Play
+
  |rowspan="8"| Play
  |rowspan="1"| Client
+
  |rowspan="8"| Client
| Camera ID
 
| VarInt
 
| ID of the entity to set the client's camera to
 
|}
 
 
 
The notchian also loads certain shaders for given entities: