Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
m (→‎Close Window (clientbound): Removed unrelated note.)
 
(301 intermediate revisions by 89 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.12, protocol 335]]). 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.18, protocol 757]]). 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]].
 
}}
 
}}
  
 
This page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''.
 
This page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''.
  
If you're having trouble, check out the [[Protocol FAQ|FAQ]] or ask for help in the IRC channel [irc://irc.freenode.net/mcdevs #mcdevs on chat.freenode.net] ([http://wiki.vg/MCDevs More Information]).
+
If you're having trouble, check out the [[Protocol FAQ|FAQ]] or ask for help in the IRC channel [ircs://irc.libera.chat:6697 #mcdevs on irc.libera.chat] ([https://wiki.vg/MCDevs More Information]).
  
 
'''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, etc… you still need to provide attribution to #mcdevs if you copy any of the contents of this page for publication elsewhere.
 
'''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, etc… you still need to provide attribution to #mcdevs if you copy any of the contents of this page for publication elsewhere.
Line 18: Line 18:
 
== Definitions ==
 
== Definitions ==
  
The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] ([[#Handshaking|Handshaking]], 0x00, serverbound) and [[#Login Success|Login Success]] ([[#Login|Login]], 0x02, clientbound).
+
The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] and [[#Login Success|Login Success]].
  
 
=== Data types ===
 
=== Data types ===
Line 47: Line 47:
 
  |-
 
  |-
 
  | Global palette
 
  | Global palette
  | A table/dictionary/palette mapping nonnegative integers to block states. The block state IDs can be constructed from {{Minecraft Wiki|Data values|this table}} by multiplying what the Minecraft Wiki calls “block IDs” by 16 and adding the metadata/damage value (or in most programming languages <code>block_id &lt;&lt; 4 <nowiki>|</nowiki> metadata</code>).
+
  | 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.16.5.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.
 
  |-
 
  |-
 
  | Notchian
 
  | Notchian
Line 54: Line 56:
  
 
== Packet format ==
 
== Packet format ==
 +
 +
Packets cannot be larger than 2097151 bytes (the maximum that can be sent in a 3-byte VarInt).  For compressed packets, this applies to both the compressed length and uncompressed lengths.
  
 
=== Without compression ===
 
=== Without compression ===
Line 64: Line 68:
 
  | Length
 
  | Length
 
  | VarInt
 
  | VarInt
  | Length of packet data + length of the packet ID
+
  | Length of Packet ID + Data
 
  |-
 
  |-
 
  | Packet ID
 
  | Packet ID
Line 77: Line 81:
 
=== With compression ===
 
=== With compression ===
  
Once a [[#Set Compression|Set Compression]] packet (with a non-negative threshold) is sent, [[wikipedia:Zlib|zlib]] compression is enabled for all following packets. The format of a packet changes slighty to include the size of the uncompressed packet.
+
Once a [[#Set Compression|Set Compression]] packet (with a non-negative threshold) is sent, [[wikipedia:Zlib|zlib]] compression is enabled for all following packets. The format of a packet changes slightly to include the size of the uncompressed packet.
  
 
{| class=wikitable
 
{| class=wikitable
Line 97: Line 101:
 
  |rowspan="2"| Yes
 
  |rowspan="2"| Yes
 
  | Packet ID
 
  | Packet ID
  | Varint
+
  | VarInt
 
  | zlib compressed packet ID (see the sections below)
 
  | zlib compressed packet ID (see the sections below)
 
  |-
 
  |-
Line 105: Line 109:
 
  |}
 
  |}
  
The length given by the Packet Length field is the number of bytes that remain in that packet, including the Data Length field.
+
If the size of the buffer containing the packet data and ID (as a VarInt) is smaller than the threshold specified in the packet [[#Set Compression|Set Compression]]. It will be sent as uncompressed. This is done by setting the data length as 0. (Comparable to sending a non-compressed format with an extra 0 between the length, and packet data).  
 
 
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]] ([[#Login|Login]], 0x03, clientbound), otherwise the receiving party will disconnect.
+
If it's larger than the threshold, then it follows the regular compressed protocol format.
  
Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] ([[#Login|Login]], 0x03, clientbound) 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.
  
 
== Handshaking ==
 
== Handshaking ==
Line 138: Line 140:
 
  | Protocol Version
 
  | Protocol Version
 
  | VarInt
 
  | VarInt
  | See [[protocol version numbers]] (currently 335 in Minecraft 1.12)
+
  | See [[protocol version numbers]] (currently 756 in Minecraft 1.17.1).
 
  |-
 
  |-
 
  | 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 simple redirect, e.g. if _minecraft._tcp.example.com points to mc.example.org, users connecting to example.com will provide example.org as server address in addition to connecting to it.
 
  |-  
 
  |-  
 
  | Server Port
 
  | Server Port
 
  | Unsigned Short
 
  | Unsigned Short
  | Default is 25565. The Notchian server does not use this information.
+
  | Default is 25565. The Notchian server does not use this information.
 
  |-
 
  |-
 
  | Next State
 
  | Next State
 
  | VarInt Enum
 
  | VarInt Enum
  | 1 for [[#Status|status]], 2 for [[#Login|login]]
+
  | 1 for [[#Status|status]], 2 for [[#Login|login]].
 
  |}
 
  |}
  
Line 172: Line 174:
 
  | Payload
 
  | Payload
 
  | Unsigned Byte
 
  | Unsigned Byte
  | always 1 (<code>0x01</code>)
+
  | always 1 (<code>0x01</code>).
 
  |}
 
  |}
  
 
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 193: 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
+
  | 0x01
  | Byte
+
  | Status
  | The type of object (see [[Entities#Objects]])
+
  | Client
  |-
+
  | Payload
  | X
+
  | Long
  | Double
+
  | Should be the same as sent by the client.
  |  
+
  |}
  |-
+
 
  | Y
+
=== Serverbound ===
  | Double
+
 
  |
+
==== Request ====
 +
 
 +
The status can only be requested once immediately after the handshake, before any ping. The server won't respond otherwise.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Z
+
  | 0x00
  | Double
+
  | Status
  |  
+
  | Server
  |-
+
  |colspan="3"| ''no fields''
| 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 255: Line 251:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x01
+
  | 0x01
  |rowspan="5"| Play
+
  | Status
|rowspan="5"| Client
+
  | 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
 
|
 
  |-
 
  | Y
 
| Double
 
  |  
 
  |-
 
| Z
 
| Double
 
|
 
|-
 
| Count
 
| Short
 
| The amount of experience this orb will reward once collected
 
 
  |}
 
  |}
  
==== Spawn Global Entity ====
+
== 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 integrated servers (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]]. The Notchian server uses UUID v3 for offline player UUIDs, with the namespace “OfflinePlayer” and the value as the player’s username. For example, Notch’s offline UUID would be derived from the string “OfflinePlayer:Notch”. This is not a requirement however, the UUID may be anything.
 +
 
 +
See [[Protocol Encryption]] for details.
 +
 
 +
=== Clientbound ===
  
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.
+
==== Disconnect (login) ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 291: Line 290:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x02
+
  | 0x00
  |rowspan="5"| Play
+
  | Login
  |rowspan="5"| Client
+
  | Client
  | Entity ID
+
  | Reason
| VarInt
+
  | [[Chat]]
| The EID of the thunderbolt
 
|-
 
| Type
 
| Byte Enum
 
| The global entity type, currently always 1 for thunderbolt
 
|-
 
| X
 
| Double
 
|
 
|-
 
| Y
 
| Double
 
|
 
|-
 
| Z
 
  | Double
 
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Spawn Mob ====
+
==== Encryption Request ====
 
 
Sent by the server when a mob entity is spawned.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 327: Line 308:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="13"| 0x03
+
  |rowspan="5"| 0x01
  |rowspan="13"| Play
+
  |rowspan="5"| Login
  |rowspan="13"| Client
+
  |rowspan="5"| Client
  | Entity ID
+
  | Server ID
 +
| String (20)
 +
| Appears to be empty.
 +
|-
 +
| Public Key Length
 
  | VarInt
 
  | VarInt
  |  
+
  | Length of Public Key
 
  |-
 
  |-
  | Entity UUID
+
  | Public Key
  | UUID
+
  | Byte Array
  |  
+
  | The server's public key in bytes
 
  |-
 
  |-
  | Type
+
  | Verify Token Length
 
  | VarInt
 
  | VarInt
  | The type of mob. See [[Entities#Mobs]]
+
  | Length of Verify Token. Always 4 for Notchian servers.
 
  |-
 
  |-
  | X
+
  | Verify Token
  | Double
+
  | Byte Array
  |  
+
  | A sequence of random bytes generated by the server.
  |-
+
  |}
| Y
+
 
| Double
+
See [[Protocol Encryption]] for details.
|
 
|-
 
| Z
 
| Double
 
|
 
|-
 
| 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 ====
+
==== Login Success ====
 
 
This packet shows location, name, and type of painting.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 395: Line 344:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x04
+
  |rowspan="2"| 0x02
  |rowspan="5"| Play
+
  |rowspan="2"| Login
  |rowspan="5"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | UUID
| VarInt
 
|
 
|-
 
| Entity UUID
 
 
  | UUID
 
  | UUID
 
  |  
 
  |  
 
  |-
 
  |-
  | Title
+
  | Username
  | String (13)
+
  | String (16)
  | Name of the painting. Max length 13
+
  |  
 +
|}
 +
 
 +
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 sending Play packets, either by setting a timeout, or waiting for Play packets from the server (usually [[#Player Info|Player Info]]).
 +
 
 +
The notchian client doesn't send any (non-[[#Keep Alive|keep alive]]) packets until the next tick/[[#Time Update|time update]] packet.
 +
}}
 +
 
 +
==== Set Compression ====
 +
 
 +
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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Location
+
  | 0x03
  | Position
+
  | Login
  | Center coordinates (see below)
+
  | Client
  |-
+
  | Threshold
  | Direction
+
  | VarInt
  | Byte Enum
+
  | Maximum size of a packet before it is compressed.
| Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
 
 
  |}
 
  |}
  
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.
+
==== Login Plugin Request ====
 +
 
 +
Used to implement a custom handshaking flow together with [[#Login_Plugin_Response | Login Plugin Response]].
  
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):
+
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"
 
{| class="wikitable"
  ! Name
+
  ! Packet ID
  ! x
+
! State
  ! y
+
  ! Bound To
  ! width
+
  ! Field Name
  ! height
+
  ! Field Type
 +
  ! Notes
 +
|-
 +
|rowspan="3"| 0x04
 +
|rowspan="3"| Login
 +
|rowspan="3"| Client
 +
| Message ID
 +
| VarInt
 +
| Generated by the server - should be unique to the connection.
 
  |-
 
  |-
  | <code>Kebab</code>
+
  | Channel
  | 0
+
  | Identifier
  | 0
+
  | Name of the [[plugin channel]] used to send the data.
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Aztec</code>
+
  | Data
  | 16
+
  | Byte Array
  | 0
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
  | 16
+
  |}
  | 16
+
 
 +
=== Serverbound ===
 +
 
 +
==== Login Start ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>Alban</code>
+
  | 0x00
  | 32
+
  | Login
  | 0
+
  | Server
  | 16
+
  | Name
  | 16
+
| String (16)
 +
| Player's Username.
 +
  |}
 +
 
 +
==== Encryption Response ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>Aztec2</code>
+
  |rowspan="4"| 0x01
  | 48
+
|rowspan="4"| Login
  | 0
+
  |rowspan="4"| Server
  | 16
+
  | Shared Secret Length
  | 16
+
  | VarInt
 +
  | Length of Shared Secret.
 
  |-
 
  |-
  | <code>Bomb</code>
+
  | Shared Secret
  | 64
+
  | Byte Array
  | 0
+
  | Shared Secret value, encrypted with the server's public key.
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Plant</code>
+
  | Verify Token Length
  | 80
+
  | VarInt
  | 0
+
  | Length of Verify Token.
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Wasteland</code>
+
  | Verify Token
  | 96
+
  | Byte Array
  | 0
+
  | Verify Token value, encrypted with the same public key as the shared secret.
  | 16
+
  |}
  | 16
+
 
 +
See [[Protocol Encryption]] for details.
 +
 
 +
==== Login Plugin Response ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>Pool</code>
+
  |rowspan="3"| 0x02
  | 0
+
|rowspan="3"| Login
  | 32
+
  |rowspan="3"| Server
  | 32
+
  | Message ID
  | 16
+
  | VarInt
 +
  | Should match ID from server.
 
  |-
 
  |-
  | <code>Courbet</code>
+
  | Successful
| 32
+
| Boolean
| 32
+
| <code>true</code> if the client understands the request, <code>false</code> otherwise. When <code>false</code>, no payload follows.
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Sea</code>
+
  | Data
  | 64
+
  | Optional Byte Array
  | 32
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
  | 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>Sunset</code>
+
  |rowspan="12"| 0x00
  | 96
+
|rowspan="12"| Play
  | 32
+
  |rowspan="12"| Client
  | 32
+
  | Entity ID
  | 16
+
  | VarInt
 +
  | Entity ID.
 
  |-
 
  |-
  | <code>Creebet</code>
+
  | Object UUID
  | 128
+
  | UUID
  | 32
+
  |  
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Wanderer</code>
+
  | Type
  | 0
+
  | VarInt
  | 64
+
  | The type of entity (same as in [[#Spawn Living Entity|Spawn Living Entity]]).
| 16
 
| 32
 
 
  |-
 
  |-
  | <code>Graham</code>
+
  | X
  | 16
+
  | Double
  | 64
+
  |  
| 16
 
| 32
 
 
  |-
 
  |-
  | <code>Match</code>
+
  | Y
  | 0
+
  | Double
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Bust</code>
+
  | Z
  | 32
+
  | Double
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Stage</code>
+
  | Pitch
  | 64
+
  | Angle
  | 128
+
  | To get the real pitch, you must divide this by (256.0F / 360.0F)
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Void</code>
+
  | Yaw
  | 96
+
  | Angle
  | 128
+
  | To get the real yaw, you must divide this by (256.0F / 360.0F)
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>SkullAndRoses</code>
+
  | Data
  | 128
+
  | Int
  | 128
+
  | Meaning dependent on the value of the Type field, see [[Object Data]] for details.
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Wither</code>
+
  | Velocity X
  | 160
+
  | Short
  | 128
+
  |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).
| 32
 
  | 32
 
 
  |-
 
  |-
  | <code>Fighters</code>
+
  | Velocity Y
  | 0
+
  | Short
| 96
 
| 64
 
| 32
 
 
  |-
 
  |-
  | <code>Pointer</code>
+
  | Velocity Z
  | 0
+
  | Short
| 192
+
  |}
| 64
 
| 64
 
|-
 
| <code>Pigscene</code>
 
| 64
 
| 192
 
| 64
 
| 64
 
|-
 
| <code>BurningSkull</code>
 
| 128
 
| 192
 
| 64
 
| 64
 
|-
 
| <code>Skeleton</code>
 
| 192
 
| 64
 
| 64
 
| 48
 
|-
 
| <code>DonkeyKong</code>
 
| 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 Experience Orb ====
  
==== Spawn Player ====
+
Spawns one or more experience orbs.
 
 
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]] ([[#Play|Play]], 0x38, clientbound) 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 605: Line 569:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x05
+
  |rowspan="5"| 0x01
  |rowspan="8"| Play
+
  |rowspan="5"| Play
  |rowspan="8"| Client
+
  |rowspan="5"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player's EID
+
  |  
|-
 
| Player UUID
 
| UUID
 
| See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
 
 
  |-
 
  |-
 
  | X
 
  | X
Line 628: Line 588:
 
  |  
 
  |  
 
  |-
 
  |-
  | Yaw
+
  | Count
  | Angle
+
  | Short
|
+
  | The amount of experience this orb will reward once collected.
|-
+
  |}
| 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.
 
 
 
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) ====
+
==== Spawn Living Entity ====
  
Sent whenever an entity should change animation.
+
Sent by the server when a living entity is spawned.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 663: Line 605:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x06
+
  |rowspan="12"| 0x02
  |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 [[Entity_metadata#Mobs]].
 
  |-
 
  |-
  | 1
+
  | X
  | Take damage
+
| Double
 +
  |  
 
  |-
 
  |-
  | 2
+
  | Y
  | Leave bed
+
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Yaw
 +
| 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="3"| 0x07
+
  |rowspan="5"| 0x03
  |rowspan="3"| Play
+
  |rowspan="5"| Play
  |rowspan="3"| Client
+
  |rowspan="5"| Client
  |colspan="2"| Count
+
  | Entity ID
  |colspan="2"| VarInt
+
  | VarInt
  | Number of elements in the following array
+
  |  
 
  |-
 
  |-
  |rowspan="2"| Statistic
+
  | Entity UUID
| Name
+
  | UUID
|rowspan="2"| Array
+
  |  
| String (32767)
 
| [https://gist.github.com/Alvin-LB/8d0d13db00b3c00fd0e822a562025eff https://gist.github.com/Alvin-LB/8d0d13db00b3c00fd0e822a562025eff]
 
|-
 
| Value
 
| VarInt
 
| The amount to set it to
 
  |}
 
 
 
==== 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.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x08
+
  | Motive
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Entity ID
 
 
  | VarInt
 
  | VarInt
  | Entity ID of the entity breaking the block
+
  | Painting's ID, see below.
 
  |-
 
  |-
 
  | Location
 
  | Location
 
  | Position
 
  | Position
  | Block Position
+
  | Center coordinates (see below).
 
  |-
 
  |-
  | Destroy Stage
+
  | Direction
  | Byte
+
  | Byte Enum
  | 0–9 to set it, any other value to remove it
+
  | Direction the painting faces (North = 2, South = 0, West = 1, East = 3).
 
  |}
 
  |}
  
==== Update Block Entity ====
+
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.
  
Sets tile entity associated with the block at the given location.
+
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"
  ! Packet ID
+
  ! Name
  ! State
+
  ! ID
  ! Bound To
+
  ! x
  ! Field Name
+
  ! y
  ! Field Type
+
  ! width
  ! Notes
+
  ! height
 
  |-
 
  |-
  |rowspan="3"| 0x09
+
  | <code>minecraft:kebab</code>
  |rowspan="3"| Play
+
| 0
  |rowspan="3"| Client
+
| 0
  | Location
+
| 0
  | Position
+
| 16
  |  
+
| 16
 +
|-
 +
  | <code>minecraft:aztec</code>
 +
| 1
 +
  | 16
 +
| 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:alban</code>
 +
| 2
 +
| 32
 +
  | 0
 +
  | 16
 +
  | 16
 
  |-
 
  |-
  | Action
+
  | <code>minecraft:aztec2</code>
  | Unsigned Byte
+
  | 3
  | The type of update to perform, see below
+
  | 48
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | NBT Data
+
  | <code>minecraft:bomb</code>
  | [[NBT|NBT Tag]]
+
  | 4
  | 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)
+
| 64
  |}
+
  | 0
 
+
  | 16
''Action'' field:
+
| 16
 
 
* '''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''': Set type of flower in flower pot
 
* '''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''': Set the color of 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.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x0A
+
  | <code>minecraft:plant</code>
  |rowspan="4"| Play
+
  | 5
  |rowspan="4"| Client
+
  | 80
  | Location
+
  | 0
  | Position
+
  | 16
  | Block coordinates
+
  | 16
 
  |-
 
  |-
  | Action ID (Byte 1)
+
  | <code>minecraft:wasteland</code>
  | Unsigned Byte
+
  | 6
  | Varies depending on block — see [[Block Actions]]
+
  | 96
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Action Param (Byte 2)
+
  | <code>minecraft:pool</code>
  | Unsigned Byte
+
  | 7
  | Varies depending on block — see [[Block Actions]]
+
  | 0
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Block Type
+
  | <code>minecraft:courbet</code>
  | VarInt
+
  | 8
  | The block type ID for the block, not including metadata/damage value.  This must match the block at the given coordinates.
+
  | 32
  |}
+
  | 32
 
+
  | 32
==== Block Change ====
+
  | 16
 
 
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:sea</code>
  |rowspan="2"| Play
+
  | 9
  |rowspan="2"| Client
+
  | 64
  | Location
+
  | 32
  | Position
+
  | 32
  | Block Coordinates
+
  | 16
 
  |-
 
  |-
  | Block ID
+
  | <code>minecraft:sunset</code>
| VarInt
+
  | 10
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (When reading data: <code>type = id &gt;&gt; 4</code>, <code>meta = id & 15</code>, when writing data: <code>id = type &lt;&lt; 4 &#124; (meta &amp; 15)</code>)
+
| 96
  |}
+
  | 32
 
+
  | 32
==== Boss Bar ====
+
  | 16
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
  !colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="15"| 0x0C
+
  | <code>minecraft:creebet</code>
  |rowspan="15"| Play
+
  | 11
  |rowspan="15"| Client
+
  | 128
  |colspan="2"| UUID
+
  | 32
  | UUID
+
  | 32
  | Unique ID for this bar
+
  | 16
 
  |-
 
  |-
  |colspan="2"| Action
+
  | <code>minecraft:wanderer</code>
  | VarInt Enum
+
| 12
  | Determines the layout of the remaining packet
+
| 0
 +
| 64
 +
  | 16
 +
  | 32
 
  |-
 
  |-
  ! Action
+
  | <code>minecraft:graham</code>
  ! Field Name
+
  | 13
  !
+
  | 16
  !
+
  | 64
 +
| 16
 +
| 32
 
  |-
 
  |-
  |rowspan="5"| 0: add
+
  | <code>minecraft:match</code>
  | Title
+
| 14
  | [[Chat]]
+
| 0
  |  
+
  | 128
 +
  | 32
 +
  | 32
 
  |-
 
  |-
  | Health
+
  | <code>minecraft:bust</code>
  | Float
+
| 15
  | 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.
+
| 32
 +
  | 128
 +
  | 32
 +
| 32
 
  |-
 
  |-
  | Color
+
  | <code>minecraft:stage</code>
  | VarInt Enum
+
  | 16
  | Color ID (see below)
+
  | 64
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Division
+
  | <code>minecraft:void</code>
  | VarInt Enum
+
  | 17
  | Type of division (see below)
+
  | 96
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Flags
+
  | <code>skull_and_roses</code>
  | Unsigned Byte
+
  | 18
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music)
+
  | 128
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | 1: remove
+
  | <code>minecraft:wither</code>
  | ''no fields''
+
  | 19
  | ''no fields''
+
  | 160
  | Removes this boss bar
+
  | 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | 2: update health
+
  | <code>minecraft:fighters</code>
  | Health
+
  | 20
  | Float
+
  | 0
  | as above
+
  | 96
 +
| 64
 +
| 32
 
  |-
 
  |-
  | 3: update title
+
  | <code>minecraft:pointer</code>
  | Title
+
  | 21
  | [[Chat]]
+
  | 0
  |  
+
  | 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  |rowspan="2"| 4: update style
+
  | <code>minecraft:pigscene</code>
  | Color
+
| 22
  | VarInt Enum
+
| 64
  | Color ID (see below)
+
  | 192
 +
  | 64
 +
  | 64
 
  |-
 
  |-
  | Dividers
+
  | <code>minecraft:burning_skull</code>
  | VarInt Enum
+
  | 23
  | as above
+
  | 128
 +
| 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  | 5: update flags
+
  | <code>minecraft:skeleton</code>
  | Flags
+
  | 24
  | Unsigned Byte
+
  | 192
  | as above
+
  | 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 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"
 
{| class="wikitable"
  ! ID
+
  ! Packet ID
  ! Color
+
  ! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 0
+
  |rowspan="7"| 0x04
  | Pink
+
|rowspan="7"| Play
 +
|rowspan="7"| Client
 +
| Entity ID
 +
| VarInt
 +
  | Player's EID.
 
  |-
 
  |-
  | 1
+
  | Player UUID
  | Blue
+
  | UUID
 +
| See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs.
 
  |-
 
  |-
  | 2
+
  | X
  | Red
+
| Double
 +
  |  
 
  |-
 
  |-
  | 3
+
  | Y
  | Green
+
| Double
 +
  |  
 
  |-
 
  |-
  | 4
+
  | Z
  | Yellow
+
| Double
 +
  |  
 
  |-
 
  |-
  | 5
+
  | Yaw
  | Purple
+
| Angle
 +
  |  
 
  |-
 
  |-
  | 6
+
  | Pitch
  | White
+
| Angle
 +
  |  
 
  |}
 
  |}
  
{| class="wikitable"
+
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs.
! ID
+
 
! Type of division
+
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). The Notchain server uses <code>UUID.nameUUIDFromBytes</code>, implemented by OpenJDK [https://github.com/AdoptOpenJDK/openjdk-jdk8u/blob/9a91972c76ddda5c1ce28b50ca38cbd8a30b7a72/jdk/src/share/classes/java/util/UUID.java#L153-L175 here].
|-
+
 
| 0
+
For NPCs UUID v2 should be used. Note:
| No division
+
 
|-
+
  <+Grum> i will never confirm this as a feature you know that :)
  | 1
 
| 6 notches
 
|-
 
| 2
 
| 10 notches
 
|-
 
| 3
 
| 12 notches
 
|-
 
| 4
 
| 20 notches
 
  |}
 
  
==== Server Difficulty ====
+
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>.
  
Changes the difficulty setting in the client's option menu
+
==== Sculk Vibration Signal ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,000: Line 958:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x0D
+
  |rowspan="4"| 0x05
  |rowspan="1"| Play
+
  |rowspan="4"| Play
  |rowspan="1"| Client
+
  |rowspan="4"| Client
  | Difficulty
+
  | Source Position
  | Unsigned Byte
+
  | Position
  | 0: peaceful, 1: easy, 2: normal, 3: hard
+
  | Source position for the vibration.
 +
|-
 +
| Destination Identifier
 +
| Identifier
 +
| Identifier of the destination codec type.
 +
|-
 +
| Destination
 +
| Varies
 +
| Vanilla default destinations are a block position encoded as a [https://wiki.vg/Protocol#Data_types Position] for "block" or an entity id encoded as a VarInt for "entity".
 +
|-
 +
| Arrival Ticks
 +
| VarInt
 +
| Ticks for the signal to arrive at the destination.
 
  |}
 
  |}
 +
This packet shows a permanent particle.
  
==== Tab-Complete (clientbound) ====
+
==== Entity Animation (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.
+
Sent whenever an entity should change animation.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,020: Line 991:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0E
+
  |rowspan="2"| 0x06
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Count
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array
+
  | Player ID.
 
  |-
 
  |-
  | Matches
+
  | Animation
  | Array of String (32767)
+
  | Unsigned Byte
  | One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
  | Animation ID (see below).
 
  |}
 
  |}
  
==== Chat Message (clientbound) ====
+
Animation can be one of the following values:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Animation
 +
|-
 +
| 0
 +
| Swing main arm
 +
|-
 +
| 1
 +
| Take damage
 +
|-
 +
| 2
 +
| Leave bed
 +
|-
 +
| 3
 +
| Swing offhand
 +
|-
 +
| 4
 +
| Critical effect
 +
|-
 +
| 5
 +
| Magic critical effect
 +
|}
  
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.
+
==== Statistics ====
  
{{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.}}
+
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1). Will only send the changed values if previously requested.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
  ! Bound To
+
  ! Bound To  
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0F
+
  |rowspan="4"| 0x07
  |rowspan="2"| Play
+
  |rowspan="4"| Play
  |rowspan="2"| Client
+
  |rowspan="4"| Client
  | JSON Data
+
|colspan="2"| Count
  | [[Chat]]
+
|colspan="2"| VarInt
  | Limited to 32767 bytes
+
| Number of elements in the following array.
 +
|-
 +
|rowspan="3"| Statistic
 +
| Category ID
 +
|rowspan="3"| Array
 +
| VarInt
 +
| See below.
 +
|-
 +
  | Statistic ID
 +
  | VarInt
 +
  | See below.
 
  |-
 
  |-
  | Position
+
  | Value
  | Byte
+
  | VarInt
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
+
  | The amount to set it to.
 
  |}
 
  |}
  
==== Multi Block Change ====
+
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 
 
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"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
! State
+
  ! ID
! Bound To
+
  ! Registry
!colspan="2"| Field Name
 
  !colspan="2"| Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x10
+
  | <code>minecraft.mined</code>
|rowspan="6"| Play
+
  | 0
|rowspan="6"| Client
+
  | Blocks
  |colspan="2"| Chunk X
 
|colspan="2"| Int
 
  | Chunk X coordinate
 
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  | <code>minecraft.crafted</code>
  |colspan="2"| Int
+
  | 1
  | Chunk Z coordinate
+
  | Items
 
  |-
 
  |-
  |colspan="2"| Record Count
+
  | <code>minecraft.used</code>
  |colspan="2"| VarInt
+
  | 2
  | Number of elements in the following array, i.e. the number of blocks affected
+
  | Items
 
  |-
 
  |-
  |rowspan="3"| Record
+
  | <code>minecraft.broken</code>
| Horizontal Position
+
| 3
|rowspan="3"| Array
+
| Items
| 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.
 
 
  |-
 
  |-
  | Y Coordinate
+
  | <code>minecraft.picked_up</code>
  | Unsigned Byte
+
  | 4
  | Y coordinate of the block
+
  | Items
 
  |-
 
  |-
  | Block ID
+
  | <code>minecraft.dropped</code>
| VarInt
+
  | 5
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (When reading data: <code>type = id &gt;&gt; 4</code>, <code>meta = id & 15</code>, when writing data: <code>id = type &lt;&lt; 4 &#124; (meta &amp; 15)</code>)
+
  | Items
  |}
 
 
 
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>
 
 
 
==== 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"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x11
+
  | <code>minecraft.killed</code>
|rowspan="3"| Play
+
  | 6
|rowspan="3"| Client
+
  | Entities
| Window ID
 
  | Byte
 
  | The ID of the window that the action occurred in
 
 
  |-
 
  |-
  | Action Number
+
  | <code>minecraft.killed_by</code>
  | Short
+
  | 7
  | 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.
+
  | Entities
 
  |-
 
  |-
  | Accepted
+
  | <code>minecraft.custom</code>
  | Boolean
+
  | 8
  | Whether the action was accepted
+
  | Custom
 
  |}
 
  |}
  
==== Close Window (clientbound) ====
+
Blocks, Items, and Entities use block (not block state), item, and entity ids.
  
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.
+
Custom has the following (unit only matters for clients):
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
! ID
  ! Bound To
+
  ! Unit
  ! Field Name
+
  |-
  ! Field Type
+
| <code>minecraft.leave_game</code>
  ! Notes
+
| 0
 +
| None
 +
|-
 +
  | <code>minecraft.play_one_minute</code>
 +
  | 1
 +
  | Time
 
  |-
 
  |-
  | 0x12
+
  | <code>minecraft.time_since_death</code>
| Play
+
  | 2
| Client
+
  | Time
| Window ID
 
  | Unsigned Byte
 
  | This is the ID of the window that was closed. 0 for inventory.
 
|}
 
 
 
==== Open Window ====
 
 
 
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x13
+
  | <code>minecraft.time_since_rest</code>
|rowspan="5"| Play
+
  | 3
  |rowspan="5"| Client
+
  | Time
  | Window ID
 
| Unsigned Byte
 
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
 
  |-
 
  |-
  | Window Type
+
  | <code>minecraft.sneak_time</code>
  | String (32)
+
  | 4
  | The window type to use for display. See [[Inventory]] for a list.
+
  | Time
 
  |-
 
  |-
  | Window Title
+
  | <code>minecraft.walk_one_cm</code>
  | [[Chat]]
+
  | 5
  | The title of the window
+
  | Distance
 
  |-
 
  |-
  | Number Of Slots
+
  | <code>minecraft.crouch_one_cm</code>
  | Unsigned Byte
+
  | 6
  | Number of slots in the window (excluding the number of slots in the player inventory)
+
  | Distance
 
  |-
 
  |-
  | Entity ID
+
  | <code>minecraft.sprint_one_cm</code>
  | Optional Int
+
  | 7
  | EntityHorse's EID. Only sent when Window Type is “EntityHorse”
+
  | Distance
|}
 
 
 
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"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x14
+
  | <code>minecraft.walk_on_water_one_cm</code>
|rowspan="3"| Play
+
  | 8
  |rowspan="3"| Client
+
  | Distance
  | Window ID
 
| Unsigned Byte
 
| The ID of window which items are being sent for. 0 for player inventory.
 
 
  |-
 
  |-
  | Count
+
  | <code>minecraft.fall_one_cm</code>
  | Short
+
  | 9
  | Number of elements in the following array
+
  | Distance
 
  |-
 
  |-
  | Slot Data
+
  | <code>minecraft.climb_one_cm</code>
| Array of [[Slot Data|Slot]]
+
  | 10
  |  
+
  | Distance
  |}
 
 
 
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
 
 
  |-
 
  |-
  |rowspan="3"| 0x15
+
  | <code>minecraft.fly_one_cm</code>
|rowspan="3"| Play
+
  | 11
|rowspan="3"| Client
+
  | Distance
| Window ID
 
  | Unsigned Byte
 
  |  
 
 
  |-
 
  |-
  | Property
+
  | <code>minecraft.walk_under_water_one_cm</code>
  | Short
+
  | 12
  | The property to be updated, see below
+
  | Distance
 
  |-
 
  |-
  | Value
+
  | <code>minecraft.minecart_one_cm</code>
| Short
+
  | 13
  | The new value for the property, see below
+
  | Distance
  |}
 
 
 
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Window type
+
  | <code>minecraft.boat_one_cm</code>
  ! Property
+
  | 14
  ! Value
+
  | Distance
 
  |-
 
  |-
  |rowspan="4"| Furnace
+
  | <code>minecraft.pig_one_cm</code>
  | 0: Fire icon (fuel left)
+
  | 15
  | counting from fuel burn time down to 0 (in-game ticks)
+
  | Distance
 
  |-
 
  |-
  | 1: Maximum fuel burn time
+
  | <code>minecraft.horse_one_cm</code>
  | fuel burn time or 0 (in-game ticks)
+
  | 16
 +
| Distance
 
  |-
 
  |-
  | 2: Progress arrow
+
  | <code>minecraft.aviate_one_cm</code>
  | counting from 0 to maximum progress (in-game ticks)
+
  | 17
 +
| Distance
 
  |-
 
  |-
  | 3: Maximum progress
+
  | <code>minecraft.swim_one_cm</code>
  | always 200 on the notchian server
+
  | 18
 +
| Distance
 
  |-
 
  |-
  |rowspan="10"| Enchantment Table
+
  | <code>minecraft.strider_one_cm</code>
  | 0: Level requirement for top enchantment slot
+
  | 19
  |rowspan="3"| The enchantment's xp level requirement
+
  | Distance
 
  |-
 
  |-
  | 1: Level requirement for middle enchantment slot
+
  | <code>minecraft.jump</code>
 +
| 20
 +
| None
 
  |-
 
  |-
  | 2: Level requirement for bottom enchantment slot
+
  | <code>minecraft.drop</code>
 +
| 21
 +
| None
 
  |-
 
  |-
  | 3: The enchantment seed
+
  | <code>minecraft.damage_dealt</code>
| 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>).
+
| 22
 +
| Damage
 
  |-
 
  |-
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
+
  | <code>minecraft.damage_dealt_absorbed</code>
  |rowspan="3"| The enchantment id (set to -1 to hide it)
+
  | 23
 +
| Damage
 
  |-
 
  |-
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
+
  | <code>minecraft.damage_dealt_resisted</code>
 +
| 24
 +
| Damage
 
  |-
 
  |-
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
+
  | <code>minecraft.damage_taken</code>
 +
| 25
 +
| Damage
 
  |-
 
  |-
  | 7: Enchantment level shown on mouse hover over the top slot
+
  | <code>minecraft.damage_blocked_by_shield</code>
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
+
  | 26
 +
| Damage
 
  |-
 
  |-
  | 8: Enchantment level shown on mouse hover over the middle slot
+
  | <code>minecraft.damage_absorbed</code>
 +
| 27
 +
| Damage
 
  |-
 
  |-
  | 9: Enchantment level shown on mouse hover over the bottom slot
+
  | <code>minecraft.damage_resisted</code>
 +
| 28
 +
| Damage
 
  |-
 
  |-
  |rowspan="3"| Beacon
+
  | <code>minecraft.deaths</code>
  | 0: Power level
+
  | 29
  | 0-4, controls what effect buttons are enabled
+
  | None
 
  |-
 
  |-
  | 1: First potion effect
+
  | <code>minecraft.mob_kills</code>
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
+
  | 30
 +
| None
 
  |-
 
  |-
  | 2: Second potion effect
+
  | <code>minecraft.animals_bred</code>
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
+
  | 31
 +
| None
 
  |-
 
  |-
  | Anvil
+
  | <code>minecraft.player_kills</code>
  | 0: Repair cost
+
  | 32
  | The repair's cost in xp levels
+
  | None
 
  |-
 
  |-
  | Brewing Stand
+
  | <code>minecraft.fish_caught</code>
  | 0: Brew time
+
  | 33
  | 0–400, with 400 making the arrow empty, and 0 making the arrow full
+
  | None
  |}
+
  |-
 
+
| <code>minecraft.talked_to_villager</code>
==== Set Slot ====
+
| 34
 
+
  | None
Sent by the server when an item in a slot (in a window) is added/removed.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x16
+
  | <code>minecraft.traded_with_villager</code>
|rowspan="3"| Play
+
  | 35
|rowspan="3"| Client
+
  | None
  | 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
+
  | <code>minecraft.eat_cake_slice</code>
  | Short
+
  | 36
  | The slot that should be updated
+
  | None
 
  |-
 
  |-
  | Slot Data
+
  | <code>minecraft.fill_cauldron</code>
| [[Slot Data|Slot]]
+
  | 37
  |  
+
  | None
  |}
 
 
 
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.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x17
+
  | <code>minecraft.use_cauldron</code>
|rowspan="2"| Play
+
  | 38
|rowspan="2"| Client
+
  | None
  | Item ID
 
  | VarInt
 
| Numeric ID of the item to apply a cooldown to.
 
 
  |-
 
  |-
  | Cooldown Ticks
+
  | <code>minecraft.clean_armor</code>
| VarInt
+
| 39
| Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
+
  | None
|}
 
 
 
==== Plugin Message (clientbound) ====
 
 
 
{{Main|Plugin channels}}
 
 
 
Mods and plugins can use this to send their data. Minecraft itself uses a number of [[plugin channel]]s. These internal channels are prefixed with <code>MC|</code>.
 
 
 
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"| 0x18
+
  | <code>minecraft.clean_banner</code>
|rowspan="2"| Play
+
  | 40
|rowspan="2"| Client
+
  | None
| Channel
 
  | String (20)
 
  | Name of the [[plugin channel]] used to send the data
 
 
  |-
 
  |-
  | Data
+
  | <code>minecraft.clean_shulker_box</code>
| Byte Array
+
  | 41
| Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].  The length of this array must be inferred from the packet length.
+
| None
  |}
 
 
 
==== 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"| 0x19
+
  | <code>minecraft.interact_with_brewingstand</code>
  |rowspan="7"| Play
+
| 42
  |rowspan="7"| Client
+
  | None
  | Sound Name
+
|-
  | String (256)
+
  | <code>minecraft.interact_with_beacon</code>
  | All sound effect names as of 1.12.0 can be seen [http://pokechu22.github.io/Burger/1.12.html#sounds here].
+
| 43
 +
  | None
 +
  |-
 +
  | <code>minecraft.inspect_dropper</code>
 +
| 44
 +
| None
 +
|-
 +
| <code>minecraft.inspect_hopper</code>
 +
| 45
 +
| None
 +
|-
 +
| <code>minecraft.inspect_dispenser</code>
 +
| 46
 +
| None
 +
|-
 +
| <code>minecraft.play_noteblock</code>
 +
| 47
 +
| None
 +
|-
 +
| <code>minecraft.tune_noteblock</code>
 +
| 48
 +
| None
 +
|-
 +
| <code>minecraft.pot_flower</code>
 +
| 49
 +
| None
 +
|-
 +
| <code>minecraft.trigger_trapped_chest</code>
 +
| 50
 +
| None
 +
|-
 +
| <code>minecraft.open_enderchest</code>
 +
| 51
 +
| None
 +
|-
 +
| <code>minecraft.enchant_item</code>
 +
| 52
 +
| None
 +
|-
 +
| <code>minecraft.play_record</code>
 +
| 53
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_furnace</code>
 +
| 54
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_crafting_table</code>
 +
| 55
 +
| None
 +
|-
 +
| <code>minecraft.open_chest</code>
 +
| 56
 +
| None
 +
|-
 +
| <code>minecraft.sleep_in_bed</code>
 +
| 57
 +
| None
 +
|-
 +
| <code>minecraft.open_shulker_box</code>
 +
| 58
 +
| None
 +
|-
 +
| <code>minecraft.open_barrel</code>
 +
| 59
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_blast_furnace</code>
 +
| 60
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_smoker</code>
 +
| 61
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_lectern</code>
 +
| 62
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_campfire</code>
 +
| 63
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_cartography_table</code>
 +
| 64
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_loom</code>
 +
| 65
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_stonecutter</code>
 +
| 66
 +
| None
 +
|-
 +
| <code>minecraft.bell_ring</code>
 +
| 67
 +
| None
 
  |-
 
  |-
  | Sound Category
+
  | <code>minecraft.raid_trigger</code>
  | VarInt Enum
+
  | 68
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
+
  | None
 
  |-
 
  |-
  | Effect Position X
+
  | <code>minecraft.raid_win</code>
  | Int
+
  | 69
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | None
 
  |-
 
  |-
  | Effect Position Y
+
  | <code>minecraft.interact_with_anvil</code>
  | Int
+
  | 70
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | None
 
  |-
 
  |-
  | Effect Position Z
+
  | <code>minecraft.interact_with_grindstone</code>
  | Int
+
  | 71
  | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | None
 
  |-
 
  |-
  | Volume
+
  | <code>minecraft.target_hit</code>
  | Float
+
  | 72
  | 1 is 100%, can be more
+
  | None
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.interact_with_smithing_table</code>
  | Float
+
  | 73
  | Float between 0.5 and 2.0 by Notchian clients
+
  | None
 
  |}
 
  |}
  
==== Disconnect (play) ====
+
Units:
  
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.
+
* 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,461: Line 1,429:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x1A
+
  |rowspan="4"| 0x08
  | Play
+
  |rowspan="4"| Play
  | Client
+
  |rowspan="4"| Client
  | Reason
+
  | Location
  | [[Chat]]
+
| Position
  | Displayed to the client when the connection terminates.
+
| 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.
 
  |}
 
  |}
  
==== Entity Status ====
+
==== 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)
  
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).
+
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,481: Line 1,465:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1B
+
  |rowspan="3"| 0x09
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
 
  | Entity ID
 
  | Entity ID
  | Int
+
  | VarInt
  |  
+
  | Entity ID of the entity breaking the block.
 +
|-
 +
| Location
 +
| Position
 +
| Block Position.
 
  |-
 
  |-
  | Entity Status
+
  | Destroy Stage
  | Byte Enum
+
  | Byte
  | See below
+
  | 0–9 to set it, any other value to remove it.
 
  |}
 
  |}
  
See [[entities]] for a list of which statuses are valid for each type of entity.
+
==== Block Entity Data ====
 
 
==== 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
+
Sets the block entity associated with the block at the given location.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,509: Line 1,493:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x1C
+
  |rowspan="3"| 0x0A
  |rowspan="9"| Play
+
  |rowspan="3"| Play
  |rowspan="9"| Client
+
  |rowspan="3"| Client
  | X
+
  | Location
  | Float
+
  | Position
  |  
+
  |
 
  |-
 
  |-
  | Y
+
  | Type
  | Float
+
  | VarInt
  |  
+
  | The type of the block entity
 
  |-
 
  |-
  | Z
+
  | NBT Data
  | Float
+
  | [[NBT|NBT Tag]]
|  
+
  | 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).
  |-
 
  | Radius
 
| Float
 
| Currently unused in the client
 
|-
 
| Record Count
 
| Int
 
| Number of elements in the following array
 
|-
 
| Records
 
| Array of (Byte, Byte, Byte)
 
| Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
 
|-
 
| Player Motion X
 
| Float
 
| X velocity of the player being pushed by the explosion
 
|-
 
| Player Motion Y
 
| Float
 
| Y velocity of the player being pushed by the explosion
 
|-
 
| Player Motion Z
 
| Float
 
| Z velocity of the player being pushed by the explosion
 
 
  |}
 
  |}
  
==== Unload Chunk ====
+
''Action'' field:
  
Tells the client to unload a chunk column.
+
* '''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)
{| class="wikitable"
+
* '''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''': Unused
 +
* '''11''': Declare a bed
 +
* '''12''': Set data of a jigsaw block
 +
* '''13''': Set items in a campfire
 +
* '''14''': Beehive information
 +
 
 +
==== 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.}}
 +
 
 +
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 1,561: Line 1,542:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1D
+
  |rowspan="4"| 0x0B
  |rowspan="2"| Play
+
  |rowspan="4"| Play
  |rowspan="2"| Client
+
  |rowspan="4"| Client
  | Chunk X
+
  | Location
  | Int
+
| Position
  | Block coordinate divided by 16, rounded down
+
| Block coordinates.
 +
|-
 +
| Action ID (Byte 1)
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]].
 +
|-
 +
| Action Param (Byte 2)
 +
  | Unsigned Byte
 +
  | Varies depending on block — see [[Block Actions]].
 
  |-
 
  |-
  | Chunk Z
+
  | Block Type
  | Int
+
  | VarInt
  | Block coordinate divided by 16, rounded down
+
  | The block type ID for the block.  This must match the block at the given coordinates.
 
  |}
 
  |}
  
It is legal to send this packet even if the given chunk is not currently loaded.
+
==== Block Change ====
  
==== Change Game State ====
+
Fired whenever a block is changed within the render distance.
  
Used for a wide variety of game state things, from whether to bed use to gamemode to demo messages.
+
{{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"
 
{| class="wikitable"
Line 1,587: Line 1,576:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1E
+
  |rowspan="2"| 0x0C
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Reason
+
  | Location
  | Unsigned Byte
+
  | Position
  | See below
+
  | Block Coordinates.
 
  |-
 
  |-
  | Value
+
  | Block ID
  | Float
+
  | VarInt
  | Depends on Reason
+
  | 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.
 
  |}
 
  |}
  
''Reason codes'':
+
==== Boss Bar ====
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Reason
+
  ! Packet ID
  ! Effect
+
  ! State
  ! Value
+
  ! Bound To
 +
!colspan="2"| Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="14"| 0x0D
 +
|rowspan="14"| Play
 +
|rowspan="14"| Client
 +
|colspan="2"| UUID
 +
| UUID
 +
| Unique ID for this bar.
 
  |-
 
  |-
  | 0
+
  |colspan="2"| Action
  | Invalid Bed
+
  | VarInt Enum
  | Would be used to switch between messages, but the only used message is 0 for invalid bed
+
  | Determines the layout of the remaining packet.
 
  |-
 
  |-
  | 1
+
  ! Action
  | End raining
+
  ! Field Name
  |
+
  !
 +
!
 
  |-
 
  |-
  | 2
+
  |rowspan="5"| 0: add
  | Begin raining
+
| Title
 +
  | [[Chat]]
 
  |  
 
  |  
 
  |-
 
  |-
  | 3
+
  | Health
  | Change gamemode
+
  | Float
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
+
  | 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.
 
  |-
 
  |-
  | 4
+
  | Color
  | Exit end
+
  | VarInt Enum
  | 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?" achievement, while if they do have it 0 is used.
+
  | Color ID (see below).
 
  |-
 
  |-
  | 5
+
  | Division
  | Demo message
+
  | VarInt Enum
  | 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
+
  | Type of division (see below).
|-
 
| 6
 
| Arrow hitting player
 
| Appears to be played when an arrow strikes another player in Multiplayer
 
 
  |-
 
  |-
  | 7
+
  | Flags
  | Fade value
+
  | Unsigned Byte
  | The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
+
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02).
 
  |-
 
  |-
  | 8
+
  | 1: remove
  | Fade time
+
  | ''no fields''
  | Time in ticks for the sky to fade
+
  | ''no fields''
 +
| Removes this boss bar.
 
  |-
 
  |-
  | 10
+
  | 2: update health
  | Play elder guardian mob appearance (effect and sound)
+
  | Health
 +
| Float
 +
| ''as above''
 +
|-
 +
| 3: update title
 +
| Title
 +
| [[Chat]]
 
  |  
 
  |  
|}
 
 
==== 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.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x1F
+
  |rowspan="2"| 4: update style
  |rowspan="1"| Play
+
  | Color
  |rowspan="1"| Client
+
| VarInt Enum
  | Keep Alive ID
+
  | Color ID (see below).
  | VarInt
+
|-
  |  
+
  | Dividers
 +
  | VarInt Enum
 +
| ''as above''
 +
|-
 +
| 5: update flags
 +
| Flags
 +
| Unsigned Byte
 +
| ''as above''
 +
  |-
 
  |}
 
  |}
 
==== Chunk Data ====
 
{{Main|Chunk Format}}
 
{{See also|#Unload Chunk}}
 
 
The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which dimenison the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent.  This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with [[#Update Block Entity|Update Block Entity]] later).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Color
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="9"| 0x20
+
  | 0
|rowspan="9"| Play
+
  | Pink
|rowspan="9"| Client
 
| Chunk X
 
| Int
 
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
 
  |-
 
  |-
  | Chunk Z
+
  | 1
  | Int
+
  | Blue
| Chunk coordinate (block coordinate divided by 16, rounded down)
 
 
  |-
 
  |-
  | Ground-Up Continuous
+
  | 2
  | Boolean
+
  | Red
| See [[Chunk Format#Ground-up continuous|Chunk Format]]
 
 
  |-
 
  |-
  | Primary Bit Mask
+
  | 3
  | VarInt
+
  | Green
| 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).
 
|-
 
| Size
 
| VarInt
 
| Size of Data in bytes
 
 
  |-
 
  |-
  | Data
+
  | 4
  | Byte array
+
  | Yellow
| See [[Chunk Format#Data structure|data structure]] in Chunk Format
 
 
  |-
 
  |-
  | Number of block entities
+
  | 5
  | VarInt
+
  | Purple
| Length of the following array
 
 
  |-
 
  |-
  | Block entities
+
  | 6
  | Array of [[NBT|NBT Tag]]
+
  | White
| All block entities in the chunk.  Use the x, y, and z tags in the NBT to determine their positions.
 
 
  |}
 
  |}
 
==== Effect ====
 
 
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) and effect 1028 (enderdragon death); it is ignored on other effects.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Type of division
! Bound To
+
  |-
  ! Field Name
+
  | 0
  ! Field Type
+
  | No division
  ! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x21
+
  | 1
|rowspan="4"| Play
+
  | 6 notches
|rowspan="4"| Client
 
| Effect ID
 
| Int
 
  | The ID of the effect, see below
 
 
  |-
 
  |-
  | Location
+
  | 2
  | Position
+
  | 10 notches
| The location of the effect
 
 
  |-
 
  |-
  | Data
+
  | 3
  | Int
+
  | 12 notches
| Extra data for certain effects, see below
 
 
  |-
 
  |-
  | Disable Relative Volume
+
  | 4
  | Boolean
+
  | 20 notches
| See above
 
 
  |}
 
  |}
  
Effect IDs:
+
==== Server Difficulty ====
 +
 
 +
Changes the difficulty setting in the client's option menu
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! ID
+
  ! Packet ID
  ! Name
+
  ! State
  ! Data
+
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
! Notes
 
  |-
 
  |-
  !colspan="3"| Sound
+
  |rowspan="2"| 0x0E
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Difficulty
 +
| Unsigned Byte
 +
| 0: peaceful, 1: easy, 2: normal, 3: hard.
 
  |-
 
  |-
  | 1000
+
  | Difficulty locked?
  | Dispenser dispenses
+
  | Boolean
  |  
+
  |
  |-
+
  |}
  | 1001
+
 
  | Dispenser fails to dispense
+
==== 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | 1002
+
  |rowspan="3"| 0x0F
  | Dispenser shoots
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| JSON Data
 +
  | [[Chat]]
 +
  | Limited to 262144 bytes.
 
  |-
 
  |-
  | 1003
+
  | Position
  | Ender eye launched
+
  | Byte
  |  
+
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
 
  |-
 
  |-
  | 1004
+
  | Sender
  | Firework shot
+
  | UUID
  |  
+
  | Used by the Notchian client for the disableChat launch option. Setting both longs to 0 will always display the message regardless of the setting.
 +
|}
 +
 
 +
==== Clear Titles====
 +
 
 +
Clear the client's current title information, with the option to also reset it.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1005
+
  |rowspan="1"| 0x10
  | Iron door opened
+
  |rowspan="1"| Play
  |  
+
  |rowspan="1"| Client
|-
+
  | Reset
  | 1006
+
  | Boolean
  | Wooden door opened
 
 
  |  
 
  |  
 +
|}
 +
 +
==== 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
 
  |-
 
  |-
  | 1007
+
  |rowspan="8"| 0x11
  | Wooden trapdoor opened
+
  |rowspan="8"| Play
  |  
+
  |rowspan="8"| Client
 
  |-
 
  |-
  | 1008
+
  |colspan="2"| ID
  | Fence gate opened
+
  |colspan="2"| VarInt
  |  
+
  | Transaction ID.
 
  |-
 
  |-
  | 1009
+
  |colspan="2"| Start
  | Fire extinguished
+
  |colspan="2"| VarInt
  |  
+
  | Start of the text to replace.
 
  |-
 
  |-
  | 1010
+
  |colspan="2"| Length
  | Play record
+
  |colspan="2"| VarInt
  | Special case, see below for more info
+
  | Length of the text to replace.
 
  |-
 
  |-
  | 1011
+
  |colspan="2"| Count
  | Iron door closed
+
  |colspan="2"| VarInt
  |  
+
  | Number of elements in the following array.
 
  |-
 
  |-
  | 1012
+
  |rowspan="3"| Matches
  | Wooden door closed
+
  | 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.
 
  |-
 
  |-
  | 1013
+
  | Has tooltip
  | Wooden trapdoor closed
+
  | Boolean
  |  
+
  | True if the following is present.
 
  |-
 
  |-
  | 1014
+
  | Tooltip
  | Fence gate closed
+
  | Optional [[Chat]]
  |  
+
  | Tooltip to display; only present if previous boolean is true.
 +
|}
 +
 
 +
==== 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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1015
+
  |rowspan="3"| 0x12
  | Ghast warns
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Count
 +
  | VarInt
 +
  | Number of elements in the following array.
 
  |-
 
  |-
  | 1016
+
  | Nodes
  | Ghast shoots
+
  | Array of [[Command Data|Node]]
  |  
+
  | An array of nodes.
 
  |-
 
  |-
  | 1017
+
  | Root index
  | Enderdragon shoots
+
  | VarInt
  |  
+
  | Index of the <code>root</code> node in the previous array.
 +
|}
 +
 
 +
For more information on this packet, see the [[Command Data]] article.
 +
 
 +
==== 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. The notchian client disregards the provided window ID and closes any active window.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1018
+
  | 0x13
  | Blaze shoots
+
  | Play
  |  
+
  | Client
  |-
+
  | Window ID
  | 1019
+
  | Unsigned Byte
  | Zombie attacks wood door
+
  | 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. This packet with Window ID set to "0" is sent during the player joining sequence to initialise the player's inventory.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1020
+
  |rowspan="5"| 0x14
  | Zombie attacks iron door
+
|rowspan="5"| Play
  |  
+
|rowspan="5"| Client
 +
| Window ID
 +
  | Unsigned Byte
 +
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  | 1021
+
  | State ID
  | Zombie breaks wood door
+
  | VarInt
  |
+
  | See [[Protocol#Click_Window|State ID]]
 
  |-
 
  |-
  | 1022
+
  | Count
  | Wither breaks block
+
  | VarInt
  |
+
  | Number of elements in the following array.
 
  |-
 
  |-
  | 1023
+
  | Slot Data
  | Wither spawned
+
  | Array of [[Slot Data|Slot]]
|  
 
 
  |-
 
  |-
  | 1024
+
  | Carried Item
  | Wither shoots
+
  | [[Slot Data|Slot]]
  |
+
  | Item held by player.
  |-
+
  |}
  | 1025
+
 
  | Bat takes off
+
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
 
  |-
 
  |-
  | 1026
+
  |rowspan="3"| 0x15
  | Zombie infects
+
|rowspan="3"| Play
  |
+
|rowspan="3"| Client
 +
| Window ID
 +
  | Unsigned Byte
 +
  |  
 
  |-
 
  |-
  | 1027
+
  | Property
  | Zombie villager converted
+
  | Short
  |
+
  | The property to be updated, see below.
 
  |-
 
  |-
  | 1028
+
  | Value
  | Ender dragon death
+
  | Short
  |
+
  | The new value for the property, see below.
 +
|}
 +
 
 +
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  | 1029
+
  ! Window type
  | Anvil destroyed
+
  ! Property
  |
+
  ! Value
 
  |-
 
  |-
  | 1030
+
  |rowspan="4"| Furnace
  | Anvil used
+
  | 0: Fire icon (fuel left)
  |  
+
  | counting from fuel burn time down to 0 (in-game ticks)
 
  |-
 
  |-
  | 1031
+
  | 1: Maximum fuel burn time
| Anvil landed
+
  | fuel burn time or 0 (in-game ticks)
  |
 
 
  |-
 
  |-
  | 1032
+
  | 2: Progress arrow
| Portal travel
+
  | counting from 0 to maximum progress (in-game ticks)
  |  
 
 
  |-
 
  |-
  | 1033
+
  | 3: Maximum progress
| Chorus flower grown
+
  | always 200 on the notchian server
  |
 
 
  |-
 
  |-
  | 1034
+
  |rowspan="10"| Enchantment Table
  | Chorus flower died
+
  | 0: Level requirement for top enchantment slot
  |  
+
  |rowspan="3"| The enchantment's xp level requirement
 
  |-
 
  |-
  | 1035
+
  | 1: Level requirement for middle enchantment slot
| Brewing stand brewed
 
|
 
 
  |-
 
  |-
  | 1036
+
  | 2: Level requirement for bottom enchantment slot
| Iron trapdoor opened
 
|
 
 
  |-
 
  |-
  | 1037
+
  | 3: The enchantment seed
  | Iron trapdoor closed
+
  | 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>).
  |
 
 
  |-
 
  |-
  !colspan="3"| Particle
+
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
 +
|rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
 
  |-
 
  |-
  | 2000
+
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
| Spawns 10 smoke particles, e.g. from a fire
 
| Direction, see below
 
 
  |-
 
  |-
  | 2001
+
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
| Block break + block break sound
 
| {{Minecraft Wiki|Data values|Block ID}}
 
 
  |-
 
  |-
  | 2002/2007
+
  | 7: Enchantment level shown on mouse hover over the top slot
  | Splash potion. Particle effect + glass break sound.
+
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
 
  |-
 
  |-
  | 2003
+
  | 8: Enchantment level shown on mouse hover over the middle slot
| Eye of Ender entity break animation — particles and sound
 
|
 
 
  |-
 
  |-
  | 2004
+
  | 9: Enchantment level shown on mouse hover over the bottom slot
  | Mob spawn particle effect: smoke + flames
+
|-
  |  
+
|rowspan="3"| Beacon
 +
| 0: Power level
 +
| 0-4, controls what effect buttons are enabled
 +
|-
 +
  | 1: First potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
 +
|-
 +
| 2: Second potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
 +
|-
 +
| Anvil
 +
| 0: Repair cost
 +
| The repair's cost in xp levels
 +
|-
 +
|rowspan="2"| Brewing Stand
 +
| 0: Brew time
 +
  | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
  |-
 
  |-
  | 2005
+
  | 1: Fuel time
  | Bonemeal particles
+
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
| How many particles to spawn (if set to 0, 15 are spawned)
 
 
  |-
 
  |-
  | 2006
+
  | Stonecutter
  | Dragon breath
+
  | 0: Selected recipe
  |
+
  | The index of the selected recipe. -1 means none is selected.
 
  |-
 
  |-
  | 3000
+
  | Loom
  | End gateway spawn
+
  | 0: Selected pattern
  |  
+
  | The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern.
 
  |-
 
  |-
  | 3001
+
  | Lectern
  | Enderdragon growl
+
  | 0: Page number
  |
+
  | The current page number, starting from 0.
 
  |}
 
  |}
  
Smoke directions:
+
For an enchanting table, the following numerical IDs are used:
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! ID
+
  ! Numerical ID
  ! Direction
+
  ! Enchantment ID
 +
! Enchantment Name
 
  |-
 
  |-
 
  | 0
 
  | 0
  | South-East
+
  | minecraft:protection
 +
| Protection
 
  |-
 
  |-
 
  | 1
 
  | 1
  | South
+
  | minecraft:fire_protection
 +
| Fire Protection
 
  |-
 
  |-
 
  | 2
 
  | 2
  | South-West
+
  | minecraft:feather_falling
 +
| Feather Falling
 
  |-
 
  |-
 
  | 3
 
  | 3
  | East
+
  | minecraft:blast_protection
 +
| Blast Protection
 
  |-
 
  |-
 
  | 4
 
  | 4
  | (Up or middle ?)
+
  | minecraft:projectile_protection
 +
| Projectile Protection
 
  |-
 
  |-
 
  | 5
 
  | 5
  | West
+
  | minecraft:respiration
 +
| Respiration
 
  |-
 
  |-
 
  | 6
 
  | 6
  | North-East
+
  | minecraft:aqua_affinity
 +
| Aqua Affinity
 
  |-
 
  |-
 
  | 7
 
  | 7
  | North
+
  | minecraft:thorns
 +
| Thorns
 
  |-
 
  |-
 
  | 8
 
  | 8
  | North-West
+
  | minecraft:depth_strider
  |}
+
| Depth Strider
 
+
|-
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.
+
  | 9
 
+
| minecraft:frost_walker
==== Particle ====
+
| Frost Walker
 
+
|-
Displays the named particle
+
| 10
 
+
| minecraft:binding_curse
{| class="wikitable"
+
| Curse of Binding
  ! Packet ID
+
|-
  ! State
+
| 11
  ! Bound To
+
  | minecraft:soul_speed
  ! Field Name
+
  | Soul Speed
  ! Field Type
+
  |-
  ! Notes
+
  | 12
 +
  | minecraft:sharpness
 +
  | Sharpness
 
  |-
 
  |-
  |rowspan="11"| 0x22
+
  | 13
|rowspan="11"| Play
+
  | minecraft:smite
|rowspan="11"| Client
+
  | Smite
| Particle ID
 
  | Int
 
  | See below
 
 
  |-
 
  |-
  | Long Distance
+
  | 14
  | Boolean
+
  | minecraft:bane_of_arthropods
  | If true, particle distance increases from 256 to 65536
+
  | Bane of Arthropods
 
  |-
 
  |-
  | X
+
  | 15
  | Float
+
  | minecraft:knockback
  | X position of the particle
+
  | Knockback
 
  |-
 
  |-
  | Y
+
  | 16
  | Float
+
  | minecraft:fire_aspect
  | Y position of the particle
+
  | Fire Aspect
 
  |-
 
  |-
  | Z
+
  | 17
  | Float
+
  | minecraft:looting
  | Z position of the particle
+
  | Looting
 
  |-
 
  |-
  | Offset X
+
  | 18
  | Float
+
  | minecraft:sweeping
  | This is added to the X position after being multiplied by random.nextGaussian()
+
  | Sweeping Edge
 
  |-
 
  |-
  | Offset Y
+
  | 19
  | Float
+
  | minecraft:efficiency
  | This is added to the Y position after being multiplied by random.nextGaussian()
+
  | Efficiency
 
  |-
 
  |-
  | Offset Z
+
  | 20
  | Float
+
  | minecraft:silk_touch
  | This is added to the Z position after being multiplied by random.nextGaussian()
+
  | Silk Touch
 
  |-
 
  |-
  | Particle Data
+
  | 21
  | Float
+
  | minecraft:unbreaking
  | The data of each particle
+
  | Unbreaking
 
  |-
 
  |-
  | Particle Count
+
  | 22
  | Int
+
  | minecraft:fortune
  | The number of particles to create
+
  | Fortune
 
  |-
 
  |-
  | Data
+
  | 23
  | Array of VarInt
+
  | minecraft:power
  | Length depends on particle. "iconcrack" has length of 2, "blockcrack", and "blockdust" have lengths of 1, the rest have 0.
+
  | Power
|}
 
 
 
Particle IDs:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Particle Name
+
  | 24
  ! Particle ID
+
  | minecraft:punch
 +
| Punch
 
  |-
 
  |-
  | explode
+
  | 25
  | 0
+
  | minecraft:flame
 +
| Flame
 
  |-
 
  |-
  | largeexplode
+
  | 26
  | 1
+
  | minecraft:infinity
 +
| Infinity
 
  |-
 
  |-
  | hugeexplosion
+
  | 27
  | 2
+
  | minecraft:luck_of_the_sea
 +
| Luck of the Sea
 
  |-
 
  |-
  | fireworksSpark
+
  | 28
  | 3
+
  | minecraft:lure
 +
| Lure
 
  |-
 
  |-
  | bubble
+
  | 29
  | 4
+
  | minecraft:loyalty
 +
| Loyalty
 
  |-
 
  |-
  | splash
+
  | 30
  | 5
+
  | minecraft:impaling
 +
| Impaling
 
  |-
 
  |-
  | wake
+
  | 31
  | 6
+
  | minecraft:riptide
 +
| Riptide
 
  |-
 
  |-
  | suspended
+
  | 32
  | 7
+
  | minecraft:channeling
 +
| Channeling
 
  |-
 
  |-
  | depthsuspend
+
  | 33
  | 8
+
  | minecraft:multishot
 +
| Multishot
 
  |-
 
  |-
  | crit
+
  | 34
  | 9
+
  | minecraft:quick_charge
 +
| Quick Charge
 
  |-
 
  |-
  | magicCrit
+
  | 35
  | 10
+
  | minecraft:piercing
 +
| Piercing
 
  |-
 
  |-
  | smoke
+
  | 36
  | 11
+
  | minecraft:mending
 +
| Mending
 
  |-
 
  |-
  | largesmoke
+
  | 37
  | 12
+
  | minecraft:vanishing_curse
 +
| Curse of Vanishing
 +
|}
 +
 
 +
==== Set Slot ====
 +
 
 +
Sent by the server when an item in a slot (in a window) is added/removed.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | spell
+
  |rowspan="4"| 0x16
  | 13
+
|rowspan="4"| Play
  |-
+
  |rowspan="4"| Client
  | instantSpell
+
  | Window ID
  | 14
+
  | 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).
 
  |-
 
  |-
  | mobSpell
+
  | State ID
  | 15
+
  | VarInt
 +
| See [[Protocol#Click_Window|State ID]]
 
  |-
 
  |-
  | mobSpellAmbient
+
  | Slot
  | 16
+
  | Short
 +
| The slot that should be updated.
 
  |-
 
  |-
  | witchMagic
+
  | Slot Data
  | 17
+
  | [[Slot Data|Slot]]
 +
|
 +
|}
 +
 
 +
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
 
  |-
 
  |-
  | dripWater
+
  |rowspan="2"| 0x17
  | 18
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Item ID
 +
| VarInt
 +
  | Numeric ID of the item to apply a cooldown to.
 
  |-
 
  |-
  | dripLava
+
  | Cooldown Ticks
  | 19
+
  | VarInt
  |-
+
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
  | angryVillager
+
  |}
| 20
+
 
  |-
+
==== Plugin Message (clientbound) ====
  | happyVillager
+
 
  | 21
+
{{Main|Plugin channels}}
  |-
+
 
  | townaura
+
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.
  | 22
+
 
 +
More documentation on this: [https://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ https://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/]
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
  ! State
 +
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | note
+
  |rowspan="2"| 0x18
  | 23
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Channel
 +
| Identifier
 +
  | Name of the [[plugin channel]] used to send the data.
 
  |-
 
  |-
  | portal
+
  | Data
  | 24
+
  | 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.
 +
|}
 +
 
 +
==== 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
 
  |-
 
  |-
  | enchantmenttable
+
  |rowspan="7"| 0x19
  | 25
+
|rowspan="7"| Play
 +
|rowspan="7"| Client
 +
| Sound Name
 +
| Identifier
 +
  | All sound effect names as of 1.16.5 can be seen [https://pokechu22.github.io/Burger/1.16.5.html#sounds here].
 
  |-
 
  |-
  | flame
+
  | Sound Category
  | 26
+
  | VarInt Enum
 +
| The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories]).
 
  |-
 
  |-
  | lava
+
  | Effect Position X
  | 27
+
  | Int
 +
| Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | footstep
+
  | Effect Position Y
  | 28
+
  | Int
 +
| Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | cloud
+
  | Effect Position Z
  | 29
+
  | Int
 +
| Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | reddust
+
  | Volume
  | 30
+
  | Float
 +
| 1 is 100%, can be more.
 
  |-
 
  |-
  | snowballpoof
+
  | Pitch
  | 31
+
  | Float
  |-
+
  | Float between 0.5 and 2.0 by Notchian clients.
| snowshovel
 
| 32
 
|-
 
| slime
 
| 33
 
|-
 
| heart
 
| 34
 
|-
 
| barrier
 
| 35
 
|-
 
| iconcrack_(id)_(data)
 
| 36
 
|-
 
| blockcrack_(id+(data<<12))
 
| 37
 
|-
 
| blockdust_(id)
 
| 38
 
|-
 
| droplet
 
| 39
 
|-
 
| take
 
| 40
 
|-
 
| mobappearance
 
| 41
 
|-
 
| dragonbreath
 
| 42
 
|-
 
| endrod
 
| 43
 
|-
 
| damageindicator
 
| 44
 
|-
 
| sweepattack
 
| 45
 
|-
 
| fallingdust
 
| 46
 
 
  |}
 
  |}
  
==== Join Game ====
+
==== Disconnect (play) ====
  
See [[Protocol Encryption]] for information on logging in.
+
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"
 
{| class="wikitable"
Line 2,208: Line 2,334:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x23
+
  | 0x1A
  |rowspan="7"| Play
+
  | Play
  |rowspan="7"| Client
+
  | Client
  | Entity ID
+
  | Reason
| Int
+
  | [[Chat]]
| The player's Entity ID (EID)
+
  | Displayed to the client when the connection terminates.
|-
 
| Gamemode
 
| Unsigned Byte
 
| 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.
 
|-
 
| Difficulty
 
| Unsigned Byte
 
| 0: peaceful, 1: easy, 2: normal, 3: hard
 
|-
 
| 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, default_1_1
 
|-
 
| Reduced Debug Info
 
| Boolean
 
| If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}.  For servers in development, this should almost always be false.
 
 
  |}
 
  |}
  
==== Map ====
+
==== Entity Status ====
  
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
+
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"
Line 2,248: Line 2,350:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="13"| 0x24
+
  |rowspan="2"| 0x1B
  |rowspan="13"| Play
+
  |rowspan="2"| Play
  |rowspan="13"| Client
+
  |rowspan="2"| Client
  |colspan="2"| Item Damage
+
  | Entity ID
  |colspan="2"| VarInt
+
  | Int
  | The damage value (map ID) of the map being modified
+
  |  
 
  |-
 
  |-
  |colspan="2"| Scale
+
  | Entity Status
  |colspan="2"| Byte
+
  | Byte Enum
  | From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
+
  | See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
|-
+
|}
|colspan="2"| Tracking Position
+
 
  |colspan="2"| Boolean
+
==== Explosion ====
  | Specifies whether the icons are shown
+
 
  |-
+
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
  |colspan="2"| Icon Count
+
 
  |colspan="2"| VarInt
+
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
  | Number of elements in the following array
+
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
  ! State
 +
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  |rowspan="9"| 0x1C
  | Direction And Type
+
  |rowspan="9"| Play
  |rowspan="3"| Array
+
  |rowspan="9"| Client
  | Byte
+
  | X
  | 0xF0 = Direction, 0x0F = Type
+
| Float
 +
  |  
 
  |-
 
  |-
  | X
+
  | Y
  | Byte
+
  | Float
 
  |  
 
  |  
 
  |-
 
  |-
 
  | Z
 
  | Z
  | Byte
+
  | Float
 
  |  
 
  |  
|-
 
|colspan="2"| Columns
 
|colspan="2"| Byte
 
| Number of columns updated
 
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | Strength
  |colspan="2"| Optional Byte
+
  | Float
  | Only if Columns is more than 0; number of rows updated
+
  | 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.
 
  |-
 
  |-
  |colspan="2"| X
+
  | Record Count
  |colspan="2"| Optional Byte
+
  | VarInt
  | Only if Columns is more than 0; x offset of the westernmost column
+
  | Number of elements in the following array.
 
  |-
 
  |-
  |colspan="2"| Z
+
  | Records
  |colspan="2"| Optional Byte
+
  | Array of (Byte, Byte, Byte)
  | Only if Columns is more than 0; z offset of the northernmost row
+
  | Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
 +
|-
 +
| Player Motion X
 +
| Float
 +
| X velocity of the player being pushed by the explosion.
 
  |-
 
  |-
  |colspan="2"| Length
+
  | Player Motion Y
  |colspan="2"| Optional VarInt
+
  | Float
  | Only if Columns is more than 0; length of the following array
+
  | Y velocity of the player being pushed by the explosion.
 
  |-
 
  |-
  |colspan="2"| Data
+
  | Player Motion Z
  |colspan="2"| Optional Array of Unsigned Byte
+
  | Float
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
+
  | Z velocity of the player being pushed by the explosion.
 
  |}
 
  |}
  
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
+
==== Unload Chunk ====
  
Types are based off of rows and columns in <code>map_icons.png</code>:
+
Tells the client to unload a chunk column.
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Icon type
+
  |rowspan="2"| 0x1D
  ! Result
+
  |rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Chunk X
 +
| Int
 +
| Block coordinate divided by 16, rounded down.
 
  |-
 
  |-
  | 0
+
| Chunk Z
  | White arrow (players)
+
| Int
  |-
+
| Block coordinate divided by 16, rounded down.
  | 1
+
|}
  | Green arrow (item frames)
+
 
  |-
+
It is legal to send this packet even if the given chunk is not currently loaded.
  | 2
+
 
  | Red arrow
+
==== Change Game State ====
 +
 
 +
Used for a wide variety of game state things, from weather to bed use to gamemode to demo messages.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x1E
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Reason
 +
| Unsigned Byte
 +
| See below.
 +
|-
 +
| Value
 +
| Float
 +
| Depends on Reason.
 +
|}
 +
 
 +
''Reason codes'':
 +
 
 +
{| class="wikitable"
 +
! Reason
 +
! Effect
 +
! Value
 +
|-
 +
  | 0
 +
  | 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.
 +
  |-
 +
  | 1
 +
  | End raining
 +
|
 +
  |-
 +
  | 2
 +
  | Begin raining
 +
|
 
  |-
 
  |-
 
  | 3
 
  | 3
  | Blue arrow
+
  | Change gamemode
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
 
  |-
 
  |-
 
  | 4
 
  | 4
  | White cross
+
  | 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.
 
  |-
 
  |-
 
  | 5
 
  | 5
  | Red pointer
+
  | 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
 
  | 6
  | White circle (off-map players)
+
  | Arrow hit player
 +
| Note: Sent when any player is struck by an arrow.
 
  |-
 
  |-
 
  | 7
 
  | 7
  | Small white circle (far-off-map players)
+
  | Rain level change
 +
| Note: Seems to change both skycolor and lightning.<br>Rain level starting from 0 to 1.
 
  |-
 
  |-
 
  | 8
 
  | 8
  | Mansion
+
  | 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>Thunder level starting from 0 to 1.
 
  |-
 
  |-
 
  | 9
 
  | 9
  | Temple
+
  | Play pufferfish sting sound.
 
  |-
 
  |-
  | 10-15
+
  | 10
  | Unused (blue square)
+
| Play elder guardian mob appearance (effect and sound).
  |}
+
|
 +
|-
 +
  | 11
 +
| Enable respawn screen
 +
|  0: Enable respawn screen, 1: Immediately respawn (sent when the doImmediateRespawn gamerule changes).
 +
  |}
  
==== Entity ====
+
==== Open Horse Window ====
  
This packet may be used to initialize an entity.
+
This packet is used exclusively for opening the horse GUI. [[#Open Window|Open Window]] is used for all other GUIs. The client will not open the inventory if the Entity ID does not point to an horse-like animal.
 
 
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,367: Line 2,537:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x25
+
  |rowspan="3"| 0x1F
  |rowspan="1"| Play
+
  |rowspan="3"| Play
  |rowspan="1"| Client
+
  |rowspan="3"| Client
 +
| Window ID
 +
| Unsigned Byte
 +
|
 +
|-
 +
| Slot count
 +
| VarInt
 +
|
 +
|-
 
  | Entity ID
 
  | Entity ID
  | VarInt
+
  | Integer
  |  
+
  |
 
  |}
 
  |}
  
==== Entity Relative Move ====
+
==== Initialize World Border ====  
 
 
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]] ([[#Play|Play]], 0x4A, clientbound) 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"
 
{| class="wikitable"
Line 2,389: Line 2,563:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x26
+
  |rowspan="8"| 0x20
  |rowspan="5"| Play
+
  |rowspan="8"| Play
  |rowspan="5"| Client
+
  |rowspan="8"| Client
  | Entity ID
+
  | X
  | VarInt
+
  | Double
 
  |  
 
  |  
 
  |-
 
  |-
  | Delta X
+
  | Z
  | Short
+
  | Double
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
  |  
 
  |-
 
  |-
  | Delta Y
+
  | Old Diameter
  | Short
+
  | Double
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
  | Current length of a single side of the world border, in meters.
 
  |-
 
  |-
  | Delta Z
+
  | New Diameter
  | Short
+
  | Double
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
+
  | Target length of a single side of the world border, in meters.
 +
|-
 +
| Speed
 +
| VarLong
 +
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 +
|-
 +
| Portal Teleport Boundary
 +
| VarInt
 +
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 +
|-
 +
| Warning Blocks
 +
| VarInt
 +
| In meters.
 +
|-
 +
| Warning Time
 +
| VarInt
 +
| In seconds as set by <code>/worldborder warning time</code>.
 
  |-
 
  |-
| On Ground
 
| Boolean
 
|
 
 
  |}
 
  |}
  
==== Entity Look And Relative Move ====
+
The Notchian client determines how solid to display the warning by comparing to whichever is higher, the warning distance or whichever is lower, the distance from the current diameter to the target diameter or the place the border will be after warningTime seconds. In pseudocode:
 +
 
 +
<syntaxhighlight lang="java">
 +
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 +
if (playerDistance < distance) {
 +
    warning = 1.0 - playerDistance / distance;
 +
} else {
 +
    warning = 0.0;
 +
}
 +
</syntaxhighlight>
 +
 
 +
==== Keep Alive (clientbound) ====
 +
 
 +
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same payload (see [[#Keep Alive (serverbound)|serverbound Keep Alive]]). 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.
  
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>)
+
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,425: Line 2,625:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x27
+
  | 0x21
  |rowspan="7"| Play
+
  | Play
  |rowspan="7"| Client
+
  | Client
  | Entity ID
+
  | Keep Alive ID
  | VarInt
+
  | Long
 
  |  
 
  |  
  |-
+
  |}
| Delta X
+
 
| Short
+
==== Chunk Data And Update Light ====
| Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
{{Main|Chunk Format}}
|-
+
{{See also|#Unload Chunk}}
| Delta Y
+
 
| Short
+
{{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)}}
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
 
|-
+
The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which dimension 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).
| Delta Z
 
  | Short
 
| Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 
|-
 
| Yaw
 
| Angle
 
| New angle, not a delta
 
|-
 
| Pitch
 
| Angle
 
| New angle, not a delta
 
|-
 
| On Ground
 
  | Boolean
 
|
 
|}
 
 
 
==== Entity Look ====
 
 
 
This packet is sent by the server when an entity rotates.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,465: Line 2,645:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x28
+
  |rowspan="25"| 0x22
  |rowspan="4"| Play
+
  |rowspan="25"| Play
  |rowspan="4"| Client
+
  |rowspan="25"| Client
  | Entity ID
+
  |colspan="2"| Chunk X
  | VarInt
+
|colspan="2"| Int
  |  
+
| Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
|colspan="2"| Chunk Z
 +
  |colspan="2"| Int
 +
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | Yaw
+
  |colspan="2"| Heightmaps
  | Angle
+
  |colspan="2"| [[NBT]]
  | New angle, not a delta
+
  | 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 37 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.
 
  |-
 
  |-
  | Pitch
+
  |colspan="2"| Size
  | Angle
+
  |colspan="2"| VarInt
  | New angle, not a delta
+
  | Size of Data in bytes
 
  |-
 
  |-
  | On Ground
+
  |colspan="2"| Data
  | Boolean
+
|colspan="2"| Byte array
  |  
+
| See [[Chunk Format#Data structure|data structure]] in Chunk Format
  |}
+
|-
 
+
|colspan="2"| Number of block entities
==== Vehicle Move (clientbound) ====
+
|colspan="2"| VarInt
 +
| Number of elements in the following array
 +
|-
 +
|rowspan="4" | Block Entity
 +
| Packed XZ
 +
|rowspan="4" | Array
 +
| Byte
 +
| The packed section coordinates, calculated from <code><nowiki>((blockX & 15) << 4) | (blockZ & 15)</nowiki></code>
 +
  |-
 +
| Y
 +
| Short
 +
| The height relative to the world
 +
|-
 +
| Type
 +
| VarInt
 +
| The type of block entity
 +
|-
 +
| Data
 +
| [[NBT]]
 +
| The block entity's data, without the X, Y, and Z values
 +
|-
 +
|colspan="2"| Trust Edges
 +
|colspan="2"| Boolean
 +
  | If edges should be trusted for light updates.
 +
|-
 +
|colspan="2"| Sky Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Sky Light array below.  The least significant bit is for blocks 16 blocks to 1 block below the min world height (one section below the world), while the most significant bit covers blocks 1 to 16 blocks above the max world height (one section above the world).
 +
|-
 +
|colspan="2"| Block Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Block Light array below.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Empty Sky Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Sky Light data.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Empty Block Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Block Light data.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Sky Light array count
 +
|colspan="2"| VarInt
 +
| Number of entries in the following array; should match the number of bits set in Sky Light Mask
 +
|-
 +
|rowspan="2"| Sky Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Sky Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the sky light mask, starting with the lowest value.  Half a byte per light value.
 +
|-
 +
|colspan="2"| Block Light array count
 +
|colspan="2"| VarInt
 +
| Number of entries in the following array; should match the number of bits set in Block Light Mask
 +
|-
 +
|rowspan="2"| Block Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Block Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the block light mask, starting with the lowest value.  Half a byte per light value.
 +
  |}
 +
 
 +
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.
 +
 
 +
The compacted array format has been adjusted so that individual entries no longer span across multiple longs, affecting the main data array and heightmaps.
 +
 
 +
New format, 5 bits per block, containing the following references to blocks in a palette (not shown): <span style="border: solid 2px hsl(0, 90%, 60%)">1</span><span style="border: solid 2px hsl(30, 90%, 60%)">2</span><span style="border: solid 2px hsl(60, 90%, 60%)">2</span><span style="border: solid 2px hsl(90, 90%, 60%)">3</span><span style="border: solid 2px hsl(120, 90%, 60%)">4</span><span style="border: solid 2px hsl(150, 90%, 60%)">4</span><span style="border: solid 2px hsl(180, 90%, 60%)">5</span><span style="border: solid 2px hsl(210, 90%, 60%)">6</span><span style="border: solid 2px hsl(240, 90%, 60%)">6</span><span style="border: solid 2px hsl(270, 90%, 60%)">4</span><span style="border: solid 2px hsl(300, 90%, 60%)">8</span><span style="border: solid 2px hsl(330, 90%, 60%)">0</span><span style="border: solid 2px hsl(0, 90%, 30%)">7</span><span style="border: solid 2px hsl(30, 90%, 30%)">4</span><span style="border: solid 2px hsl(60, 90%, 30%)">3</span><span style="border: solid 2px hsl(90, 90%, 30%)">13</span><span style="border: solid 2px hsl(120, 90%, 30%)">15</span><span style="border: solid 2px hsl(150, 90%, 30%)">16</span><span style="border: solid 2px hsl(180, 90%, 30%)">9</span><span style="border: solid 2px hsl(210, 90%, 30%)">14</span><span style="border: solid 2px hsl(240, 90%, 30%)">10</span><span style="border: solid 2px hsl(270, 90%, 30%)">12</span><span style="border: solid 2px hsl(300, 90%, 30%)">0</span><span style="border: solid 2px hsl(330, 90%, 30%)">2</span>
 +
 
 +
<code>0020863148418841</code> <code><span style="outline: dashed 2px black">0000</span><span style="outline: solid 2px hsl(330, 90%, 60%)">00000</span><span style="outline: solid 2px hsl(300, 90%, 60%)">01000</span><span style="outline: solid 2px hsl(270, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(240, 90%, 60%)">00110</span><span style="outline: solid 2px hsl(210, 90%, 60%)">00110</span><span style="outline: solid 2px hsl(180, 90%, 60%)">00101</span><span style="outline: solid 2px hsl(150, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(120, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(90, 90%, 60%)">00011</span><span style="outline: solid 2px hsl(60, 90%, 60%)">00010</span><span style="outline: solid 2px hsl(30, 90%, 60%)">00010</span><span style="outline: solid 2px hsl(0, 90%, 60%)">00001</span></code><br>
 +
<code>01018A7260F68C87</code> <code><span style="outline: dashed 2px black">0000</span><span style="outline: solid 2px hsl(330, 90%, 30%)">00010</span><span style="outline: solid 2px hsl(300, 90%, 30%)">00000</span><span style="outline: solid 2px hsl(270, 90%, 30%)">01100</span><span style="outline: solid 2px hsl(240, 90%, 30%)">01010</span><span style="outline: solid 2px hsl(210, 90%, 30%)">01110</span><span style="outline: solid 2px hsl(180, 90%, 30%)">01001</span><span style="outline: solid 2px hsl(150, 90%, 30%)">10000</span><span style="outline: solid 2px hsl(120, 90%, 30%)">01111</span><span style="outline: solid 2px hsl(90, 90%, 30%)">01101</span><span style="outline: solid 2px hsl(60, 90%, 30%)">00011</span><span style="outline: solid 2px hsl(30, 90%, 30%)">00100</span><span style="outline: solid 2px hsl(0, 90%, 30%)">00111</span></code>
 +
 
 +
==== Effect ====
 +
Sent when a client is to play a sound or particle effect.
  
Note that all fields use absolute positioning and do not allow for relative positioning.
+
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"
 
{| class="wikitable"
Line 2,501: Line 2,765:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x29
+
  |rowspan="4"| 0x23
  |rowspan="7"| Play
+
  |rowspan="4"| Play
  |rowspan="7"| Client
+
  |rowspan="4"| Client
  | X
+
  | Effect ID
  | Double
+
  | Int
  | Absolute position (X coordinate)
+
  | The ID of the effect, see below.
 
  |-
 
  |-
  | Y
+
  | Location
  | Double
+
  | Position
  | Absolute position (Y coordinate)
+
  | The location of the effect.
 
  |-
 
  |-
  | Z
+
  | Data
  | Double
+
  | Int
  | Absolute position (Z coordinate)
+
  | Extra data for certain effects, see below.
 
  |-
 
  |-
  | Yaw
+
  | Disable Relative Volume
  | Float
+
  | Boolean
  | Absolute rotation on the vertical axis, in degrees
+
  | See above.
|-
 
| Pitch
 
| Float
 
| Absolute rotation on the horizontal axis, in degrees
 
 
  |}
 
  |}
  
==== Open Sign Editor ====
+
Effect IDs:
 
 
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]].
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Name
  ! Bound To
+
  ! Data
  ! Field Name
+
|-
  ! Field Type
+
  !colspan="3"| Sound
  ! Notes
+
|-
 +
| 1000
 +
  | Dispenser dispenses
 +
  |
 
  |-
 
  |-
  |rowspan="1"| 0x2A
+
  | 1001
  |rowspan="1"| Play
+
| Dispenser fails to dispense
  |rowspan="1"| Client
+
  |  
  | Location
+
  |-
  | Position
+
  | 1002
 +
  | Dispenser shoots
 
  |  
 
  |  
|}
 
 
==== Player Abilities (clientbound) ====
 
 
The latter 2 floats are used to indicate the field of view and flying speed respectively, while the first byte is used to determine the value of 4 booleans.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x2B
+
  | 1003
|rowspan="3"| Play
+
  | Ender eye launched
|rowspan="3"| Client
+
  |  
| Flags
 
  | Byte
 
  | Bit field, see below
 
 
  |-
 
  |-
  | Flying Speed
+
  | 1004
  | Float
+
  | Firework shot
 
  |  
 
  |  
 
  |-
 
  |-
  | Field of View Modifier
+
  | 1005
  | Float
+
  | Iron door opened
  | 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
+
  | 1006
  ! Bit
+
  | Wooden door opened
 +
|
 
  |-
 
  |-
  | Invulnerable
+
  | 1007
  | 0x01
+
| Wooden trapdoor opened
 +
  |  
 
  |-
 
  |-
  | Flying
+
  | 1008
  | 0x02
+
| Fence gate opened
 +
  |  
 
  |-
 
  |-
  | Allow Flying
+
  | 1009
  | 0x04
+
| Fire extinguished
 +
  |  
 
  |-
 
  |-
  | Creative Mode
+
  | 1010
  | 0x08
+
  | Play record
  |}
+
  | Special case, see below for more info.
 
 
==== Combat Event ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="8"| 0x2C
+
  | 1011
|rowspan="8"| Play
+
  | Iron door closed
|rowspan="8"| Client
+
  |  
|colspan="2"| Event
 
  | VarInt Enum
 
  | Determines the layout of the remaining packet
 
 
  |-
 
  |-
  ! Event
+
  | 1012
  ! Field Name
+
  | Wooden door closed
  !
+
  |
!
 
 
  |-
 
  |-
  | 0: enter combat
+
  | 1013
  | ''no fields''
+
  | Wooden trapdoor closed
| ''no fields''
 
 
  |  
 
  |  
 
  |-
 
  |-
  |rowspan="2"| 1: end combat
+
  | 1014
| Duration
+
  | Fence gate closed
  | VarInt
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Entity ID
+
  | 1015
  | Int
+
  | Ghast warns
 
  |  
 
  |  
 
  |-
 
  |-
  |rowspan="3"| 2: entity dead
+
  | 1016
| Player ID
+
  | Ghast shoots
  | VarInt
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Entity ID
+
  | 1017
  | Int
+
  | Enderdragon shoots
 
  |  
 
  |  
 
  |-
 
  |-
  | Message
+
  | 1018
  | [[Chat]]
+
  | Blaze shoots
 
  |  
 
  |  
|}
 
 
==== Player List Item ====
 
 
Sent by the server to update the user list (<tab> in the client).
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="4"| Field Name
 
!colspan="3"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="19"| 0x2D
+
  | 1019
|rowspan="19"| Play
+
  | Zombie attacks wood door
|rowspan="19"| Client
+
  |  
  |colspan="4"| Action
 
|colspan="3"| VarInt
 
  | Determines the rest of the Player format after the UUID
 
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  | 1020
|colspan="3"| VarInt
+
  | Zombie attacks iron door
| Number of elements in the following array
 
|-
 
|rowspan="17"| Player
 
|colspan="3"| UUID
 
|rowspan="17"| Array
 
  |colspan="2"| UUID
 
 
  |  
 
  |  
 
  |-
 
  |-
  ! Action
+
  | 1021
  !colspan="2"| Field Name
+
  | Zombie breaks wood door
  !colspan="2"|  
+
  |
!
 
 
  |-
 
  |-
  |rowspan="10"| 0: add player
+
  | 1022
|colspan="2"| Name
+
  | Wither breaks block
  |colspan="2"| String (16)
+
  |
  |  
 
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | 1023
  |colspan="2"| VarInt
+
| Wither spawned
  | Number of elements in the following array
+
|  
 +
  |-
 +
| 1024
 +
| Wither shoots
 +
  |
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | 1025
| Name
+
  | Bat takes off
|rowspan="4"| Array
+
  |
  | String (32767)
 
  |  
 
 
  |-
 
  |-
  | Value
+
  | 1026
  | String (32767)
+
  | Zombie infects
|
+
  |
|-
 
| Is Signed
 
| Boolean
 
  |  
 
 
  |-
 
  |-
  | Signature
+
  | 1027
  | Optional String (32767)
+
  | Zombie villager converted
  | Only if Is Signed is true
+
  |
 
  |-
 
  |-
  |colspan="2"| Gamemode
+
  | 1028
  |colspan="2"| VarInt
+
  | Ender dragon death
  |  
+
  |
 
  |-
 
  |-
  |colspan="2"| Ping
+
  | 1029
  |colspan="2"| VarInt
+
  | Anvil destroyed
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Has Display Name
+
  | 1030
  |colspan="2"| Boolean
+
  | Anvil used
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | 1031
  |colspan="2"| Optional [[Chat]]
+
  | Anvil landed
  | Only if Has Display Name is true
+
  |
 
  |-
 
  |-
  | 1: update gamemode
+
  | 1032
  |colspan="2"| Gamemode
+
  | Portal travel
|colspan="2"| VarInt
 
 
  |  
 
  |  
  |-  
+
  |-
  | 2: update latency
+
  | 1033
  |colspan="2"| Ping
+
  | Chorus flower grown
  |colspan="2"| VarInt
+
|
 +
  |-
 +
| 1034
 +
| Chorus flower died
 
  |  
 
  |  
 
  |-
 
  |-
  |rowspan="2"| 3: update display name
+
  | 1035
  |colspan="2"| Has Display Name
+
| Brewing stand brewed
  |colspan="2"| Boolean
+
  |
 +
|-
 +
  | 1036
 +
| Iron trapdoor opened
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | 1037
  |colspan="2"| Optional [[Chat]]
+
| Iron trapdoor closed
  | Only send if Has Display Name is true
+
|
 +
|-
 +
| 1038
 +
| End portal created in overworld
 +
  |
 +
|-
 +
| 1039
 +
| Phantom bites
 +
  |
 
  |-
 
  |-
  | 4: remove player
+
  | 1040
  |colspan="2"| ''no fields''
+
  | Zombie converts to drowned
|colspan="2"| ''no fields''
+
  |
  |  
 
|}
 
 
 
The Property field looks as in the response of [[Mojang API#UUID -> Profile + Skin/Cape]], except of course using the protocol format instead of JSON. That is, each player will usually have one property with Name “textures” and Value being a base64-encoded JSON string as documented at [[Mojang API#UUID -> Profile + Skin/Cape]]. An empty properties array is also acceptable, and will cause clients to display the player with one of the two default skins depending on UUID.
 
 
 
==== Player Position And Look (clientbound) ====
 
 
 
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
 
 
 
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
 
 
 
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”.
 
 
 
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
 
 
 
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x2E
+
  | 1041
|rowspan="7"| Play
+
  | Husk converts to zombie by drowning
|rowspan="7"| Client
+
  |
| X
 
  | Double
 
  | Absolute or relative position, depending on Flags
 
 
  |-
 
  |-
  | Y
+
  | 1042
  | Double
+
  | Grindstone used
  | Absolute or relative position, depending on Flags
+
  |
 
  |-
 
  |-
  | Z
+
  | 1043
  | Double
+
  | Book page turned
  | Absolute or relative position, depending on Flags
+
  |
 
  |-
 
  |-
| Yaw
 
| Float
 
| Absolute or relative rotation on the X axis, in degrees
 
 
  |-
 
  |-
  | Pitch
+
  !colspan="3"| Particle
| Float
 
| Absolute or relative rotation on the Y axis, in degrees
 
 
  |-
 
  |-
  | Flags
+
  | 1500
  | Byte
+
  | Composter composts
  | Bit field, see below
+
  |
 
  |-
 
  |-
  | Teleport ID
+
  | 1501
  | VarInt
+
  | Lava converts block (either water to stone, or removes existing blocks such as torches)
| Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
+
  |
  |}
 
 
 
About the Flags field:
 
 
 
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Field
+
  | 1502
  ! Bit
+
  | Redstone torch burns out
 +
|
 +
|-
 +
| 1503
 +
| Ender eye placed
 +
|
 
  |-
 
  |-
  | X
+
  | 2000
  | 0x01
+
  | Spawns 10 smoke particles, e.g. from a fire
 +
| Direction, see below.
 
  |-
 
  |-
  | Y
+
  | 2001
  | 0x02
+
  | Block break + block break sound
 +
| Block state, as an index into the global palette.
 
  |-
 
  |-
  | Z
+
  | 2002
  | 0x04
+
  | Splash potion. Particle effect + glass break sound.
 +
| RGB color as an integer (e.g. 8364543 for #7FA1FF).
 
  |-
 
  |-
  | Y_ROT
+
  | 2003
  | 0x08
+
| Eye of Ender entity break animation — particles and sound
 +
  |  
 
  |-
 
  |-
  | X_ROT
+
  | 2004
  | 0x10
+
  | Mob spawn particle effect: smoke + flames
  |}
+
  |  
 
 
==== Use Bed ====
 
 
 
This packet tells that a player goes to bed.
 
 
 
The client with the matching Entity ID will go into bed mode.
 
 
 
This Packet is sent to all nearby players including the one sent to bed.
 
 
 
Any packets sent with a location not currently occupied by a bed will be ignored by clients.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x2F
+
  | 2005
|rowspan="2"| Play
+
  | Bonemeal particles
|rowspan="2"| Client
+
  | How many particles to spawn (if set to 0, 15 are spawned).
| Entity ID
 
  | VarInt
 
  | Sleeping player's EID
 
 
  |-
 
  |-
  | Location
+
  | 2006
  | Position
+
  | Dragon breath
  | Block location of the head part of the bed
+
  |
  |}
+
  |-
 
+
| 2007
==== Unlock Recipes ====
+
  | Instant splash potion. Particle effect + glass break sound.
 
+
  | RGB color as an integer (e.g. 8364543 for #7FA1FF).
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="8"| 0x30
+
  | 2008
  |rowspan="8"| Play
+
  | Ender dragon destroys block
  |rowspan="8"| Client
+
  |
 
  |-
 
  |-
  | Action
+
  | 2009
  | VarInt
+
  | Wet sponge vaporizes in nether
  | 0: init, 1: add, 2: remove
+
  |
 
  |-
 
  |-
  | Crafting Book Open
+
  | 3000
  | Boolean
+
  | End gateway spawn
  | If true, then the crafting book will be open when the player opens its inventory.
+
  |  
 
  |-
 
  |-
  | Filtering Craftable
+
  | 3001
  | Boolean
+
  | Enderdragon growl
  | If true, then the filtering option is active when the players opens its inventory.
+
  |
 
  |-
 
  |-
  | Array size 1
+
  | 3002
  | VarInt
+
  | Electric spark
  | Number of elements in the following array
+
  |
 
  |-
 
  |-
  | Recipe IDs
+
  | 3003
  | Array of VarInt
+
  | Copper apply wax
 
  |
 
  |
 
  |-
 
  |-
  | Array size 2
+
  | 3004
  | Optional VarInt
+
  | Copper remove wax
  | Number of elements in the following array, only present if mode is 0 (init)
+
  |
 
  |-
 
  |-
  | Recipe IDs
+
  | 3005
  | Optional Array of VarInt, only present if mode is 0 (init)
+
  | Copper scrape oxidation
 
  |
 
  |
 
  |}
 
  |}
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.
 
  
Recipe ID:
+
Smoke directions:
These are hardcoded values in the client and server, all the recipe json files will be loaded in a specific order (alphabetical, like sounds) and internal ids will be assigned in that order. There are also inbuilt recipes like fireworks, banners, etc., these are the first recipes to have their id assigned. Due the fact that the recipes are loaded in a specific order will the ids very likely change when recipes get added. [https://twitter.com/dinnerbone/status/856505341479145472 Custom recipes are scheduled for Minecraft 1.13], so most likely will things change a bit in that version.
 
 
 
==== Destroy Entities ====
 
 
 
Sent by the server when a list of entities is to be destroyed on the client.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Direction
  ! Bound To
+
  |-
  ! Field Name
+
| 0
  ! Field Type
+
| Down
  ! Notes
+
|-
 +
| 1
 +
| Up
 +
|-
 +
| 2
 +
| North
 +
  |-
 +
  | 3
 +
  | South
 
  |-
 
  |-
  |rowspan="2"| 0x31
+
  | 4
|rowspan="2"| Play
+
  | West
|rowspan="2"| Client
 
| Count
 
| VarInt
 
  | Number of elements in the following array
 
 
  |-
 
  |-
  | Entity IDs
+
  | 5
  | Array of VarInt
+
  | East
| The list of entities of destroy
 
 
  |}
 
  |}
  
==== Remove Entity Effect ====
+
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.
  
{| class="wikitable"
+
==== Particle ====
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x32
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
|
 
|-
 
| Effect ID
 
| Byte
 
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 
|}
 
  
==== Resource Pack Send ====
+
Displays the named particle
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,960: Line 3,093:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x33
+
  |rowspan="11"| 0x24
  |rowspan="2"| Play
+
  |rowspan="11"| Play
  |rowspan="2"| Client
+
  |rowspan="11"| Client
  | URL
+
  | Particle ID
  | String (32767)
+
  | Int
  | The URL to the resource pack.
+
| The particle ID listed in [[#Particle|the particle data type]].
 +
|-
 +
| Long Distance
 +
| Boolean
 +
| If true, particle distance increases from 256 to 65536.
 +
|-
 +
| X
 +
| Double
 +
| 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 <code>random.nextGaussian()</code>.
 +
|-
 +
| Offset Y
 +
| Float
 +
| This is added to the Y position after being multiplied by <code>random.nextGaussian()</code>.
 +
|-
 +
| Offset Z
 +
| Float
 +
| This is added to the Z position after being multiplied by <code>random.nextGaussian()</code>.
 +
|-
 +
| Particle Data
 +
| Float
 +
  | The data of each particle.
 +
|-
 +
| Particle Count
 +
| Int
 +
| The number of particles to create.
 
  |-
 
  |-
  | Hash
+
  | Data
  | String (40)
+
  | Varies
  | 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
+
  | The variable data listed in [[#Particle|the particle data type]].
 
  |}
 
  |}
  
==== Respawn ====
+
==== Update Light ====
  
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.
+
Updates light levels for a chunk. See {{Minecraft Wiki|Light}} for information on how lighting works in Minecraft.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,980: Line 3,149:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x34
+
  |rowspan="13"| 0x25
  |rowspan="4"| Play
+
  |rowspan="13"| Play
  |rowspan="4"| Client
+
  |rowspan="13"| Client
  | Dimension
+
  |colspan="2"| Chunk X
  | Int Enum
+
|colspan="2"| VarInt
  | -1: The Nether, 0: The Overworld, 1: The End
+
  | 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"| Trust Edges
 +
|colspan="2"| Boolean
 +
| If edges should be trusted for light updates.
 +
|-
 +
|colspan="2"| Sky Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Sky Light array below.  The least significant bit is for blocks 16 blocks to 1 block below the min world height (one section below the world), while the most significant bit covers blocks 1 to 16 blocks above the max world height (one section above the world).
 +
|-
 +
|colspan="2"| Block Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Block Light array below.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Empty Sky Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Sky Light data.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Empty Block Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Block Light data.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Sky Light array count
 +
|colspan="2"| VarInt
 +
| Number of entries in the following array; should match the number of bits set in Sky Light Mask
 +
|-
 +
|rowspan="2"| Sky Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Sky Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the sky light mask, starting with the lowest value.  Half a byte per light value.
 
  |-
 
  |-
  | Difficulty
+
  |colspan="2"| Block Light array count
  | Unsigned Byte
+
  |colspan="2"| VarInt
  | 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
+
  | Number of entries in the following array; should match the number of bits set in Block Light Mask
 
  |-
 
  |-
  | Gamemode
+
  |rowspan="2"| Block Light arrays
  | Unsigned Byte
+
  | Length
  | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
+
  |rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 
  |-
 
  |-
  | Level Type
+
  | Block Light array
  | String (16)
+
  | Array of 2048 bytes
  | Same as [[#Join Game|Join Game]]
+
  | 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.
 
  |}
 
  |}
  
{{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).
+
A bit will never be set in both the block light mask and the empty block light mask, though it may be present in neither of them (if the block light does not need to be updated for the corresponding chunk section).  The same applies to the sky light mask and the empty sky light mask.
  
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.}}
+
==== Join Game ====
  
==== Entity Head Look ====
+
See [[Protocol Encryption]] for information on logging in.
 
 
Changes the direction an entity's head is facing.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,020: Line 3,227:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x35
+
  |rowspan="17"| 0x26
  |rowspan="2"| Play
+
  |rowspan="17"| Play
  |rowspan="2"| Client
+
  |rowspan="17"| Client
 
  | Entity ID
 
  | Entity ID
  | VarInt
+
  | Int
  |  
+
| The player's Entity ID (EID).
 +
|-
 +
| Is hardcore
 +
| Boolean
 +
  |
 
  |-
 
  |-
  | Head Yaw
+
  | Gamemode
  | Angle
+
  | Unsigned Byte
  | New angle, not a delta
+
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
 +
|-
 +
| Previous Gamemode
 +
| Byte
 +
| 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included. The previous gamemode. Defaults to -1 if there is no previous gamemode. (More information needed)
 +
|-
 +
| World Count
 +
| VarInt
 +
| Size of the following array.
 +
|-
 +
| World Names
 +
| Array of Identifier
 +
| Identifiers for all worlds on the server.
 +
|-
 +
| Dimension Codec
 +
| [[NBT|NBT Tag Compound]]
 +
| The full extent of these is still unknown, but the tag represents a dimension and biome registry. See below for the vanilla default.
 +
|-
 +
| Dimension
 +
| [[NBT|NBT Tag Compound]]
 +
| Valid dimensions are defined per dimension registry sent before this. The structure of this tag is a dimension type (see below).
 +
|-
 +
| World Name
 +
| Identifier
 +
| Name of the world being spawned into.
 +
|-
 +
| Hashed seed
 +
| Long
 +
| First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
 +
|-
 +
| Max Players
 +
| VarInt
 +
| Was once used by the client to draw the player list, but now is ignored.
 +
|-
 +
| View Distance
 +
| VarInt
 +
| Render distance (2-32).
 +
|-
 +
| Simulation Distance
 +
| VarInt
 +
| The distance that the client will process specific things, such as entities.
 +
|-
 +
| Reduced Debug Info
 +
| Boolean
 +
| If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}.  For servers in development, this should almost always be false.
 +
|-
 +
| Enable respawn screen
 +
| Boolean
 +
| Set to false when the doImmediateRespawn gamerule is true.
 +
|-
 +
| Is Debug
 +
| Boolean
 +
| True if the world is a {{Minecraft Wiki|debug mode}} world; debug mode worlds cannot be modified and have predefined blocks.
 +
|-
 +
| Is Flat
 +
| Boolean
 +
| True if the world is a {{Minecraft Wiki|superflat}} world; flat worlds have different void fog and a horizon at y=0 instead of y=63.
 
  |}
 
  |}
  
==== Select Advancement Tab ====
 
  
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.
+
The '''Dimension Codec''' NBT Tag Compound ([https://gist.githubusercontent.com/BomBardyGamer/c075a7a34b51f2df9d5aabdd2a762f4f/raw/c7352784dfadbca00d2282aeca04ed80081bfb09/dimension_codec.snbt Default value in SNBT]) includes two registries: "minecraft:dimension_type" and "minecraft:worldgen/biome".
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  !Name
! State
+
  !Type
! Bound To
+
  !style="width: 250px;" colspan="2"| Notes
! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x36
+
  | minecraft:dimension_type
|rowspan="2"| Play
+
  | TAG_Compound
|rowspan="2"| Client
+
  | The dimension type registry (see below).
| Has id
 
  | Boolean
 
  | Indicates if the next field is present
 
 
  |-
 
  |-
  | Optional Identifier
+
  | minecraft:worldgen/biome
  | String (32767)
+
  | TAG_Compound
  | See below
+
  | The biome registry (see below).
 
  |}
 
  |}
  
The Identifier can be one of the following:
+
Dimension type registry:
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Optional Identifier
+
  !Name
 +
!Type
 +
!style="width: 250px;" colspan="2"| Notes
 
  |-
 
  |-
  | minecraft:story/root
+
  | type
 +
| TAG_String
 +
| The name of the registry. Always "minecraft:dimension_type".
 
  |-
 
  |-
  | minecraft:nether/root
+
  | value
 +
| TAG_List
 +
| List of dimension types registry entries (see below).
 +
|}
 +
 
 +
Dimension type registry entry:
 +
 
 +
{| class="wikitable"
 +
!Name
 +
!Type
 +
!style="width: 250px;" colspan="2"| Notes
 
  |-
 
  |-
  | minecraft:end/root
+
  | name
 +
| TAG_String
 +
| The name of the dimension type (for example, "minecraft:overworld").
 
  |-
 
  |-
  | minecraft:adventure/root
+
  | id
 +
| TAG_Int
 +
| The protocol ID of the dimension (matches the index of the element in the registry list).
 
  |-
 
  |-
  | minecraft:husbandry/root
+
  | element
 +
| TAG_Compound
 +
| The dimension type (see below).
 
  |}
 
  |}
  
If no or an invalid identifier is sent, the client will switch to the first tab in the GUI.
+
Dimension type:
 
 
==== World Border ====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
  ! Type
  ! Bound To
+
  !style="width: 250px;" colspan="2"| Meaning
  !colspan="2"| Field Name
+
  ! Values
  ! Field Type
+
|-
! Notes
+
| piglin_safe
 +
| TAG_Byte
 +
|colspan="2"| Whether piglins shake and transform to zombified piglins.
 +
  | 1: true, 0: false.
 
  |-
 
  |-
  |rowspan="18"| 0x37
+
  | natural
|rowspan="18"| Play
+
  | TAG_Byte
  |rowspan="18"| Client
+
  |colspan="2"| When false, compasses spin randomly. When true, nether portals can spawn zombified piglins.
  |colspan="2"| Action
+
  | 1: true, 0: false.
| VarInt Enum
 
  | Determines the format of the rest of the packet
 
 
  |-
 
  |-
  ! Action
+
  | ambient_light
  ! Field Name
+
  | TAG_Float
  !
+
  |colspan="2"| How much light the dimension has.
  !
+
  | 0.0 to 1.0.
 
  |-
 
  |-
  | 0: set size
+
  | fixed_time
  | Diameter
+
  | Optional TAG_Long
  | Double
+
  |colspan="2"| If set, the time of the day is the specified value.
  | Length of a single side of the world border, in meters
+
  | If set, 0 to 24000.
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
  | infiniburn
  | Old Diameter
+
  | TAG_String
  | Double
+
  |colspan="2"| A resource location defining what block tag to use for infiniburn.
  | Current length of a single side of the world border, in meters
+
  | "" or minecraft resource "minecraft:...".
 
  |-
 
  |-
  | New Diameter
+
  | respawn_anchor_works
  | Double
+
  | TAG_Byte
  | Target length of a single side of the world border, in meters
+
  |colspan="2"| Whether players can charge and use respawn anchors.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | Speed
+
  | has_skylight
  | VarLong
+
  | TAG_Byte
  | 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.
+
  |colspan="2"| Whether the dimension has skylight access or not.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  |rowspan="2"| 2: set center
+
  | bed_works
  | X
+
  | TAG_Byte
  | Double
+
  |colspan="2"| Whether players can use a bed to sleep.
  |  
+
  | 1: true, 0: false.
 
  |-
 
  |-
  | Z
+
  | effects
  | Double
+
  | TAG_String
  |  
+
  |colspan="2"| ?
 +
| "minecraft:overworld", "minecraft:the_nether", "minecraft:the_end" or something else.
 
  |-
 
  |-
  |rowspan="8"| 3: initialize
+
  | has_raids
  | X
+
  | TAG_Byte
  | Double
+
  |colspan="2"| Whether players with the Bad Omen effect can cause a raid.
  |  
+
  | 1: true, 0: false.
 
  |-
 
  |-
  | Z
+
  | min_y
  | Double
+
  | TAG_Int
  |  
+
|colspan="2"| The minimum Y level.
 +
  |
 
  |-
 
  |-
  | Old Diameter
+
  | height
  | Double
+
  | TAG_Int
  | Current length of a single side of the world border, in meters
+
  |colspan="2"| The maximum height.
|-
+
  |
| New Diameter
 
| Double
 
  | Target length of a single side of the world border, in meters
 
 
  |-
 
  |-
  | Speed
+
  | logical_height
  | VarLong
+
  | TAG_Int
  | 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.
+
  |colspan="2"| The maximum height to which chorus fruits and nether portals can bring players within this dimension.
 +
| 0-256.
 
  |-
 
  |-
  | Portal Teleport Boundary
+
  | coordinate_scale
  | VarInt
+
  | TAG_Float
  | Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
+
  |colspan="2"| The multiplier applied to coordinates when traveling to the dimension.
 +
| 0.00001 - 30000000.0
 
  |-
 
  |-
  | Warning Time
+
  | ultrawarm
  | VarInt
+
  | TAG_Byte
  | In seconds as set by <code>/worldborder warning time</code>
+
  |colspan="2"| Whether the dimensions behaves like the nether (water evaporates and sponges dry) or not. Also causes lava to spread thinner.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | Warning Blocks
+
  | has_ceiling
  | VarInt
+
  | TAG_Byte
  | In meters
+
  |colspan="2"| Whether the dimension has a bedrock ceiling or not. When true, causes lava to spread faster.
 +
| 1: true, 0: false.
 +
|}
 +
 
 +
Biome registry:
 +
 
 +
{| class="wikitable"
 +
!Name
 +
!Type
 +
!style="width: 250px;" colspan="2"| Notes
 
  |-
 
  |-
  |rowspan="1"| 4: set warning time
+
  | type
  | Warning Time
+
  | TAG_String
  | VarInt
+
  | The name of the registry. Always "minecraft:worldgen/biome".
| In seconds as set by <code>/worldborder warning time</code>
 
 
  |-
 
  |-
  |rowspan="1"| 5: set warning blocks
+
  | value
| Warning Blocks
+
  | TAG_List
  | VarInt
+
  | List of biome registry entries (see below).
  | 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:
+
Biome registry entry:
  
<syntaxhighlight lang="java">
+
{| class="wikitable"
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
+
!Name
if (playerDistance < distance) {
+
!Type
    warning = 1.0 - playerDistance / distance;
+
!style="width: 250px;" colspan="2"| Notes
} else {
+
|-
    warning = 0.0;
+
| name
}
+
| TAG_String
</syntaxhighlight>
+
| The name of the biome (for example, "minecraft:ocean").
 
+
|-
==== Camera ====
+
| id
 +
| TAG_Int
 +
| The protocol ID of the biome (matches the index of the element in the registry list).
 +
|-
 +
| element
 +
| TAG_Compound
 +
| The biome properties (see below).
 +
|}
  
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
+
Biome properties:
  
The player's camera will move with the entity and look where it is looking. The entity is often another player, but can be any type of entity.  The player is unable to move this entity (move packets will act as if they are coming from the other entity).
+
{| class="wikitable"
 
+
!colspan="2"|Name
If the given entity is not loaded by the player, this packet is ignoredTo return control to the player, send this packet with their entity ID.
+
!colspan="2"|Type
 
+
!style="width: 250px;" colspan="2"| Meaning
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).
+
!colspan="2"|Values
 
+
|-
{| class="wikitable"
+
|colspan="2"|precipitation
  ! Packet ID
+
|colspan="2"|TAG_String
  ! State
+
|colspan="2"| The type of precipitation in the biome.
  ! Bound To
+
|colspan="2"|"rain", "snow", or "none".
  ! Field Name
+
|-
  ! Field Type
+
|colspan="2"| depth
  ! Notes
+
|colspan="2"| TAG_Float
 +
|colspan="2"| The depth factor of the biome.
 +
|colspan="2"| The default values vary between 1.5 and -1.8.
 +
|-
 +
|colspan="2"| temperature
 +
|colspan="2"| TAG_Float
 +
|colspan="2"| The temperature factor of the biome.
 +
|colspan="2"| The default values vary between 2.0 and -0.5.
 +
|-
 +
|colspan="2"| scale
 +
|colspan="2"| TAG_Float
 +
|colspan="2"| ?
 +
|colspan="2"| The default values vary between 1.225 and 0.0.
 +
|-
 +
|colspan="2"| downfall
 +
|colspan="2"| TAG_Float
 +
|colspan="2"| ?
 +
|colspan="2"| The default values vary between 1.0 and 0.0.
 +
|-
 +
|colspan="2"| category
 +
|colspan="2"| TAG_String
 +
|colspan="2"| The category of the biome.
 +
|colspan="2"| Known values are "ocean", "plains", "desert", "forest", "extreme_hills", "taiga", "swamp", "river", "nether", "the_end", "icy", "mushroom", "beach", "jungle", "mesa", "savanna", and "none".  
 +
|-
 +
|colspan="2"| temperature_modifier
 +
|colspan="2"| Optional TAG_String
 +
  |colspan="2"| ?
 +
|colspan="2"| The only known value is "frozen".
 +
|-
 +
|rowspan="11"| effects
 +
| sky_color
 +
|rowspan="11"| TAG_Compound
 +
| TAG_Int
 +
|colspan="2"| The color of the sky.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| water_fog_color
 +
| TAG_Int
 +
|colspan="2"| Possibly the tint color when swimming.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| fog_color
 +
| TAG_Int
 +
|colspan="2"| Possibly the color of the fog effect when looking past the view distance.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| water_color
 +
  | TAG_Int
 +
|colspan="2"| The tint color of the water blocks.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| foliage_color
 +
| Optional TAG_Int
 +
|colspan="2"| The tint color of the grass.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| grass_color
 +
| Optional TAG_Int
 +
| colspan="2"| ?
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| grass_color_modifier
 +
| Optional TAG_String
 +
|colspan="2"| Unknown, likely affects foliage color.
 +
| If set, known values are "swamp" and "dark_forest".
 +
|-
 +
| music
 +
| Optional TAG_Compound
 +
|colspan="2"| Music properties for the biome.
 +
| If present, contains the fields: replace_current_music (TAG_Byte), sound (TAG_String), max_delay (TAG_Int), min_delay (TAG_Int).
 +
|-
 +
| ambient_sound
 +
| Optional TAG_String
 +
|colspan="2"| Ambient soundtrack.
 +
| If present, the ID of a soundtrack. Example: "minecraft:ambient.basalt_deltas.loop".
 +
|-
 +
| additions_sound
 +
| Optional TAG_Compound
 +
|colspan="2"| Additional ambient sound that plays randomly.
 +
| If present, contains the fields: sound (TAG_String), tick_chance (TAG_Double).
 +
|-
 +
| mood_sound
 +
| Optional TAG_Compound
 +
|colspan="2"| Additional ambient sound that plays at an interval.
 +
| If present, contains the fields: sound (TAG_String), tick_delay (TAG_Int), offset (TAG_Double), block_search_extent (TAG_Int).
 +
|-
 +
|rowspan="2"|particle
 +
  | probability
 +
  |rowspan="2"|Optional TAG_Compound
 +
  | TAG_FLOAT
 +
  |rowspan="2"| Particles that appear randomly in the biome.
 +
  | Possibly the probability of spawning the particle.
 +
  | ?
 
  |-
 
  |-
  |rowspan="1"| 0x38
+
  | options
  |rowspan="1"| Play
+
  | TAG_COMPOUND
  |rowspan="1"| Client
+
  | The properties of the particle to spawn.
  | Camera ID
+
  | Contains the field "type" (TAG_String), which identifies the particle type.
| VarInt
 
| ID of the entity to set the client's camera to
 
 
  |}
 
  |}
  
The notchian also loads certain shaders for given entities:
+
==== Map Data ====
  
* Creeper &rarr; <code>shaders/post/creeper.json</code>
+
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
* Spider (and cave spider) &rarr; <code>shaders/post/spider.json</code>
 
* Enderman &rarr; <code>shaders/post/invert.json</code>
 
* Anything else &rarr; the current shader is unloaded
 
 
 
==== Held Item Change (clientbound) ====
 
 
 
Sent to change the player's slot selection.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,219: Line 3,599:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x39
+
  |rowspan="17"| 0x27
  |rowspan="1"| Play
+
  |rowspan="17"| Play
  |rowspan="1"| Client
+
  |rowspan="17"| Client
  | Slot
+
|colspan="2"| Map ID
 +
|colspan="2"| VarInt
 +
| Map ID of the map being modified
 +
|-
 +
|colspan="2"| Scale
 +
|colspan="2"| Byte
 +
| 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"| Locked
 +
|colspan="2"| Boolean
 +
| True if the map has been locked in a cartography table
 +
|-
 +
|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. Only present if "Tracking Position" is true.
 +
|-
 +
|rowspan="6"| Icon
 +
| Type
 +
|rowspan="6"| Array
 +
| VarInt enum
 +
| See below
 +
|-
 +
| X
 +
| Byte
 +
| Map coordinates: -128 for furthest left, +127 for furthest right
 +
|-
 +
  | Z
 
  | Byte
 
  | Byte
  | The slot which the player has selected (0–8)
+
  | Map coordinates: -128 for highest, +127 for lowest
|}
 
 
 
==== Display Scoreboard ====
 
 
 
This is sent to the client when it should display a scoreboard.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  | Direction
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Position
 
 
  | Byte
 
  | Byte
  | The position of the scoreboard. 0: list, 1: sidebar, 2: below name.
+
  | 0-15
 
  |-
 
  |-
  | Score Name
+
  | Has Display Name
  | String (16)
+
  | Boolean
  | The unique name for the scoreboard to be displayed.
+
  |
  |}
+
  |-
 
+
| Display Name
==== Entity Metadata ====
+
| Optional [[Chat]]
 
+
| Only present if previous Boolean is true
Updates one or more [[Entities#Entity Metadata Format|metadata]] properties for an existing entity. Any properties not included in the Metadata field are left unchanged.
+
|-
 
+
|colspan="2"| Columns
{| class="wikitable"
+
|colspan="2"| Unsigned Byte
  ! Packet ID
+
| Number of columns updated
  ! State
+
|-
  ! Bound To
+
|colspan="2"| Rows
  ! Field Name
+
|colspan="2"| Optional Byte
  ! Field Type
+
| Only if Columns is more than 0; number of rows updated
  ! Notes
+
|-
 +
|colspan="2"| X
 +
  |colspan="2"| Optional Byte
 +
  | 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
 
  |-
 
  |-
  |rowspan="2"| 0x3B
+
  |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
| Entity ID
 
| VarInt
 
  |  
 
 
  |-
 
  |-
  | Metadata
+
  |colspan="2"| Data
  | [[Entities#Entity Metadata Format|Entity Metadata]]
+
  |colspan="2"| Optional Array of Unsigned Byte
  |  
+
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
  |}
 
  |}
  
==== Attach Entity ====
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
  
This packet is sent when an entity has been {{Minecraft Wiki|Lead|leashed}} to another entity.
+
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="2"| 0x3C
+
  ! Icon type
|rowspan="2"| Play
+
  ! Result
  |rowspan="2"| Client
+
  |-
  | Attached Entity ID
+
  | 0
  | Int
+
  | White arrow (players)
  | Attached entity's EID
 
 
  |-
 
  |-
  | Holding Entity ID
+
  | 1
| Int
+
  | Green arrow (item frames)
| ID of the entity holding the lead. Set to -1 to detach.
 
  |}
 
 
 
==== Entity Velocity ====
 
 
 
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms); for example, -1343 would move (-1343 / 8000) = −0.167875 blocks per tick (or −3,3575 blocks per second).
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x3D
+
  | 2
|rowspan="4"| Play
+
  | Red arrow
|rowspan="4"| Client
 
| Entity ID
 
| VarInt
 
  |  
 
 
  |-
 
  |-
  | Velocity X
+
  | 3
  | Short
+
  | Blue arrow
| Velocity on the X axis
 
 
  |-
 
  |-
  | Velocity Y
+
  | 4
  | Short
+
  | White cross
| Velocity on the Y axis
 
 
  |-
 
  |-
  | Velocity Z
+
  | 5
  | Short
+
  | Red pointer
  | Velocity on the Z axis
+
  |-
 +
| 6
 +
| White circle (off-map players)
 +
|-
 +
| 7
 +
| Small white circle (far-off-map players)
 +
|-
 +
| 8
 +
| Mansion
 +
|-
 +
| 9
 +
| Temple
 +
|-
 +
| 10
 +
| White Banner
 +
|-
 +
| 11
 +
| Orange Banner
 +
|-
 +
| 12
 +
| Magenta Banner
 +
|-
 +
| 13
 +
| Light Blue Banner
 +
|-
 +
| 14
 +
| Yellow Banner
 +
|-
 +
| 15
 +
| Lime Banner
 +
|-
 +
| 16
 +
| Pink Banner
 +
|-
 +
| 17
 +
| Gray Banner
 +
|-
 +
| 18
 +
| 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
 
  |}
 
  |}
  
==== Entity Equipment ====
+
==== Trade List ====
 +
 
 +
The list of trades a villager NPC is offering.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,341: Line 3,776:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x3E
+
  |rowspan="18"| 0x28
  |rowspan="3"| Play
+
  |rowspan="18"| Play
  |rowspan="3"| Client
+
  |rowspan="18"| Client
  | Entity ID
+
  |-
  | VarInt
+
| colspan="2" | Window ID
  | Entity's EID
+
  | colspan="2" | VarInt
 +
  | The ID of the window that is open; this is an int rather than a byte.
 +
|-
 +
| colspan="2" | Size
 +
| colspan="2" | Byte
 +
| The number of trades in the following array.
 +
|-
 +
| rowspan="11" | Trades
 +
| Input item 1
 +
| rowspan="11" | Array
 +
| [[Slot]]
 +
| The first item the player has to supply for this villager trade. The count of the item stack is the default "price" of this trade.
 +
|-
 +
| Output item
 +
| [[Slot]]
 +
| The item the player will receive from this villager trade.
 +
|-
 +
| Has second item
 +
| Boolean
 +
| Whether there is a second item.
 +
|-
 +
| Input item 2
 +
| Optional [[Slot]]
 +
| The second item the player has to supply for this villager trade; only present if has a second item is true.
 +
|-
 +
| Trade disabled
 +
| Boolean
 +
| True if the trade is disabled; false if the trade is enabled.
 +
|-
 +
| Number of trade uses
 +
| Integer
 +
| Number of times the trade has been used so far. If equal to the maximum number of trades, the client will display a red X.
 +
|-
 +
| Maximum number of trade uses
 +
| Integer
 +
| Number of times this trade can be used before it's exhausted.
 +
|-
 +
| XP
 +
| Integer
 +
| Amount of XP both the player and the villager will earn each time the trade is used.
 +
|-
 +
| Special Price
 +
| Integer
 +
| Can be zero or negative. The number is added to the price when an item is discounted due to player reputation or other effects.
 +
|-
 +
| Price Multiplier
 +
| Float
 +
| Can be low (0.05) or high (0.2). Determines how much demand, player reputation, and temporary effects will adjust the price.
 +
|-
 +
| Demand
 +
| Integer
 +
| Can be zero or a positive number. Causes the price to increase when a trade is used repeatedly.
 +
|-
 +
|colspan="2"| Villager level
 +
|colspan="2"| VarInt
 +
| Appears on the trade GUI; meaning comes from the translation key <code>merchant.level.</code> + level.
 +
1: Novice, 2: Apprentice, 3: Journeyman, 4: Expert, 5: Master.
 +
|-
 +
|colspan="2"| Experience
 +
|colspan="2"| VarInt
 +
| Total experience for this villager (always 0 for the wandering trader).
 
  |-
 
  |-
  | Slot
+
  |colspan="2"| Is regular villager
  | VarInt Enum
+
  |colspan="2"| Boolean
  | Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
+
  | True if this is a regular villager; false for the wandering trader. When false, hides the villager level and some other GUI elements.
 
  |-
 
  |-
  | Item
+
  |colspan="2"| Can restock
  | [[Slot Data|Slot]]
+
  |colspan="2"| Boolean
  |  
+
  | True for regular villagers and false for the wandering trader. If true, the "Villagers restock up to two times per day." message is displayed when hovering over disabled trades.
 
  |}
 
  |}
  
==== Set Experience ====
+
Modifiers can increase or decrease the number of items for the first input slot. The second input slot and the output slot never change the nubmer of items. The number of items may never be less than 1, and never more than the stack size. If special price and demand are both zero, only the default price is displayed. If either is non-zero, then the adjusted price is displayed next to the crossed-out default price. The adjusted prices is calculated as follows:
 +
 
 +
Adjusted price = default price + floor(default price x multiplier x demand) + special price
  
Sent by the server when the client should change experience levels.
+
[[File:1.14-merchant-slots.png|thumb|The merchant UI, for reference]]
 +
{{-}}
  
{| class="wikitable"
+
==== Entity Position ====
 +
 
 +
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
 
  ! Packet ID
 
  ! State
 
  ! State
Line 3,373: Line 3,877:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x3F
+
  |rowspan="5"| 0x29
  |rowspan="3"| Play
+
  |rowspan="5"| Play
  |rowspan="3"| Client
+
  |rowspan="5"| Client
  | Experience bar
+
  | Entity ID
| Float
 
| Between 0 and 1
 
|-
 
| Level
 
 
  | VarInt
 
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Total Experience
+
  | Delta X
  | VarInt
+
  | Short
  | See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
+
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>.
 +
|-
 +
| Delta Y
 +
| Short
 +
| Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>.
 +
|-
 +
| Delta Z
 +
| Short
 +
| Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>.
 +
|-
 +
| On Ground
 +
| Boolean
 +
|  
 
  |}
 
  |}
  
==== Update Health ====
+
==== Entity Position and Rotation ====
  
Sent by the server to update/set the health of the player it is sent to.
+
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>)
 
 
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,403: Line 3,913:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x40