Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
(→‎Click Window: Added middle drag information that's accurate.)
m (More documentation on plugin message)
 
(452 intermediate revisions by more than 100 users not shown)
Line 3: Line 3:
 
   |BACKGROUND = #99CCFF
 
   |BACKGROUND = #99CCFF
 
   |WIDTH = 100%
 
   |WIDTH = 100%
   |ICON =  
+
   |ICON =
 
   |HEADING = Heads up!
 
   |HEADING = Heads up!
   |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''computer edition'''. 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.19, protocol 759]]). 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]).
+
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; substantial reproductions of this page must be attributed IAW [https://creativecommons.org/licenses/by-sa/4.0/ CC BY-SA 4.0].
  
 
The changes between versions may be viewed at [[Protocol History]].
 
The changes between versions may be viewed at [[Protocol History]].
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.19.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
 
  | The official implementation of vanilla Minecraft as developed and released by Mojang.
 
  | The official implementation of vanilla Minecraft as developed and released by Mojang.
 +
|-
 +
| Sequence
 +
| The action number counter for local block changes, incremented by one when clicking a block with a hand, right clicking an item, or starting or finishing digging a block. Counter handles latency to avoid applying outdated block changes to the local world.  Also is used to revert ghost blocks created when placing blocks, using buckets, or breaking blocks.
 
  |}
 
  |}
  
 
== Packet format ==
 
== Packet format ==
 +
 +
Packets cannot be larger than 2<sup>21</sup> &minus; 1 or 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 71:
 
  | Length
 
  | Length
 
  | VarInt
 
  | VarInt
  | Length of packet data + length of the packet ID
+
  | Length of Packet ID + Data
 
  |-
 
  |-
 
  | Packet ID
 
  | Packet ID
 
  | VarInt
 
  | VarInt
  |  
+
  |
 
  |-
 
  |-
 
  | Data
 
  | Data
Line 77: Line 84:
 
=== With compression ===
 
=== With compression ===
  
Once a [[#Set Compression|Set Compression]] packet 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 104:
 
  |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 112:
 
  |}
 
  |}
  
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 2|Set Compression]] ([[#Login|Login]], 0x03, clientbound) with a Threshold of -1.
+
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 143:
 
  | Protocol Version
 
  | Protocol Version
 
  | VarInt
 
  | VarInt
  | See [[protocol version numbers]] (currently 315 in Minecraft 1.11)
+
  | See [[protocol version numbers]] (currently 759 in Minecraft 1.19).
 
  |-
 
  |-
 
  | Server Address
 
  | Server Address
  | String
+
  | 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 157: Line 162:
 
{{Warning|This packet uses a nonstandard format. It is never length-prefixed, and the packet ID is an Unsigned Byte instead of a VarInt.}}
 
{{Warning|This packet uses a nonstandard format. It is never length-prefixed, and the packet ID is an Unsigned Byte instead of a VarInt.}}
  
While not technically part of the current protocol, legacy clients may send this packet to initiate [[Server List Ping]], and modern servers should handle it correctly.
+
While not technically part of the current protocol, legacy clients may send this packet to initiate [[Server List Ping]], and modern servers should handle it correctly
 +
The format of this packet is a remnant of the pre-Netty age, before the switch to Netty in 1.7 brought the standard format that is recognized now. This packet merely exists to inform legacy clients that they can't join our modern server.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 172: Line 178:
 
  | 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 ====
+
==== Status Response ====
 
 
Sent by the server when a vehicle or other object is created.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 193: Line 198:
 
  ! 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.
 +
|}
 +
 
 +
==== Ping Response ====
 +
 
 +
{| 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
+
 
  |
+
==== Status 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 Request ====
 
 
Spawns one or more experience orbs.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 255: Line 255:
 
  ! 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 294:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x02
+
| 0x00
  |rowspan="5"| Play
+
| Login
  |rowspan="5"| Client
+
| Client
  | Entity ID
+
| Reason
  | VarInt
+
| [[Chat]]
| The EID of the thunderbolt
+
| The reason why the player was disconnected.
|-
+
|}
  | Type
+
 
| Byte Enum
+
==== Encryption Request ====
| The global entity type, currently always 1 for thunderbolt
+
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
  |rowspan="5"| 0x01
 +
  |rowspan="5"| Login
 +
  |rowspan="5"| Client
 +
  | Server ID
 +
  | String (20)
 +
  | Appears to be empty.
 
  |-
 
  |-
  | X
+
  | Public Key Length
  | Double
+
  | VarInt
  |  
+
  | Length of Public Key
 +
|-
 +
| Public Key
 +
| Byte Array
 +
| The server's public key, in bytes.
 
  |-
 
  |-
  | Y
+
  | Verify Token Length
  | Double
+
  | VarInt
  |  
+
  | Length of Verify Token. Always 4 for Notchian servers.
 
  |-
 
  |-
  | Z
+
  | Verify Token
  | Double
+
  | Byte Array
  |  
+
  | A sequence of random bytes generated by the server.
 
  |}
 
  |}
  
==== Spawn Mob ====
+
See [[Protocol Encryption]] for details.
  
Sent by the server when a mob entity is spawned.
+
==== Login Success ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 323: Line 344:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="13"| 0x03
+
  |rowspan="7"| 0x02
  |rowspan="13"| Play
+
  |rowspan="7"| Login
  |rowspan="13"| Client
+
  |rowspan="7"| Client
  | Entity ID
+
  |colspan="2"| UUID
  | VarInt
+
  |colspan="2"| UUID
  |  
+
  |colspan="2"|
 
  |-
 
  |-
  | Entity UUID
+
  |colspan="2"| Username
  | UUID
+
  |colspan="2"| String (16)
  |  
+
  |colspan="2"|
 
  |-
 
  |-
  | Type
+
  |colspan="2"| Number Of Properties
  | VarInt
+
  |colspan="2"| VarInt
  | The type of mob. See [[Entities#Mobs]]
+
  | Number of elements in the following array.
 
  |-
 
  |-
  | X
+
  |rowspan="4"| Property
  | Double
+
  | Name
  |  
+
  |rowspan="4"| Array
 +
| String (32767)
 +
|colspan="2"|
 
  |-
 
  |-
  | Y
+
  | Value
  | Double
+
  | String (32767)
  |  
+
  |colspan="1"|
 
  |-
 
  |-
  | Z
+
  | Is Signed
  | Double
+
  | Boolean
  |  
+
  |colspan="2"|
 
  |-
 
  |-
  | Yaw
+
  | Signature
  | Angle
+
  | Optional String (32767)
|
+
  | Only if Is Signed is true.
|-
 
| 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 ====
+
This packet switches the connection state to [[#Play|play]].
  
This packet shows location, name, and type of painting.
+
{{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 [[#Login (play)|Login (play)]]).
 +
 
 +
The notchian client doesn't send any (non-[[#Keep Alive|keep alive]]) packets until the next tick/[[#Set Time|Set Time]] 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"
 
{| class="wikitable"
Line 395: Line 401:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x04
+
  | 0x03
  |rowspan="5"| Play
+
  | Login
  |rowspan="5"| Client
+
  | Client
  | Entity ID
+
  | Threshold
 
  | VarInt
 
  | VarInt
  |  
+
  | Maximum size of a packet before it is compressed.
  |-
+
  |}
  | Entity UUID
+
 
  | UUID
+
==== Login Plugin Request ====
  |
+
 
 +
Used to implement a custom handshaking flow together with [[#Login Plugin Response|Login Plugin Response]].
 +
 
 +
Unlike plugin messages in "play" mode, these messages follow a lock-step request/response scheme, where the client is expected to respond to a request indicating whether it understood. The notchian client always responds that it hasn't understood, and sends an empty payload.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Title
+
  |rowspan="3"| 0x04
  | String
+
  |rowspan="3"| Login
  | Name of the painting. Max length 13
+
  |rowspan="3"| Client
 +
| Message ID
 +
| VarInt
 +
| Generated by the server - should be unique to the connection.
 
  |-
 
  |-
  | Location
+
  | Channel
  | Position
+
  | Identifier
  | Center coordinates (see below)
+
  | Name of the [[plugin channel]] used to send the data.
 
  |-
 
  |-
  | Direction
+
  | Data
  | Byte Enum
+
  | Byte Array
  | Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
 
  |}
 
  |}
  
Calculating the center of an image: given a (width × height) grid of cells, with <code>(0, 0)</code> being the top left corner, the center is <code>(max(0, width / 2 - 1), height / 2)</code>. E.g. <code>(1, 0)</code> for a 2×1 painting, or <code>(1, 2)</code> for a 4×4 painting.
+
=== Serverbound ===
  
List of paintings by coordinates in <code>paintings_kristoffer_zetterstrand.png</code> (where x and y are in pixels from the top left and width and height are in pixels or 16ths of a block):
+
==== Login Start  ====
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Name
+
  ! Packet ID
  ! x
+
! State
  ! y
+
  ! Bound To
  ! width
+
  ! Field Name
  ! height
+
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>Kebab</code>
+
  |rowspan="7"| 0x00
  | 0
+
  |rowspan="7"| Login
  | 0
+
  |rowspan="7"| Server
  | 16
+
  | Name
  | 16
+
| String (16)
 +
  | Player's Username.
 
  |-
 
  |-
  | <code>Aztec</code>
+
  | Has Sig Data
  | 16
+
  | Boolean
  | 0
+
  | Whether or not the next 5 fields should be sent.
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Alban</code>
+
  | Timestamp
  | 32
+
  | Long
  | 0
+
  | When the key data will expire. Optional. Only sent if Has Sig Data is true.
  | 16
+
  |-
  | 16
+
  | Public Key Length
 +
| VarInt
 +
| Length of Public Key. Optional. Only sent if Has Sig Data is true.
 
  |-
 
  |-
  | <code>Aztec2</code>
+
  | Public Key
  | 48
+
  | Byte Array
  | 0
+
  | The encoded bytes of the public key the client received from Mojang. Optional. Only sent if Has Sig Data is true.
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Bomb</code>
+
  | Signature Length
  | 64
+
  | VarInt
  | 0
+
  | Length of Signature. Optional. Only sent if Has Sig Data is true.
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Plant</code>
+
  | Signature
  | 80
+
  | Byte Array
  | 0
+
  | The bytes of the public key signature the client received from Mojang. Optional. Only sent if Has Sig Data is true.
  | 16
+
  |}
  | 16
+
 
 +
==== Encryption Response ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>Wasteland</code>
+
  |rowspan="8"| 0x01
  | 96
+
|rowspan="8"| Login
  | 0
+
  |rowspan="8"| Server
  | 16
+
  | Shared Secret Length
  | 16
+
  | VarInt
 +
  | Length of Shared Secret.
 
  |-
 
  |-
  | <code>Pool</code>
+
  | Shared Secret
  | 0
+
  | Byte Array
  | 32
+
  | Shared Secret value, encrypted with the server's public key.
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Courbet</code>
+
  | Has Verify Token
  | 32
+
  | Boolean
  | 32
+
  | Whether or not the Verify Token should be sent. If not, then the salt and signature will be sent.
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Sea</code>
+
  | Optional Verify Token Length
  | 64
+
  | VarInt
  | 32
+
  | Length of Verify Token. Optional and only sent if Has Verify Token is true.
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Sunset</code>
+
  | Optional Verify Token
  | 96
+
  | Byte Array
  | 32
+
  | Verify Token value, encrypted with the same public key as the shared secret. Optional and only sent if Has Verify Token is true.
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Creebet</code>
+
  | Optional Salt
  | 128
+
  | Long
  | 32
+
  | Cryptography, used for validating the message signature. Optional and only sent if Has Verify Token is false.
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Wanderer</code>
+
  | Optional Message Signature Length
  | 0
+
  | VarInt
  | 64
+
  | Array Length. Optional and only sent if Has Verify Token is false.
| 16
 
| 32
 
 
  |-
 
  |-
  | <code>Graham</code>
+
  | Optional Message Signature
  | 16
+
  | Byte Array
  | 64
+
  | The bytes of the public key signature the client received from Mojang. Optional and only sent if Has Verify Token is false.
  | 16
+
  |}
  | 32
+
 
 +
See [[Protocol Encryption]] for details. See [[Mojang_API#Player_Certificates]] for an API to get the message signature.
 +
 
 +
==== Login Plugin Response ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>Match</code>
+
  |rowspan="3"| 0x02
  | 0
+
|rowspan="3"| Login
  | 128
+
  |rowspan="3"| Server
  | 32
+
  | Message ID
  | 32
+
  | VarInt
 +
  | Should match ID from server.
 
  |-
 
  |-
  | <code>Bust</code>
+
  | Successful
| 32
+
| Boolean
| 128
+
| <code>true</code> if the client understood the request, <code>false</code> otherwise. When <code>false</code>, no payload follows.
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Stage</code>
+
  | Data
  | 64
+
  | Optional Byte Array
  | 128
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
| 32
 
| 32
 
|-
 
| <code>Void</code>
 
| 96
 
| 128
 
| 32
 
| 32
 
|-
 
| <code>SkullAndRoses</code>
 
| 128
 
| 128
 
| 32
 
| 32
 
|-
 
| <code>Wither</code>
 
| 160
 
| 128
 
| 32
 
| 32
 
|-
 
| <code>Fighters</code>
 
| 0
 
| 96
 
| 64
 
| 32
 
|-
 
| <code>Pointer</code>
 
| 0
 
| 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.
+
== Play ==
  
==== Spawn Player ====
+
=== Clientbound ===
  
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
+
==== Spawn Entity ====
  
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.
+
Sent by the server when a vehicle or other non-living entity is created.
 
 
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 573:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x05
+
  |rowspan="13"| 0x00
  |rowspan="8"| Play
+
  |rowspan="13"| Play
  |rowspan="8"| Client
+
  |rowspan="13"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player's EID
+
  | A unique integer ID mostly used in the protocol to identify the entity.
 
  |-
 
  |-
  | Player UUID
+
  | Entity UUID
 
  | UUID
 
  | UUID
  | See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
+
  | A unique identifier that is mostly used in persistence and places where the uniqueness matters more.
 +
|-
 +
| Type
 +
| VarInt
 +
| The type of the entity (see "type" field of the list of [[entity_metadata#Mobs|Mob types]]).
 
  |-
 
  |-
 
  | X
 
  | X
 
  | Double
 
  | Double
  |  
+
  |
 
  |-
 
  |-
 
  | Y
 
  | Y
 
  | Double
 
  | Double
  |  
+
  |
 
  |-
 
  |-
 
  | Z
 
  | Z
 
  | Double
 
  | Double
  |  
+
  |
 +
|-
 +
| Pitch
 +
| Angle
 +
| To get the real pitch, you must divide this by (256.0F / 360.0F)
 
  |-
 
  |-
 
  | Yaw
 
  | Yaw
 
  | Angle
 
  | Angle
  |  
+
  | To get the real yaw, you must divide this by (256.0F / 360.0F)
 
  |-
 
  |-
  | Pitch
+
  | Head Yaw
 
  | Angle
 
  | Angle
  |  
+
  |- Only used by living entities, where the head of the entity may differ from the general body rotation.
 +
| Data
 +
| VarInt
 +
| Meaning dependent on the value of the Type field, see [[Object Data]] for details.
 
  |-
 
  |-
  | Metadata
+
  | Velocity X
  | [[Entities#Entity Metadata Format|Entity Metadata]]
+
  | Short
  |  
+
|rowspan="3"| Same units as [[#Set Entity Motion|Set Entity Motion]].
 +
|-
 +
| Velocity Y
 +
| Short
 +
|-
 +
| Velocity Z
 +
  | Short
 
  |}
 
  |}
  
When in {{Minecraft Wiki|Serve.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs. In offline mode, UUID v3 is used.
+
==== Spawn Experience Orb ====
  
For NPCs UUID v2 should be used. Note:
+
Spawns one or more experience orbs.
 
 
<+Grum> i will never confirm this as a feature you know that :)
 
 
 
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 
 
 
==== Animation (clientbound) ====
 
 
 
Sent whenever an entity should change animation.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 661: Line 638:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x06
+
  |rowspan="5"| 0x01
  |rowspan="2"| Play
+
  |rowspan="5"| Play
  |rowspan="2"| Client
+
  |rowspan="5"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player ID
+
  |
 
  |-
 
  |-
  | Animation
+
  | X
  | Unsigned Byte
+
  | Double
  | Animation ID (see below)
+
  |
|}
 
 
 
Animation can be one of the following values:
 
 
 
{| class="wikitable"
 
! ID
 
! Animation
 
 
  |-
 
  |-
  | 0
+
  | Y
  | Swing main arm
+
| Double
 +
  |
 
  |-
 
  |-
  | 1
+
  | Z
  | Take damage
+
| Double
 +
  |
 
  |-
 
  |-
  | 2
+
  | Count
  | Leave bed
+
  | Short
  |-
+
  | The amount of experience this orb will reward once collected.
| 3
 
| Swing offhand
 
|-
 
| 4
 
| Critical effect
 
|-
 
| 5
 
| Magic critical effect
 
 
  |}
 
  |}
  
==== Statistics ====
+
==== 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"
 
  ! 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="7"| 0x02
  |rowspan="3"| Play
+
  |rowspan="7"| Play
  |rowspan="3"| Client
+
  |rowspan="7"| Client
  |colspan="2"| Count
+
  | Entity ID
  |colspan="2"| VarInt
+
  | VarInt
  | Number of elements in the following array
+
  | A unique integer ID mostly used in the protocol to identify the player.
 +
|-
 +
| Player UUID
 +
| UUID
 +
| See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs.
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 
  |-
 
  |-
  |rowspan="2"| Statistic
+
  | Yaw
| Name
+
  | Angle
|rowspan="2"| Array
+
  |
  | String
 
  | [https://gist.github.com/thinkofname/a1842c21a0cf2e1fb5e0 https://gist.github.com/thinkofname/a1842c21a0cf2e1fb5e0]
 
 
  |-
 
  |-
  | Value
+
  | Pitch
  | VarInt
+
  | Angle
  | The amount to set it to
+
  |
 
  |}
 
  |}
  
==== Block Break Animation ====
+
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).  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–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
+
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>.
  
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 Animation (clientbound) ====
  
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
+
Sent whenever an entity should change animation.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 742: Line 732:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x08
+
  |rowspan="2"| 0x03
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Entity ID of the entity breaking the block
+
  | Player ID.
 
  |-
 
  |-
  | Location
+
  | Animation
| Position
+
  | Unsigned Byte
| Block Position
+
  | Animation ID (see below).
|-
 
| Destroy Stage
 
  | Byte
 
  | 0–9 to set it, any other value to remove it
 
 
  |}
 
  |}
  
==== Update Block Entity ====
+
Animation can be one of the following values:
 
 
Sets tile entity associated with the block at the given location.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Animation
  ! Bound To
+
  |-
  ! Field Name
+
| 0
  ! Field Type
+
| Swing main arm
  ! Notes
+
|-
 +
| 1
 +
| Take damage
 +
  |-
 +
  | 2
 +
  | Leave bed
 
  |-
 
  |-
  |rowspan="3"| 0x09
+
  | 3
|rowspan="3"| Play
+
  | Swing offhand
|rowspan="3"| Client
 
| Location
 
| Position
 
  |  
 
 
  |-
 
  |-
  | Action
+
  | 4
  | Unsigned Byte
+
  | Critical effect
| The type of update to perform, see below
 
 
  |-
 
  |-
  | NBT Data
+
  | 5
  | [[NBT|NBT Tag]]
+
  | Magic critical effect
| 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)
 
 
  |}
 
  |}
  
''Action'' field:
+
==== Award Statistics ====
  
* '''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.)
+
Sent as a response to [[#Client Command|Client Command]] (id 1). Will only send the changed values if previously requested.
* '''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 (unclear if there is any actual data)
 
 
 
==== 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"
 
{| class="wikitable"
Line 809: Line 777:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x0A
+
  |rowspan="4"| 0x04
 
  |rowspan="4"| Play
 
  |rowspan="4"| Play
 
  |rowspan="4"| Client
 
  |rowspan="4"| Client
  | Location
+
  |colspan="2"| Count
  | Position
+
  |colspan="2"| VarInt
  | Block coordinates
+
  | Number of elements in the following array.
 
  |-
 
  |-
  | Action ID (Byte 1)
+
  |rowspan="3"| Statistic
  | Unsigned Byte
+
| Category ID
  | Varies depending on block — see [[Block Actions]]
+
  |rowspan="3"| Array
 +
| VarInt
 +
  | See below.
 
  |-
 
  |-
  | Action Param (Byte 2)
+
  | Statistic ID
  | Unsigned Byte
+
  | VarInt
  | Varies depending on block — see [[Block Actions]]
+
  | See below.
 
  |-
 
  |-
  | Block Type
+
  | Value
 
  | VarInt
 
  | VarInt
  | The block type ID for the block, not including metadata/damage value.  This must match the block at the given coordinates.
+
  | The amount to set it to.
 
  |}
 
  |}
  
==== Block Change ====
+
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 
 
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"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
! State
+
  ! ID
! Bound To
+
  ! Registry
! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x0B
+
  | <code>minecraft.mined</code>
|rowspan="2"| Play
+
  | 0
|rowspan="2"| Client
+
  | Blocks
| Location
 
  | Position
 
  | Block Coordinates
 
 
  |-
 
  |-
  | Block ID
+
  | <code>minecraft.crafted</code>
| VarInt
+
  | 1
| 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
  |}
 
 
 
==== Boss Bar ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
  ! State
 
! Bound To
 
!colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="15"| 0x0C
+
  | <code>minecraft.used</code>
  |rowspan="15"| Play
+
  | 2
|rowspan="15"| Client
+
  | Items
|colspan="2"| UUID
 
| UUID
 
  | Unique ID for this bar
 
 
  |-
 
  |-
  |colspan="2"| Action
+
  | <code>minecraft.broken</code>
  | VarInt Enum
+
  | 3
  | Determines the layout of the remaining packet
+
  | Items
 
  |-
 
  |-
  ! Action
+
  | <code>minecraft.picked_up</code>
  ! Field Name
+
  | 4
  !
+
  | Items
!
 
 
  |-
 
  |-
  |rowspan="5"| 0: add
+
  | <code>minecraft.dropped</code>
  | Title
+
  | 5
| [[Chat]]
+
  | Items
  |  
 
 
  |-
 
  |-
  | Health
+
  | <code>minecraft.killed</code>
  | Float
+
  | 6
  | 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.
+
  | Entities
 
  |-
 
  |-
  | Color
+
  | <code>minecraft.killed_by</code>
  | VarInt Enum
+
  | 7
  | Color ID (see below)
+
  | Entities
 
  |-
 
  |-
  | Division
+
  | <code>minecraft.custom</code>
  | VarInt Enum
+
  | 8
  | Type of division (see below)
+
  | Custom
 +
|}
 +
 
 +
Blocks, Items, and Entities use block (not block state), item, and entity ids.
 +
 
 +
Custom has the following (unit only matters for clients):
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! ID
 +
! Unit
 
  |-
 
  |-
  | Flags
+
  | <code>minecraft.leave_game</code>
  | Unsigned Byte
+
  | 0
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music)
+
  | None
 
  |-
 
  |-
  | 1: remove
+
  | <code>minecraft.play_one_minute</code>
  | ''no fields''
+
  | 1
| ''no fields''
+
  | Time
  | Removes this boss bar
 
 
  |-
 
  |-
  | 2: update health
+
  | <code>minecraft.time_since_death</code>
  | Health
+
  | 2
| Float
+
  | Time
  | as above
 
 
  |-
 
  |-
  | 3: update title
+
  | <code>minecraft.time_since_rest</code>
  | Title
+
  | 3
| [[Chat]]
+
  | Time
  |  
 
 
  |-
 
  |-
  |rowspan="2"| 4: update style
+
  | <code>minecraft.sneak_time</code>
  | Color
+
  | 4
| VarInt Enum
+
  | Time
  | Color ID (see below)
 
 
  |-
 
  |-
  | Dividers
+
  | <code>minecraft.walk_one_cm</code>
  | VarInt Enum
+
  | 5
  | as above
+
  | Distance
 
  |-
 
  |-
  | 5: update flags
+
  | <code>minecraft.crouch_one_cm</code>
  | Flags
+
  | 6
  | Unsigned Byte
+
  | Distance
| as above
 
 
  |-
 
  |-
  |}
+
  | <code>minecraft.sprint_one_cm</code>
 
+
| 7
{| class="wikitable"
+
  | Distance
  ! ID
 
! Color
 
 
  |-
 
  |-
  | 0
+
  | <code>minecraft.walk_on_water_one_cm</code>
  | Pink
+
  | 8
 +
| Distance
 
  |-
 
  |-
  | 1
+
  | <code>minecraft.fall_one_cm</code>
  | Blue
+
  | 9
 +
| Distance
 
  |-
 
  |-
  | 2
+
  | <code>minecraft.climb_one_cm</code>
  | Red
+
  | 10
 +
| Distance
 
  |-
 
  |-
  | 3
+
  | <code>minecraft.fly_one_cm</code>
  | Green
+
  | 11
 +
| Distance
 
  |-
 
  |-
  | 4
+
  | <code>minecraft.walk_under_water_one_cm</code>
  | Yellow
+
  | 12
 +
| Distance
 
  |-
 
  |-
  | 5
+
  | <code>minecraft.minecart_one_cm</code>
  | Purple
+
  | 13
 +
| Distance
 
  |-
 
  |-
  | 6
+
  | <code>minecraft.boat_one_cm</code>
  | White
+
  | 14
  |}
+
  | Distance
 
 
{| class="wikitable"
 
! ID
 
! Type of division
 
 
  |-
 
  |-
  | 0
+
  | <code>minecraft.pig_one_cm</code>
  | No division
+
  | 15
 +
| Distance
 
  |-
 
  |-
  | 1
+
  | <code>minecraft.horse_one_cm</code>
  | 6 notches
+
  | 16
 +
| Distance
 +
|-
 +
| <code>minecraft.aviate_one_cm</code>
 +
| 17
 +
| Distance
 
  |-
 
  |-
  | 2
+
  | <code>minecraft.swim_one_cm</code>
  | 10 notches
+
  | 18
 +
| Distance
 
  |-
 
  |-
  | 3
+
  | <code>minecraft.strider_one_cm</code>
  | 12 notches
+
  | 19
 +
| Distance
 
  |-
 
  |-
  | 4
+
  | <code>minecraft.jump</code>
  | 20 notches
+
  | 20
  |}
+
  | None
 
 
==== Server Difficulty ====
 
 
 
Changes the difficulty setting in the client's option menu
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x0D
+
  | <code>minecraft.drop</code>
|rowspan="1"| Play
+
  | 21
|rowspan="1"| Client
+
  | None
| Difficulty
 
| Unsigned Byte
 
  | 0: peaceful, 1: easy, 2: normal, 3: hard
 
  |}
 
 
 
==== 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
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x0E
+
  | <code>minecraft.damage_dealt</code>
|rowspan="2"| Play
+
  | 22
|rowspan="2"| Client
+
  | Damage
| Count
 
  | VarInt
 
  | Number of elements in the following array
 
 
  |-
 
  |-
  | Matches
+
  | <code>minecraft.damage_dealt_absorbed</code>
  | Array of String
+
  | 23
  | One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
  | Damage
|}
 
 
 
==== Chat Message (clientbound) ====
 
 
 
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options. While Position 2 accepts json formatting it will not display, old style formatting works
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x0F
+
  | <code>minecraft.damage_dealt_resisted</code>
|rowspan="2"| Play
+
  | 24
|rowspan="2"| Client
+
  | Damage
| JSON Data
 
  | [[Chat]]
 
  | Limited to 32767 bytes
 
 
  |-
 
  |-
  | Position
+
  | <code>minecraft.damage_taken</code>
| Byte
+
  | 25
| 0: chat (chat box), 1: system message (chat box), 2: above hotbar
+
  | Damage
|}
 
 
 
==== Multi Block Change ====
 
 
 
Fired whenever 2 or more blocks are changed within the same chunk on the same tick.
 
 
 
{{Warning|Changing blocks in chunks not loaded by the client is unsafe (see note on [[#Block Change|Block Change]]).}}
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
  ! Bound To
 
!colspan="2"| Field Name
 
  !colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x10
+
  | <code>minecraft.damage_blocked_by_shield</code>
|rowspan="6"| Play
+
  | 26
|rowspan="6"| Client
+
  | Damage
  |colspan="2"| Chunk X
 
|colspan="2"| Int
 
  | Chunk X coordinate
 
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  | <code>minecraft.damage_absorbed</code>
  |colspan="2"| Int
+
  | 27
  | Chunk Z coordinate
+
  | Damage
 
  |-
 
  |-
  |colspan="2"| Record Count
+
  | <code>minecraft.damage_resisted</code>
  |colspan="2"| VarInt
+
  | 28
  | Number of elements in the following array, i.e. the number of blocks affected
+
  | Damage
 
  |-
 
  |-
  |rowspan="3"| Record
+
  | <code>minecraft.deaths</code>
| Horizontal Position
+
| 29
|rowspan="3"| Array
+
| None
| 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.mob_kills</code>
  | Unsigned Byte
+
  | 30
  | Y coordinate of the block
+
  | None
 
  |-
 
  |-
  | Block ID
+
  | <code>minecraft.animals_bred</code>
| VarInt
+
  | 31
| 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>)
+
  | None
  |}
 
 
 
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.player_kills</code>
|rowspan="3"| Play
+
  | 32
|rowspan="3"| Client
+
  | None
| Window ID
 
  | Byte
 
  | The ID of the window that the action occurred in
 
 
  |-
 
  |-
  | Action Number
+
  | <code>minecraft.fish_caught</code>
  | Short
+
  | 33
  | Every action that is to be accepted has a unique number. This field corresponds to that number.
+
  | None
 
  |-
 
  |-
  | Accepted
+
  | <code>minecraft.talked_to_villager</code>
| Boolean
+
  | 34
  | Whether the action was accepted
+
  | None
  |}
 
 
 
==== 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.
 
 
 
Note, notchian clients send a close window packet with Window ID 0 to close their inventory even though there is never an [[#Open Window|Open Window]] packet for inventory.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  | 0x12
+
  | <code>minecraft.traded_with_villager</code>
| Play
+
  | 35
| Client
+
  | None
| 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.eat_cake_slice</code>
|rowspan="5"| Play
+
  | 36
  |rowspan="5"| Client
+
  | None
  | 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.fill_cauldron</code>
  | String
+
  | 37
  | The window type to use for display. See [[Inventory]] for a list.
+
  | None
 
  |-
 
  |-
  | Window Title
+
  | <code>minecraft.use_cauldron</code>
  | [[Chat]]
+
  | 38
  | The title of the window
+
  | None
 
  |-
 
  |-
  | Number Of Slots
+
  | <code>minecraft.clean_armor</code>
  | Unsigned Byte
+
  | 39
  | Number of slots in the window (excluding the number of slots in the player inventory)
+
  | None
 
  |-
 
  |-
  | Entity ID
+
  | <code>minecraft.clean_banner</code>
  | Optional Int
+
  | 40
  | EntityHorse's EID. Only sent when Window Type is “EntityHorse”
+
  | None
|}
 
 
 
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.clean_shulker_box</code>
  |rowspan="3"| Play
+
| 41
  |rowspan="3"| Client
+
  | None
  | Window ID
+
  |-
  | Unsigned Byte
+
  | <code>minecraft.interact_with_brewingstand</code>
  | The ID of window which items are being sent for. 0 for player inventory.
+
  | 42
 +
  | None
 
  |-
 
  |-
  | Count
+
  | <code>minecraft.interact_with_beacon</code>
  | Short
+
  | 43
  | Number of elements in the following array
+
  | None
 
  |-
 
  |-
  | Slot Data
+
  | <code>minecraft.inspect_dropper</code>
| Array of [[Slot Data|Slot]]
+
  | 44
  |  
+
  | None
  |}
 
 
 
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.inspect_hopper</code>
|rowspan="3"| Play
+
  | 45
|rowspan="3"| Client
+
  | None
| Window ID
 
  | Unsigned Byte
 
  |  
 
 
  |-
 
  |-
  | Property
+
  | <code>minecraft.inspect_dispenser</code>
  | Short
+
  | 46
  | The property to be updated, see below
+
  | None
 
  |-
 
  |-
  | Value
+
  | <code>minecraft.play_noteblock</code>
| Short
+
  | 47
  | The new value for the property, see below
+
  | None
  |}
 
 
 
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.tune_noteblock</code>
  ! Property
+
  | 48
  ! Value
+
  | 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
 
  |-
 
  |-
  |rowspan="4"| Furnace
+
  | <code>minecraft.interact_with_crafting_table</code>
  | 0: Fire icon (fuel left)
+
  | 55
  | counting from fuel burn time down to 0 (in-game ticks)
+
  | None
 
  |-
 
  |-
  | 1: Maximum fuel burn time
+
  | <code>minecraft.open_chest</code>
  | fuel burn time or 0 (in-game ticks)
+
  | 56
 +
| None
 
  |-
 
  |-
  | 2: Progress arrow
+
  | <code>minecraft.sleep_in_bed</code>
  | counting from 0 to maximum progress (in-game ticks)
+
  | 57
 +
| None
 
  |-
 
  |-
  | 3: Maximum progress
+
  | <code>minecraft.open_shulker_box</code>
  | always 200 on the notchian server
+
  | 58
 +
| None
 
  |-
 
  |-
  |rowspan="10"| Enchantment Table
+
  | <code>minecraft.open_barrel</code>
  | 0: Level requirement for top enchantment slot
+
  | 59
  |rowspan="3"| The enchantment's xp level requirement
+
  | None
 
  |-
 
  |-
  | 1: Level requirement for middle enchantment slot
+
  | <code>minecraft.interact_with_blast_furnace</code>
 +
| 60
 +
| None
 
  |-
 
  |-
  | 2: Level requirement for bottom enchantment slot
+
  | <code>minecraft.interact_with_smoker</code>
 +
| 61
 +
| None
 
  |-
 
  |-
  | 3: The enchantment seed
+
  | <code>minecraft.interact_with_lectern</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>).
+
| 62
 +
| None
 
  |-
 
  |-
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
+
  | <code>minecraft.interact_with_campfire</code>
  |rowspan="3"| The enchantment id (set to -1 to hide it)
+
  | 63
 +
| None
 
  |-
 
  |-
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
+
  | <code>minecraft.interact_with_cartography_table</code>
 +
| 64
 +
| None
 
  |-
 
  |-
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
+
  | <code>minecraft.interact_with_loom</code>
 +
| 65
 +
| None
 
  |-
 
  |-
  | 7: Enchantment level shown on mouse hover over the top slot
+
  | <code>minecraft.interact_with_stonecutter</code>
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
+
  | 66
 +
| None
 
  |-
 
  |-
  | 8: Enchantment level shown on mouse hover over the middle slot
+
  | <code>minecraft.bell_ring</code>
 +
| 67
 +
| None
 
  |-
 
  |-
  | 9: Enchantment level shown on mouse hover over the bottom slot
+
  | <code>minecraft.raid_trigger</code>
 +
| 68
 +
| None
 
  |-
 
  |-
  |rowspan="3"| Beacon
+
  | <code>minecraft.raid_win</code>
  | 0: Power level
+
  | 69
  | 0-4, controls what effect buttons are enabled
+
  | None
 
  |-
 
  |-
  | 1: First potion effect
+
  | <code>minecraft.interact_with_anvil</code>
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
+
  | 70
 +
| None
 
  |-
 
  |-
  | 2: Second potion effect
+
  | <code>minecraft.interact_with_grindstone</code>
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
+
  | 71
 +
| None
 
  |-
 
  |-
  | Anvil
+
  | <code>minecraft.target_hit</code>
  | 0: Repair cost
+
  | 72
  | The repair's cost in xp levels
+
  | None
 
  |-
 
  |-
  | Brewing Stand
+
  | <code>minecraft.interact_with_smithing_table</code>
  | 0: Brew time
+
  | 73
  | 0–400, with 400 making the arrow empty, and 0 making the arrow full
+
  | None
 
  |}
 
  |}
  
==== Set Slot ====
+
Units:
  
Sent by the server when an item in a slot (in a window) is added/removed.
+
* 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 Block Change ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,327: Line 1,170:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x16
+
  |rowspan="4"| 0x05
  |rowspan="3"| Play
+
  |rowspan="4"| Play
  |rowspan="3"| Client
+
  |rowspan="4"| Client
  | Window ID
+
  | Sequence ID
  | Byte
+
  | VarInt
  | 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).
+
  | Represents the sequence to acknowledge, this is used for properly syncing block changes to the client after interactions.
|-
 
| Slot
 
| Short
 
| The slot that should be updated
 
 
  |-
 
  |-
| Slot Data
 
| [[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 Block Destroy Stage ====
 +
 
 +
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
  
==== Set Cooldown ====
+
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)
  
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.
+
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,359: Line 1,196:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x17
+
  |rowspan="3"| 0x06
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Item ID
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Numeric ID of the item to apply a cooldown to.
+
  | The ID of the entity breaking the block.
 +
|-
 +
| Location
 +
| Position
 +
| Block Position.
 
  |-
 
  |-
  | Cooldown Ticks
+
  | Destroy Stage
  | VarInt
+
  | Byte
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
+
  | 0–9 to set it, any other value to remove it.
 
  |}
 
  |}
  
==== Plugin Message (clientbound) ====
+
==== Block Entity Data ====
  
{{Main|Plugin channels}}
+
Sets the block entity associated with the block at the given location.
 
 
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"
 
{| class="wikitable"
Line 1,387: Line 1,224:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x18
+
  |rowspan="3"| 0x07
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Channel
+
  | Location
  | String
+
  | Position
  | Name of the [[plugin channel]] used to send the data
+
  |
 +
|-
 +
| Type
 +
| VarInt
 +
| The type of the block entity
 
  |-
 
  |-
  | Data
+
  | NBT Data
  | Byte Array
+
  | [[NBT|NBT Tag]]
| 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.
+
| Data to setMay 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).
 
  |}
 
  |}
  
==== Named Sound Effect ====
+
==== Block Action ====
{{See also|#Sound Effect}}
+
 
 +
This packet is used for a number of actions and animations performed by blocks, usually non-persistent.  The client ignores the provided block type and instead uses the block state in their world.
  
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
+
See [[Block Actions]] for a list of values.
 +
 
 +
{{Warning2|This packet uses a block ID, not a block state.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,412: Line 1,256:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x19
+
  |rowspan="4"| 0x08
  |rowspan="7"| Play
+
  |rowspan="4"| Play
  |rowspan="7"| Client
+
  |rowspan="4"| Client
  | Sound Name
+
  | Location
  | String
+
  | Position
  | All sound effect names as of 1.11.0 can be seen [http://pokechu22.github.io/Burger/1.11.html#sounds here].
+
  | Block coordinates.
 
  |-
 
  |-
  | Sound Category
+
  | Action ID (Byte 1)
  | VarInt Enum
+
  | Unsigned Byte
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
+
  | Varies depending on block — see [[Block Actions]].
 
  |-
 
  |-
  | Effect Position X
+
  | Action Parameter (Byte 2)
  | Int
+
  | Unsigned Byte
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | Varies depending on block — see [[Block Actions]].
 
  |-
 
  |-
  | Effect Position Y
+
  | Block Type
  | Int
+
  | VarInt
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | The block type ID for the block. This must match the block at the given coordinates.
  |-
 
| Effect Position Z
 
| Int
 
| Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
|-
 
| Volume
 
| Float
 
| 1 is 100%, can be more
 
|-
 
| Pitch
 
| Float
 
| Float between 0.5 and 2.0 by Notchian clients
 
 
  |}
 
  |}
  
==== Disconnect (play) ====
 
  
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.
+
==== Block Update ====
  
{| class="wikitable"
+
Fired whenever a block is changed within the render distance.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
| 0x1A
 
| Play
 
| Client
 
| Reason
 
| [[Chat]]
 
| Displayed to the client when the connection terminates.
 
|}
 
  
==== Entity Status ====
+
{{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.}}
 
 
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 1,476: Line 1,291:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1B
+
  |rowspan="2"| 0x09
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Entity ID
+
  | Location
  | Int
+
  | Position
  |  
+
  | Block Coordinates.
 
  |-
 
  |-
  | Entity Status
+
  | Block ID
  | Byte Enum
+
  | VarInt
  | See below
+
  | 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.
 
  |}
 
  |}
  
See [[entities]] for a list of which statuses are valid for each type of entity.
+
==== Boss Bar ====
 
 
==== Explosion ====
 
 
 
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
 
 
 
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,500: Line 1,309:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x1C
+
  |rowspan="14"| 0x0A
  |rowspan="9"| Play
+
  |rowspan="14"| Play
  |rowspan="9"| Client
+
  |rowspan="14"| Client
  | X
+
  |colspan="2"| UUID
  | Float
+
  | UUID
  |  
+
  | Unique ID for this bar.
 
  |-
 
  |-
  | Y
+
  |colspan="2"| Action
  | Float
+
  | VarInt Enum
  |  
+
  | Determines the layout of the remaining packet.
 
  |-
 
  |-
  | Z
+
! Action
  | Float
+
! Field Name
  |  
+
!
 +
!
 +
|-
 +
|rowspan="5"| 0: add
 +
  | Title
 +
  | [[Chat]]
 +
  |
 
  |-
 
  |-
  | Radius
+
  | Health
 
  | Float
 
  | Float
  | Currently unused in the client
+
  | 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.
 
  |-
 
  |-
  | Record Count
+
  | Color
  | Int
+
  | VarInt Enum
  | Number of elements in the following array
+
  | Color ID (see below).
 
  |-
 
  |-
  | Records
+
  | Division
  | Array of (Byte, Byte, Byte)
+
  | VarInt Enum
  | Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
+
  | Type of division (see below).
 
  |-
 
  |-
  | Player Motion X
+
  | Flags
  | Float
+
  | Unsigned Byte
  | X velocity of the player being pushed by the explosion
+
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02).
 
  |-
 
  |-
  | Player Motion Y
+
  | 1: remove
  | Float
+
  | ''no fields''
  | Y velocity of the player being pushed by the explosion
+
  | ''no fields''
 +
| Removes this boss bar.
 
  |-
 
  |-
  | Player Motion Z
+
  | 2: update health
 +
| Health
 
  | Float
 
  | Float
  | Z velocity of the player being pushed by the explosion
+
  | ''as above''
|}
 
 
 
==== Unload Chunk ====
 
 
 
Tells the client to unload a chunk column.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x1D
+
  | 3: update title
  |rowspan="2"| Play
+
| Title
  |rowspan="2"| Client
+
| [[Chat]]
  | Chunk X
+
  |
  | Int
+
|-
  | Block coordinate divided by 16, rounded down
+
  |rowspan="2"| 4: update style
 +
  | Color
 +
  | VarInt Enum
 +
  | Color ID (see below).
 
  |-
 
  |-
  | Chunk Z
+
  | Dividers
  | Int
+
  | VarInt Enum
  | Block coordinate divided by 16, rounded down
+
  | ''as above''
|}
 
 
 
==== Change Game State ====
 
 
 
Used for a wide variety of game state things, from weather to bed use to game mode to demo messages.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x1E
+
  | 5: update flags
|rowspan="2"| Play
+
  | Flags
|rowspan="2"| Client
 
  | Reason
 
 
  | Unsigned Byte
 
  | Unsigned Byte
  | See below
+
  | ''as above''
 
  |-
 
  |-
| Value
 
| Float
 
| Depends on Reason
 
 
  |}
 
  |}
 
''Reason codes'':
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Reason
+
  ! ID
  ! Effect
+
  ! Color
! Value
 
 
  |-
 
  |-
 
  | 0
 
  | 0
  | Invalid Bed
+
  | Pink
| Would be used to switch between messages, but the only used message is 0 for invalid bed
 
 
  |-
 
  |-
 
  | 1
 
  | 1
  | End raining
+
  | Blue
|
 
 
  |-
 
  |-
 
  | 2
 
  | 2
  | Begin raining
+
  | Red
|
 
 
  |-
 
  |-
 
  | 3
 
  | 3
  | Change game mode
+
  | Green
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 
 
  |-
 
  |-
 
  | 4
 
  | 4
  | Exit end
+
  | Yellow
| 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.
 
 
  |-
 
  |-
 
  | 5
 
  | 5
  | Demo message
+
  | Purple
| 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
+
  |-
  |-  
 
 
  | 6
 
  | 6
  | Arrow hitting player
+
  | White
  | Appears to be played when an arrow strikes another player in Multiplayer
+
  |}
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Type of division
 +
|-
 +
| 0
 +
| No division
 
  |-
 
  |-
  | 7
+
  | 1
  | Fade value
+
| 6 notches
  | The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
+
|-
 +
  | 2
 +
  | 10 notches
 
  |-
 
  |-
  | 8
+
  | 3
  | Fade time
+
  | 12 notches
| Time in ticks for the sky to fade
 
 
  |-
 
  |-
  | 10
+
  | 4
| Play elder guardian mob appearance (effect and sound)
+
  | 20 notches
  |  
 
 
  |}
 
  |}
  
==== Keep Alive (clientbound) ====
+
==== Change Difficulty ====
  
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.
+
Changes the difficulty setting in the client's option menu
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,652: Line 1,439:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x1F
+
  |rowspan="2"| 0x0B
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Keep Alive ID
+
  | Difficulty
  | VarInt
+
| Unsigned Byte
  |  
+
| 0: peaceful, 1: easy, 2: normal, 3: hard.
 +
|-
 +
| Difficulty locked?
 +
  | Boolean
 +
  |
 
  |}
 
  |}
  
==== Chunk Data ====
+
==== Chat Preview (clientbound) ====
{{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).
+
Sets the message to preview on the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,673: Line 1,463:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x20
+
  |rowspan="3"| 0x0C
  |rowspan="9"| Play
+
  |rowspan="3"| Play
  |rowspan="9"| Client
+
  |rowspan="3"| Client
  | Chunk X
+
  | Query ID
  | Int
+
  | Integer
  | Block coordinate divided by 16, rounded down
+
  |
 
  |-
 
  |-
  | Chunk Z
+
  | Component is Present
  | Int
+
  | Boolean
  | Block coordinate divided by 16, rounded down
+
  |
 
  |-
 
  |-
  | Ground-Up Continuous
+
  | Message to Preview
| Boolean
+
  | Component
| This is true if the packet represents all chunk sections in this vertical chunk column, where the Primary Bit Mask specifies exactly which chunk sections are included, and which are air.
+
  |
|-
 
| Primary Bit Mask
 
| VarInt
 
| Bitmask with bits set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
 
|-
 
| Size
 
| VarInt
 
| Size of Data in bytes, plus size of Biomes in bytes if present
 
|-
 
| Data
 
| Array of [[SMP Map Format|Chunk Section]]
 
| The length of the array is equal to the number of bits set in Primary Bit Mask. Chunks are sent bottom-to-top, i.e. the first chunk, if sent, extends from Y=0 to Y=15.
 
|-
 
| Biomes
 
| Optional Byte Array
 
| Only if Ground-Up Continuous: biome array, byte per XZ coordinate, 256 bytes total.
 
|-
 
| Number of block entities
 
| VarInt
 
| Length of the following array
 
|-
 
| Block entities
 
  | Array of [[NBT|NBT Tag]]
 
  | All block entities in the chunk.  Use the x, y, and z tags in the NBT to determine their positions.
 
 
  |}
 
  |}
  
==== Effect ====
+
==== Clear Titles ====
 
 
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.
+
Clear the client's current title information, with the option to also reset it.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,727: Line 1,491:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x21
+
  |rowspan="1"| 0x0D
  |rowspan="4"| Play
+
  |rowspan="1"| Play
  |rowspan="4"| Client
+
  |rowspan="1"| Client
  | Effect ID
+
  | Reset
| Int
 
| The ID of the effect, see below
 
|-
 
| Location
 
| Position
 
| The location of the effect
 
|-
 
| Data
 
| Int
 
| Extra data for certain effects, see below
 
|-
 
| Disable Relative Volume
 
 
  | Boolean
 
  | Boolean
  | See above
+
  |
 
  |}
 
  |}
  
Effect IDs:
+
==== Command Suggestions Response ====
 +
 
 +
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"
 
{| class="wikitable"
  ! ID
+
  ! Packet ID
  ! Name
+
  ! State
  ! Data
+
! Bound To
 +
!colspan="2"| Field Name
 +
  !colspan="2"| Field Type
 +
! Notes
 
  |-
 
  |-
  !colspan="3"| Sound
+
  |rowspan="8"| 0x0E
 +
|rowspan="8"| Play
 +
|rowspan="8"| Client
 
  |-
 
  |-
  | 1000
+
  |colspan="2"| ID
  | Dispenser dispenses
+
  |colspan="2"| VarInt
  |  
+
  | Transaction ID.
 
  |-
 
  |-
  | 1001
+
  |colspan="2"| Start
  | Dispenser fails to dispense
+
  |colspan="2"| VarInt
  |  
+
  | Start of the text to replace.
 
  |-
 
  |-
  | 1002
+
  |colspan="2"| Length
  | Dispenser shoots
+
  |colspan="2"| VarInt
  |  
+
  | Length of the text to replace.
 
  |-
 
  |-
  | 1003
+
  |colspan="2"| Count
  | Ender eye launched
+
  |colspan="2"| VarInt
  |  
+
  | Number of elements in the following array.
 
  |-
 
  |-
  | 1004
+
  |rowspan="3"| Matches
  | Firework shot
+
  | 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.
 
  |-
 
  |-
  | 1005
+
  | Has tooltip
  | Iron door opened
+
  | Boolean
  |  
+
  | True if the following is present.
 
  |-
 
  |-
  | 1006
+
  | Tooltip
  | Wooden door opened
+
  | Optional [[Chat]]
  |  
+
  | Tooltip to display; only present if previous boolean is true.
 +
|}
 +
 
 +
==== 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
 
  |-
 
  |-
  | 1007
+
  |rowspan="3"| 0x0F
  | Wooden trapdoor opened
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Count
 +
  | VarInt
 +
  | Number of elements in the following array.
 
  |-
 
  |-
  | 1008
+
  | Nodes
  | Fence gate opened
+
  | Array of [[Command Data|Node]]
  |  
+
  | An array of nodes.
 
  |-
 
  |-
  | 1009
+
  | Root index
  | Fire extinguished
+
  | VarInt
  |  
+
  | Index of the <code>root</code> node in the previous array.
 +
|}
 +
 
 +
For more information on this packet, see the [[Command Data]] article.
 +
 
 +
==== Close Container (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
 
  |-
 
  |-
  | 1010
+
  | 0x10
  | Play record
+
  | Play
  | {{Minecraft Wiki|Music Discs|Record ID}}
+
  | Client
 +
| Window ID
 +
| Unsigned Byte
 +
| This is the ID of the window that was closed. 0 for inventory.
 +
|}
 +
 
 +
==== Set Container Content ====
 +
[[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
 
  |-
 
  |-
  | 1011
+
  |rowspan="5"| 0x11
  | Iron door closed
+
|rowspan="5"| Play
  |  
+
|rowspan="5"| Client
 +
| Window ID
 +
  | Unsigned Byte
 +
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  | 1012
+
  | State ID
  | Wooden door closed
+
  | VarInt
  |  
+
  | The last received State ID from either a [[#Set Container Slot|Set Container Slot]] or a [[#Set Container Content|Set Container Content]] packet
 
  |-
 
  |-
  | 1013
+
  | Count
  | Wooden trapdoor closed
+
  | VarInt
  |  
+
  | Number of elements in the following array.
 
  |-
 
  |-
  | 1014
+
  | Slot Data
  | Fence gate closed
+
  | Array of [[Slot Data|Slot]]
|  
 
 
  |-
 
  |-
  | 1015
+
  | Carried Item
  | Ghast warns
+
  | [[Slot Data|Slot]]
  |  
+
| Item held by player.
 +
  |}
 +
 
 +
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 +
 
 +
==== Set Container Property ====
 +
 
 +
This packet is used to inform the client that part of a GUI window should be updated.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1016
+
  |rowspan="3"| 0x12
  | Ghast shoots
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Window ID
 +
  | Unsigned Byte
 +
  |
 
  |-
 
  |-
  | 1017
+
  | Property
  | Enderdragon shoots
+
  | Short
  |  
+
  | The property to be updated, see below.
 
  |-
 
  |-
  | 1018
+
  | Value
  | Blaze shoots
+
  | 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"
 
  |-
 
  |-
  | 1019
+
  ! Window type
  | Zombie attacks wood door
+
  ! Property
  |
+
  ! Value
 
  |-
 
  |-
  | 1020
+
  |rowspan="4"| Furnace
  | Zombie attacks iron door
+
  | 0: Fire icon (fuel left)
  |  
+
  | counting from fuel burn time down to 0 (in-game ticks)
 
  |-
 
  |-
  | 1021
+
  | 1: Maximum fuel burn time
| Zombie breaks wood door
+
  | fuel burn time or 0 (in-game ticks)
  |
 
 
  |-
 
  |-
  | 1022
+
  | 2: Progress arrow
| Wither breaks block
+
  | counting from 0 to maximum progress (in-game ticks)
  |
 
 
  |-
 
  |-
  | 1023
+
  | 3: Maximum progress
| Wither spawned
+
  | always 200 on the notchian server
  |  
 
 
  |-
 
  |-
  | 1024
+
  |rowspan="10"| Enchantment Table
  | Wither shoots
+
  | 0: Level requirement for top enchantment slot
  |
+
  |rowspan="3"| The enchantment's xp level requirement
 
  |-
 
  |-
  | 1025
+
  | 1: Level requirement for middle enchantment slot
| Bat takes off
 
|
 
 
  |-
 
  |-
  | 1026
+
  | 2: Level requirement for bottom enchantment slot
| Zombie infects
 
|
 
 
  |-
 
  |-
  | 1027
+
  | 3: The enchantment seed
  | Zombie villager converted
+
  | 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>).
  |
 
 
  |-
 
  |-
  | 1028
+
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
  | Ender dragon death
+
  |rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
|
 
 
  |-
 
  |-
  | 1029
+
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
| Anvil destroyed
 
|
 
 
  |-
 
  |-
  | 1030
+
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
| Anvil used
 
|
 
 
  |-
 
  |-
  | 1031
+
  | 7: Enchantment level shown on mouse hover over the top slot
  | Anvil landed
+
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
|
 
 
  |-
 
  |-
  | 1032
+
  | 8: Enchantment level shown on mouse hover over the middle slot
| Portal travel
 
|
 
 
  |-
 
  |-
  | 1033
+
  | 9: Enchantment level shown on mouse hover over the bottom slot
| Chorus flower grown
 
|
 
 
  |-
 
  |-
  | 1034
+
  |rowspan="3"| Beacon
  | Chorus flower died
+
  | 0: Power level
  |  
+
  | 0-4, controls what effect buttons are enabled
 
  |-
 
  |-
  | 1035
+
  | 1: First potion effect
  | Brewing stand brewed
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
|
 
 
  |-
 
  |-
  | 1036
+
  | 2: Second potion effect
  | Iron trapdoor opened
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
|  
 
 
  |-
 
  |-
  | 1037
+
  | Anvil
  | Iron trapdoor closed
+
  | 0: Repair cost
  |
+
  | The repair's cost in xp levels
 
  |-
 
  |-
  !colspan="3"| Particle
+
  |rowspan="2"| Brewing Stand
 +
| 0: Brew time
 +
| 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
  |-
 
  |-
  | 2000
+
  | 1: Fuel time
  | Spawns 10 smoke particles, e.g. from a fire
+
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
| Direction, see below
 
 
  |-
 
  |-
  | 2001
+
  | Stonecutter
  | Block break + block break sound
+
  | 0: Selected recipe
  | {{Minecraft Wiki|Data values|Block ID}}
+
  | The index of the selected recipe. -1 means none is selected.
 
  |-
 
  |-
  | 2002
+
  | Loom
  | Splash potion. Particle effect + glass break sound.
+
  | 0: Selected pattern
  | [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
+
  | The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern.
 
  |-
 
  |-
  | 2003
+
  | Lectern
  | Eye of Ender entity break animation — particles and sound
+
  | 0: Page number
|
+
  | The current page number, starting from 0.
|-
+
  |}
| 2004
+
 
| Mob spawn particle effect: smoke + flames
+
For an enchanting table, the following numerical IDs are used:
  |  
 
  |-
 
| 2005
 
| Bonemeal particles
 
| How many particles to spawn (if set to 0, 15 are spawned)
 
|-
 
| 2006
 
| Dragon breath
 
|
 
|-
 
| 3000
 
| End gateway spawn
 
|
 
|-
 
| 3001
 
| Enderdragon growl
 
|
 
|}
 
 
 
Smoke directions:
 
  
 
{| 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
 
 
==== Particle ====
 
 
 
Displays the named particle
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="11"| 0x22
+
  | 9
|rowspan="11"| Play
+
  | minecraft:frost_walker
|rowspan="11"| Client
+
  | Frost Walker
| Particle ID
 
  | Int
 
  | See below
 
 
  |-
 
  |-
  | Long Distance
+
  | 10
  | Boolean
+
  | minecraft:binding_curse
  | If true, particle distance increases from 256 to 65536
+
  | Curse of Binding
 
  |-
 
  |-
  | X
+
  | 11
  | Float
+
  | minecraft:soul_speed
  | X position of the particle
+
  | Soul Speed
 
  |-
 
  |-
  | Y
+
  | 12
  | Float
+
  | minecraft:sharpness
  | Y position of the particle
+
  | Sharpness
 
  |-
 
  |-
  | Z
+
  | 13
  | Float
+
  | minecraft:smite
  | Z position of the particle
+
  | Smite
 
  |-
 
  |-
  | Offset X
+
  | 14
  | Float
+
  | minecraft:bane_of_arthropods
  | This is added to the X position after being multiplied by random.nextGaussian()
+
  | Bane of Arthropods
 
  |-
 
  |-
  | Offset Y
+
  | 15
  | Float
+
  | minecraft:knockback
  | This is added to the Y position after being multiplied by random.nextGaussian()
+
  | Knockback
 
  |-
 
  |-
  | Offset Z
+
  | 16
  | Float
+
  | minecraft:fire_aspect
  | This is added to the Z position after being multiplied by random.nextGaussian()
+
  | Fire Aspect
 
  |-
 
  |-
  | Particle Data
+
  | 17
  | Float
+
  | minecraft:looting
  | The data of each particle
+
  | Looting
 
  |-
 
  |-
  | Particle Count
+
  | 18
  | Int
+
  | minecraft:sweeping
  | The number of particles to create
+
  | Sweeping Edge
 
  |-
 
  |-
  | Data
+
  | 19
  | Array of VarInt
+
  | minecraft:efficiency
  | Length depends on particle. "iconcrack" has length of 2, "blockcrack", and "blockdust" have lengths of 1, the rest have 0.
+
  | Efficiency
|}
 
 
 
Particle IDs:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Particle Name
+
  | 20
  ! Particle ID
+
  | minecraft:silk_touch
 +
| Silk Touch
 
  |-
 
  |-
  | explode
+
  | 21
  | 0
+
  | minecraft:unbreaking
 +
| Unbreaking
 
  |-
 
  |-
  | largeexplosion
+
  | 22
  | 1
+
  | minecraft:fortune
 +
| Fortune
 
  |-
 
  |-
  | hugeexplosion
+
  | 23
  | 2
+
  | minecraft:power
 +
| Power
 
  |-
 
  |-
  | fireworksSpark
+
  | 24
  | 3
+
  | minecraft:punch
 +
| Punch
 
  |-
 
  |-
  | bubble
+
  | 25
  | 4
+
  | minecraft:flame
 +
| Flame
 
  |-
 
  |-
  | splash
+
  | 26
  | 5
+
  | minecraft:infinity
 +
| Infinity
 
  |-
 
  |-
  | wake
+
  | 27
  | 6
+
  | minecraft:luck_of_the_sea
  |-
+
  | Luck of the Sea
| suspended
 
| 7
 
|-
 
| depthsuspend
 
| 8
 
|-
 
| crit
 
| 9
 
|-
 
| magicCrit
 
| 10
 
|-
 
| smoke
 
| 11
 
|-
 
| largesmoke
 
| 12
 
|-
 
| spell
 
| 13
 
|-
 
| instantSpell
 
| 14
 
|-
 
| mobSpell
 
| 15
 
|-
 
| mobSpellAmbient
 
| 16
 
|-
 
| witchMagic
 
| 17
 
|-
 
| dripWater
 
| 18
 
|-
 
| dripLava
 
| 19
 
|-
 
| angryVillager
 
| 20
 
|-
 
| happyVillager
 
| 21
 
|-
 
| townaura
 
| 22
 
 
  |-
 
  |-
| note
 
| 23
 
|-
 
| portal
 
| 24
 
|-
 
| enchantmenttable
 
| 25
 
|-
 
| flame
 
| 26
 
|-
 
| lava
 
| 27
 
|-
 
| footstep
 
 
  | 28
 
  | 28
 +
| minecraft:lure
 +
| Lure
 
  |-
 
  |-
| cloud
 
 
  | 29
 
  | 29
 +
| minecraft:loyalty
 +
| Loyalty
 
  |-
 
  |-
| reddust
 
 
  | 30
 
  | 30
 +
| minecraft:impaling
 +
| Impaling
 
  |-
 
  |-
| snowballpoof
 
 
  | 31
 
  | 31
 +
| minecraft:riptide
 +
| Riptide
 
  |-
 
  |-
| snowshovel
 
 
  | 32
 
  | 32
 +
| minecraft:channeling
 +
| Channeling
 
  |-
 
  |-
| slime
 
 
  | 33
 
  | 33
 +
| minecraft:multishot
 +
| Multishot
 
  |-
 
  |-
| heart
 
 
  | 34
 
  | 34
 +
| minecraft:quick_charge
 +
| Quick Charge
 
  |-
 
  |-
| barrier
 
 
  | 35
 
  | 35
 +
| minecraft:piercing
 +
| Piercing
 
  |-
 
  |-
| iconcrack_(id)_(data)
 
 
  | 36
 
  | 36
 +
| minecraft:mending
 +
| Mending
 
  |-
 
  |-
| blockcrack_(id+(data<<12))
 
 
  | 37
 
  | 37
 +
| minecraft:vanishing_curse
 +
| Curse of Vanishing
 +
|}
 +
 +
==== Set Container Slot ====
 +
 +
Sent by the server when an item in a slot (in a window) is added/removed.
 +
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | blockdust_(id)
+
  |rowspan="4"| 0x13
  | 38
+
|rowspan="4"| Play
  |-
+
  |rowspan="4"| Client
  | droplet
+
  | Window ID
  | 39
+
  | 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).
 
  |-
 
  |-
  | take
+
  | State ID
  | 40
+
  | VarInt
 +
| The last received State ID from either a [[#Set Container Slot|Set Container Slot]] or a [[#Set Container Content|Set Container Content]] packet
 
  |-
 
  |-
  | mobappearance
+
  | Slot
  | 41
+
  | Short
 +
| The slot that should be updated.
 
  |-
 
  |-
  | dragonbreath
+
  | Slot Data
  | 42
+
  | [[Slot Data|Slot]]
|-
+
  |
| endrod
 
| 43
 
|-
 
| damageindicator
 
| 44
 
|-
 
| sweepattack
 
| 45
 
|-
 
| fallingdust
 
  | 46
 
 
  |}
 
  |}
  
==== Join Game ====
+
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
  
See [[Protocol Encryption]] for information on logging in.
+
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 45) if the player is in creative, with their inventory open, and not in their survival inventory tab.  Otherwise, when window ID is 0, it can edit any slot in the player's inventory.  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"
 
{| class="wikitable"
Line 2,202: Line 1,952:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x23
+
  |rowspan="2"| 0x14
  |rowspan="7"| Play
+
  |rowspan="2"| Play
  |rowspan="7"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Item ID
  | Int
+
  | VarInt
  | The player's Entity ID (EID)
+
  | Numeric ID of the item to apply a cooldown to.
 
  |-
 
  |-
  | Gamemode
+
  | Cooldown Ticks
  | Unsigned Byte
+
  | VarInt
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
+
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
 +
|}
 +
 
 +
==== Plugin Message (clientbound) ====
 +
 
 +
{{Main|Plugin channels}}
 +
 
 +
Mods and plugins can use this to send their data. Minecraft itself uses several [[plugin channel]]s. These internal channels are in the <code>minecraft</code> namespace.
 +
 
 +
More information on how it works on [https://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ Dinnerbone's blog]. More documentation about internal and popular registered channels are [[plugin channel|here]].
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Dimension
+
  |rowspan="2"| 0x15
  | Int Enum
+
|rowspan="2"| Play
  | -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
+
|rowspan="2"| Client
 +
| Channel
 +
  | Identifier
 +
  | Name of the [[plugin channel]] used to send the data.
 
  |-
 
  |-
  | Difficulty
+
  | Data
  | Unsigned Byte
+
  | Byte Array
  | 0: peaceful, 1: easy, 2: normal, 3: hard
+
  | Any data.
|-
 
| Max Players
 
| Unsigned Byte
 
| Was once used by the client to draw the player list, but now is ignored
 
|-
 
| Level Type
 
| String
 
| 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}}.
 
 
  |}
 
  |}
  
==== Map ====
+
In notchian client/server implementation, when sending data, data size is capped at 32767 bytes when server-bound and 1048576 bytes when client-bound. Though nothing prevents the server and client from reading larger data.
 +
 
 +
==== Custom Sound Effect ====
 +
{{See also|#Sound}}
  
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
+
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,242: Line 2,003:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="13"| 0x24
+
  |rowspan="8"| 0x16
  |rowspan="13"| Play
+
  |rowspan="8"| Play
  |rowspan="13"| Client
+
  |rowspan="8"| Client
  |colspan="2"| Item Damage
+
  | Sound Name
  |colspan="2"| VarInt
+
  | Identifier
  | The damage value (map ID) of the map being modified
+
  | All sound effect names can be seen [https://pokechu22.github.io/Burger/1.19.html#sounds here].
 
  |-
 
  |-
  |colspan="2"| Scale
+
  | Sound Category
  |colspan="2"| Byte
+
  | VarInt 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)
+
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories]).
|-
 
|colspan="2"| Tracking Position
 
|colspan="2"| Boolean
 
| Specifies whether the icons are shown
 
|-
 
|colspan="2"| Icon Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  | Effect Position X
  | Direction And Type
+
  | Int
  |rowspan="3"| Array
+
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
| Byte
 
| 0xF0 = Direction, 0x0F = Type
 
 
  |-
 
  |-
  | X
+
  | Effect Position Y
  | Byte
+
  | Int
  |  
+
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | Z
+
  | Effect Position Z
  | Byte
+
  | Int
  |  
+
  | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
|-  
 
|colspan="2"| Columns
 
|colspan="2"| Byte
 
| Number of columns updated
 
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | Volume
  |colspan="2"| Optional Byte
+
  | Float
  | Only if Columns is more than 0; number of rows updated
+
  | 1 is 100%, can be more.
 
  |-
 
  |-
  |colspan="2"| X
+
  | Pitch
  |colspan="2"| Optional Byte
+
  | Float
  | Only if Columns is more than 0; x offset of the westernmost column
+
  | Float between 0.5 and 2.0 by Notchian clients.
 
  |-
 
  |-
  |colspan="2"| Z
+
  | Seed
  |colspan="2"| Optional Byte
+
| long
  | Only if Columns is more than 0; z offset of the northernmost row
+
| Seed used to pick sound variant.
 +
  |}
 +
 
 +
==== Disconnect (play) ====
 +
 
 +
Sent by the server before it disconnects a client. The client assumes that the server has already closed the connection by the time the packet arrives.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  |colspan="2"| Length
+
  | 0x17
  |colspan="2"| Optional VarInt
+
  | Play
  | Only if Columns is more than 0; length of the following array
+
  | Client
  |-
+
  | Reason
  |colspan="2"| Data
+
  | [[Chat]]
  |colspan="2"| Optional Array of Unsigned Byte
+
  | Displayed to the client when the connection terminates.
| Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
 
  |}
 
  |}
  
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
+
==== Entity Event ====
  
Types are based off of rows and columns in <code>map_icons.png</code>:
+
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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Icon type
+
  |rowspan="2"| 0x18
  ! Result
+
  |rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| Int
 +
|
 
  |-
 
  |-
  | 0
+
  | Entity Status
  | White arrow (players)
+
  | Byte Enum
  |-
+
  | See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
  | 1
+
  |}
| Green arrow (item frames)
+
 
|-
+
==== Explosion ====
| 2
 
| Red arrow
 
|-
 
| 3
 
| Blue arrow
 
|-
 
| 4
 
| White cross
 
|-
 
| 5
 
| Red pointer
 
|-
 
| 6
 
| White circle (off-map players)
 
|-
 
| 7
 
| Small white circle (far-off-map players)
 
|-
 
| 8
 
| Mansion
 
|-
 
| 9
 
| Temple
 
|-
 
| 10-15
 
| Unused (blue square)
 
|}
 
  
==== Entity Relative Move ====
+
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
  
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.
+
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 
 
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,361: Line 2,101:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x25
+
  |rowspan="9"| 0x19
  |rowspan="5"| Play
+
  |rowspan="9"| Play
  |rowspan="5"| Client
+
  |rowspan="9"| Client
  | Entity ID
+
  | X
  | VarInt
+
  | Double
  |  
+
  |
 
  |-
 
  |-
  | Delta X
+
  | Y
  | Short
+
  | Double
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
  |
 
  |-
 
  |-
  | Delta Y
+
  | Z
  | Short
+
  | Double
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
  |
 +
|-
 +
| Strength
 +
| Float
 +
| A strength greater than or equal to 2.0 spawns a <code>minecraft:explosion_emitter</code> particle, while a lesser strength spawns a <code>minecraft:explosion</code> particle.
 +
|-
 +
| Record Count
 +
| VarInt
 +
| Number of elements in the following array.
 +
|-
 +
| Records
 +
| Array of (Byte, Byte, Byte)
 +
| Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
 +
|-
 +
| Player Motion X
 +
| Float
 +
| X velocity of the player being pushed by the explosion.
 
  |-
 
  |-
  | Delta Z
+
  | Player Motion Y
  | Short
+
  | Float
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
+
  | Y velocity of the player being pushed by the explosion.
 
  |-
 
  |-
  | On Ground
+
  | Player Motion Z
  | Boolean
+
  | Float
  |  
+
  | Z velocity of the player being pushed by the explosion.
 
  |}
 
  |}
  
==== Entity Look And Relative Move ====
+
==== Unload Chunk ====
  
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>)
+
Tells the client to unload a chunk column.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,397: Line 2,153:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x26
+
  |rowspan="2"| 0x1A
  |rowspan="7"| Play
+
  |rowspan="2"| Play
  |rowspan="7"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Chunk X
  | VarInt
+
  | Int
  |  
+
  | Block coordinate divided by 16, rounded down.
 
  |-
 
  |-
  | Delta X
+
  | Chunk Z
| Short
+
  | Int
| Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
  | Block coordinate divided by 16, rounded down.
|-
+
  |}
| Delta Y
+
 
| Short
+
It is legal to send this packet even if the given chunk is not currently loaded.
| Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
 
|-
+
==== Game Event ====
| Delta Z
+
 
  | Short
+
Used for a wide variety of game events, from weather to bed use to gamemode to demo messages.
  | 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,441: Line 2,179:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x27
+
  |rowspan="2"| 0x1B
  |rowspan="4"| Play
+
  |rowspan="2"| Play
  |rowspan="4"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Event
  | VarInt
+
  | Unsigned Byte
  |  
+
  | See below.
 
  |-
 
  |-
  | Yaw
+
  | Value
  | Angle
+
  | Float
| New angle, not a delta
+
  | Depends on Reason.
|-
 
| Pitch
 
| Angle
 
| New angle, not a delta
 
|-
 
| On Ground
 
| Boolean
 
  |  
 
 
  |}
 
  |}
  
==== Entity ====
+
''Events'':
 
 
This packet may be used to initialize an entity.
 
 
 
For player entities, either this packet or any move/look packet is sent every game tick. So the meaning of this packet is basically that the entity did not move/look since the last such packet.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Event
  ! State
+
  ! Effect
  ! Bound To
+
  ! Value
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x28
+
  | 0
  |rowspan="1"| Play
+
| No respawn block available
  |rowspan="1"| Client
+
| Note: Sends message 'block.minecraft.spawn.not_valid'(You have no home bed or charged respawn anchor, or it was obstructed) to the client.
  | Entity ID
+
|-
  | VarInt
+
| 1
  |  
+
| End raining
 +
|
 +
|-
 +
| 2
 +
| Begin raining
 +
|
 +
|-
 +
| 3
 +
| Change gamemode
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
 +
|-
 +
| 4
 +
| Win game
 +
| 0: Just respawn player. <br>1: Roll the credits and respawn player. <br> Note that 1 is only sent by notchian server when player has not yet achieved advancement "The end?", else 0 is sent.
 +
|-
 +
| 5
 +
| Demo event
 +
| 0: Show welcome to demo screen<br> 101: Tell movement controls<br> 102: Tell jump control<br> 103: Tell inventory control<br> 104: Tell that the demo is over and print a message about how to take a screenshot.
 +
|-
 +
| 6
 +
| Arrow hit player
 +
| Note: Sent when any player is struck by an arrow.
 +
|-
 +
| 7
 +
| Rain level change
 +
| Note: Seems to change both skycolor and lightning.<br>Rain level starting from 0 to 1.
 +
|-
 +
| 8
 +
| 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
 +
| Play pufferfish sting sound.
 +
|-
 +
| 10
 +
| 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).
 
  |}
 
  |}
  
==== Vehicle Move (clientbound) ====
+
==== Open Horse Screen ====
  
Note that all fields use absolute positioning and do not allow for relative positioning.
+
This packet is used exclusively for opening the horse GUI. [[#Open Screen|Open Screen]] is used for all other GUIs.  The client will not open the inventory if the Entity ID does not point to an horse-like animal.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,495: Line 2,258:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x29
+
  |rowspan="3"| 0x1C
  |rowspan="7"| Play
+
  |rowspan="3"| Play
  |rowspan="7"| Client
+
  |rowspan="3"| Client
  | X
+
  | Window ID
  | Double
+
  | Unsigned Byte
  | Absolute position (X coordinate)
+
  |
 
  |-
 
  |-
  | Y
+
  | Slot count
  | Double
+
  | VarInt
  | Absolute position (Y coordinate)
+
  |
 
  |-
 
  |-
  | Z
+
  | Entity ID
  | Double
+
  | Integer
  | Absolute position (Z coordinate)
+
  |
|-
 
| Yaw
 
| Float
 
| Absolute rotation on the vertical axis, in degrees
 
|-
 
| Pitch
 
| Float
 
| Absolute rotation on the horizontal axis, in degrees
 
 
  |}
 
  |}
  
==== Open Sign Editor ====
+
==== Initialize World Border ====
 
 
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]].
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,531: Line 2,284:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x2A
+
  |rowspan="8"| 0x1D
  |rowspan="1"| Play
+
  |rowspan="8"| Play
  |rowspan="1"| Client
+
  |rowspan="8"| Client
  | Location
+
  | X
  | Position
+
  | Double
  |  
+
  |
|}
 
 
 
==== 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
+
  | Z
|rowspan="3"| Play
+
  | Double
|rowspan="3"| Client
+
  |
| Flags
 
  | Byte
 
  | Bit field, see below
 
 
  |-
 
  |-
  | Flying Speed
+
  | Old Diameter
  | Float
+
  | Double
  |  
+
  | Current length of a single side of the world border, in meters.
 
  |-
 
  |-
  | Field of View Modifier
+
  | New Diameter
  | Float
+
  | Double
  | 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).
+
  | Target length of a single side of the world border, in meters.
|}
 
 
 
About the flags:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Field
+
  | Speed
  ! Bit
+
  | 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.
 
  |-
 
  |-
  | Invulnerable
+
  | Portal Teleport Boundary
  | 0x01
+
  | VarInt
 +
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 
  |-
 
  |-
  | Flying
+
  | Warning Blocks
  | 0x02
+
  | VarInt
 +
| In meters.
 
  |-
 
  |-
  | Allow Flying
+
  | Warning Time
  | 0x04
+
  | VarInt
 +
| In seconds as set by <code>/worldborder warning time</code>.
 
  |-
 
  |-
| Creative Mode
 
| 0x08
 
 
  |}
 
  |}
  
==== Combat Event ====
+
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.
 +
 
 +
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,593: Line 2,342:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x2C
+
  | 0x1E
  |rowspan="8"| Play
+
  | Play
  |rowspan="8"| Client
+
  | Client
  |colspan="2"| Event
+
  | Keep Alive ID
| VarInt Enum
+
  | Long
| Determines the layout of the remaining packet
+
  |
|-
 
! Event
 
! Field Name
 
!
 
!
 
|-
 
| 0: enter combat
 
| ''no fields''
 
| ''no fields''
 
|
 
|-
 
|rowspan="2"| 1: end combat
 
| Duration
 
| VarInt
 
|
 
|-
 
| Entity ID
 
| Int
 
|
 
|-
 
|rowspan="3"| 2: entity dead
 
| Player ID
 
  | VarInt
 
|
 
|-
 
| Entity ID
 
| Int
 
|
 
|-
 
| Message
 
| [[Chat]]
 
  |  
 
 
  |}
 
  |}
  
==== Player List Item ====
+
==== Chunk Data and Update Light ====
 +
{{Main|Chunk Format}}
 +
{{See also|#Unload Chunk}}
 +
 
 +
{{Need Info|How do biomes work now?  The biome change happened at the same time as the seed change, but it's not clear how/if biomes could be computed given that it's not the actual seed...  ([https://www.reddit.com/r/Mojira/comments/e5at6i/a_discussion_for_the_changes_to_how_biomes_are/ /r/mojira discussion] which notes that it seems to be some kind of interpolation, and 3D biomes are only used in the nether)}}
  
Sent by the server to update the user list (<tab> in the client).
+
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 [[#Block Entity Data|Block Entity Data]] later).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,645: Line 2,366:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="4"| Field Name
+
  !colspan="2"| Field Name
  !colspan="3"| Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="19"| 0x2D
+
  |rowspan="25"| 0x1F
  |rowspan="19"| Play
+
  |rowspan="25"| Play
  |rowspan="19"| Client
+
  |rowspan="25"| Client
  |colspan="4"| Action
+
  |colspan="2"| Chunk X
  |colspan="3"| VarInt
+
  |colspan="2"| Int
  | Determines the rest of the Player format after the UUID
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  |colspan="2"| Chunk Z
  |colspan="3"| VarInt
+
  |colspan="2"| Int
  | Number of elements in the following array
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
|rowspan="17"| Player
+
  |colspan="2"| Heightmaps
  |colspan="3"| UUID
+
  |colspan="2"| [[NBT]]
|rowspan="17"| Array
+
  | 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, with the number of bits per entry varying depending on the world's height, defined by the formula <code>ceil(log2(height + 1))</code>). 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.
  |colspan="2"| UUID
 
  |  
 
 
  |-
 
  |-
  ! Action
+
  |colspan="2"| Size
!colspan="2"| Field Name
+
  |colspan="2"| VarInt
  !colspan="2"|  
+
  | Size of Data in bytes
  !
 
 
  |-
 
  |-
|rowspan="10"| 0: add player
+
  |colspan="2"| Data
  |colspan="2"| Name
+
  |colspan="2"| Byte array
  |colspan="2"| String
+
  | See [[Chunk Format#Data structure|data structure]] in Chunk Format
  |  
 
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  |colspan="2"| Number of block entities
 
  |colspan="2"| VarInt
 
  |colspan="2"| VarInt
 
  | Number of elements in the following array
 
  | Number of elements in the following array
 
  |-
 
  |-
  |rowspan="4"| Property
+
  |rowspan="4" | Block Entity
  | Name
+
  | Packed XZ
  |rowspan="4"| Array
+
  |rowspan="4" | Array
  | String
+
  | 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
 
  |-
 
  |-
  | Value
+
  | Data
  | String
+
  | [[NBT]]
|
+
  | The block entity's data, without the X, Y, and Z values
|-
 
| Is Signed
 
| Boolean
 
  |  
 
 
  |-
 
  |-
  | Signature
+
  |colspan="2"| Trust Edges
  | Optional String
+
  |colspan="2"| Boolean
  | Only if Is Signed is true
+
  | If edges should be trusted for light updates.
 
  |-
 
  |-
  |colspan="2"| Gamemode
+
  |colspan="2"| Sky Light Mask
  |colspan="2"| VarInt
+
  |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"| Ping
+
  |colspan="2"| Block Light Mask
  |colspan="2"| VarInt
+
  |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"| Has Display Name
+
  |colspan="2"| Empty Sky Light Mask
  |colspan="2"| Boolean
+
  |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"| Display Name
+
  |colspan="2"| Empty Block Light Mask
  |colspan="2"| Optional [[Chat]]
+
  |colspan="2"| BitSet
  | Only if Has Display Name is true
+
  | 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.
 
  |-
 
  |-
| 1: update gamemode
+
  |colspan="2"| Sky Light array count
  |colspan="2"| Gamemode
 
 
  |colspan="2"| VarInt
 
  |colspan="2"| VarInt
  |  
+
  | Number of entries in the following array; should match the number of bits set in Sky Light Mask
|-
 
| 2: update latency
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
|
 
 
  |-
 
  |-
  |rowspan="2"| 3: update display name
+
  |rowspan="2"| Sky Light arrays
  |colspan="2"| Has Display Name
+
  | Length
  |colspan="2"| Boolean
+
|rowspan="2"| Array
  |  
+
  | VarInt
 +
  | Length of the following array in bytes (always 2048)
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | Sky Light array
  |colspan="2"| Optional [[Chat]]
+
  | Array of 2048 bytes
  | Only send if Has Display Name is true
+
  | 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. Indexed <code><nowiki>((y<<8) | (z<<4) | x) / 2 </nowiki></code> If there's a remainder, masked 0xF0 else 0x0F.
 
  |-
 
  |-
  | 4: remove player
+
  |colspan="2"| Block Light array count
  |colspan="2"| ''no fields''
+
  |colspan="2"| VarInt
  |colspan="2"| ''no fields''
+
| 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. Indexed <code><nowiki>((y<<8) | (z<<4) | x) / 2 </nowiki></code> If there's a remainder, masked 0xF0 else 0x0F.
 
  |}
 
  |}
  
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.
+
Note that the Notchian client requires an [[#Set Center Chunk|Set Center Chunk]] packet when it crosses a chunk border, otherwise it'll only display render distance + 2 chunks around the chunk it spawned in.
  
==== Player Position And Look (clientbound) ====
+
The compacted array format has been adjusted so that individual entries no longer span across multiple longs, affecting the main data array and heightmaps.
  
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
+
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>
  
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?)”.
+
<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>
  
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”.
+
==== World Event ====
 +
Sent when a client is to play a sound or particle effect.
  
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.
+
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.
 
 
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,761: Line 2,486:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x2E
+
  |rowspan="4"| 0x20
  |rowspan="7"| Play
+
  |rowspan="4"| Play
  |rowspan="7"| Client
+
  |rowspan="4"| Client
  | X
+
  | Event
  | Double
+
  | Int
  | Absolute or relative position, depending on Flags
+
  | The event, see below.
 
  |-
 
  |-
  | Y
+
  | Location
  | Double
+
  | Position
  | Absolute or relative position, depending on Flags
+
  | The location of the event.
 
  |-
 
  |-
  | Z
+
  | Data
  | Double
+
  | Int
  | Absolute or relative position, depending on Flags
+
  | Extra data for certain events, see below.
 
  |-
 
  |-
  | Yaw
+
  | Disable Relative Volume
  | Float
+
  | Boolean
  | Absolute or relative rotation on the X axis, in degrees
+
  | See above.
|-
 
| Pitch
 
| Float
 
| Absolute or relative rotation on the Y axis, in degrees
 
|-
 
| Flags
 
| Byte
 
| Bit field, see below
 
|-
 
| Teleport ID
 
| VarInt
 
| Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
 
 
  |}
 
  |}
  
About the Flags field:
+
Events:
 
 
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! ID
 +
! Name
 +
! Data
 
  |-
 
  |-
  ! Field
+
  !colspan="3"| Sound
! Bit
 
 
  |-
 
  |-
  | X
+
  | 1000
  | 0x01
+
| Dispenser dispenses
 +
  |
 
  |-
 
  |-
  | Y
+
  | 1001
  | 0x02
+
| Dispenser fails to dispense
 +
  |
 
  |-
 
  |-
  | Z
+
  | 1002
  | 0x04
+
| Dispenser shoots
 +
  |
 
  |-
 
  |-
  | Y_ROT
+
  | 1003
  | 0x08
+
| Ender eye launched
 +
  |
 
  |-
 
  |-
  | X_ROT
+
  | 1004
  | 0x10
+
  | Firework shot
  |}
+
  |
 
 
==== 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.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x2F
+
  | 1005
|rowspan="2"| Play
+
  | Iron door opened
|rowspan="2"| Client
+
  |
| Entity ID
 
  | VarInt
 
  | Sleeping player's EID
 
 
  |-
 
  |-
  | Location
+
  | 1006
  | Position
+
  | Wooden door opened
  | Block location of the head part of the bed
+
  |
|}
 
 
 
==== Destroy Entities ====
 
 
 
Sent by the server when a list of entities is to be destroyed on the client.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x30
+
  | 1007
|rowspan="2"| Play
+
  | Wooden trapdoor opened
|rowspan="2"| Client
+
  |
| Count
 
  | VarInt
 
  | Number of elements in the following array
 
 
  |-
 
  |-
  | Entity IDs
+
  | 1008
  | Array of VarInt
+
  | Fence gate opened
  | The list of entities of destroy
+
  |
|}
 
 
 
==== Remove Entity Effect ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x31
+
  | 1009
  |rowspan="2"| Play
+
| Fire extinguished
  |rowspan="2"| Client
+
|
  | Entity ID
+
|-
  | VarInt
+
  | 1010
  |  
+
| Play record
 +
  | Special case, see below for more info.
 +
|-
 +
  | 1011
 +
  | Iron door closed
 +
  |
 
  |-
 
  |-
  | Effect ID
+
  | 1012
  | Byte
+
  | Wooden door closed
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  |
|}
 
 
 
==== Resource Pack Send ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x32
+
  | 1013
|rowspan="2"| Play
+
  | Wooden trapdoor closed
|rowspan="2"| Client
+
  |
| URL
 
  | String
 
  | The URL to the resource pack.
 
 
  |-
 
  |-
  | Hash
+
  | 1014
  | String
+
  | Fence gate closed
  | A 40 character hexadecimal and lowercase [[wikipedia:SHA-1|SHA-1]] hash of the resource pack file. (must be lower case in order to work)<br />If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth — but it will still treat it as a unique id
+
  |
|}
 
 
 
==== Respawn ====
 
 
 
To change the player's dimension (overworld/nether/end), send them a respawn packet with the appropriate dimension, followed by prechunks/chunks for the new dimension, and finally a position and look packet. You do not need to unload chunks, the client will do it automatically.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x33
+
  | 1015
|rowspan="4"| Play
+
  | Ghast warns
|rowspan="4"| Client
+
  |
| Dimension
 
  | Int Enum
 
  | -1: The Nether, 0: The Overworld, 1: The End
 
 
  |-
 
  |-
  | Difficulty
+
  | 1016
  | Unsigned Byte
+
  | Ghast shoots
  | 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
+
  |
 
  |-
 
  |-
  | Gamemode
+
  | 1017
  | Unsigned Byte
+
  | Enderdragon shoots
  | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
+
  |
 
  |-
 
  |-
  | Level Type
+
  | 1018
  | String
+
  | Blaze shoots
  | Same as [[#Join Game|Join Game]]
+
  |
|}
 
 
 
{{Warning2|Avoid changing player's dimension to same dimension they were already in unless they are dead. If you change the dimension to one they are already in, weird bugs can occur, such as the player being unable to attack other players in new world (until they die and respawn).
 
 
 
If you must respawn a player in the same dimension without killing them, send two respawn packets, one to a different world and then another to the world you want. You do not need to complete the first respawn; it only matters that you send two packets.}}
 
 
 
==== Entity Head Look ====
 
 
 
Changes the direction an entity's head is facing.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x34
+
  | 1019
|rowspan="2"| Play
+
  | Zombie attacks wood door
|rowspan="2"| Client
+
  |
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Head Yaw
+
  | 1020
  | Angle
+
  | Zombie attacks iron door
  | New angle, not a delta
+
  |
|}
 
 
 
==== World Border ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="18"| 0x35
+
  | 1021
|rowspan="18"| Play
+
  | Zombie breaks wood door
|rowspan="18"| Client
+
  |
|colspan="2"| Action
 
  | VarInt Enum
 
  | Determines the format of the rest of the packet
 
 
  |-
 
  |-
  ! Action
+
  | 1022
  ! Field Name
+
  | Wither breaks block
  !
+
  |
!
 
 
  |-
 
  |-
  | 0: set size
+
  | 1023
  | Diameter
+
  | Wither spawned
  | Double
+
  |
| Length of a single side of the world border, in meters
 
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
  | 1024
| Old Diameter
+
  | Wither shoots
  | Double
+
  |
  | Current length of a single side of the world border, in meters
 
 
  |-
 
  |-
  | New Diameter
+
  | 1025
  | Double
+
  | Bat takes off
  | Target length of a single side of the world border, in meters
+
  |
 
  |-
 
  |-
  | Speed
+
  | 1026
  | VarLong
+
  | Zombie infects
  | Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
+
  |
 
  |-
 
  |-
  |rowspan="2"| 2: set center
+
  | 1027
| X
+
  | Zombie villager converted
  | Double
+
  |
  |  
 
 
  |-
 
  |-
  | Z
+
  | 1028
  | Double
+
  | Ender dragon death
  |  
+
  |
 
  |-
 
  |-
  |rowspan="8"| 3: initialize
+
  | 1029
| X
+
  | Anvil destroyed
  | Double
+
  |
  |  
 
 
  |-
 
  |-
  | Z
+
  | 1030
  | Double
+
  | Anvil used
  |  
+
  |
 
  |-
 
  |-
  | Old Diameter
+
  | 1031
  | Double
+
  | Anvil landed
  | Current length of a single side of the world border, in meters
+
  |
 
  |-
 
  |-
  | New Diameter
+
  | 1032
  | Double
+
  | Portal travel
  | Target length of a single side of the world border, in meters
+
  |
 
  |-
 
  |-
  | Speed
+
  | 1033
  | VarLong
+
  | Chorus flower grown
  | 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
+
  | 1034
  | VarInt
+
  | Chorus flower died
  | Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
+
  |
 +
|-
 +
| 1035
 +
| Brewing stand brewed
 +
|
 +
|-
 +
| 1036
 +
| Iron trapdoor opened
 +
|
 +
|-
 +
| 1037
 +
| Iron trapdoor closed
 +
|
 +
|-
 +
| 1038
 +
| End portal created in overworld
 +
|
 +
|-
 +
| 1039
 +
| Phantom bites
 +
|
 +
|-
 +
| 1040
 +
| Zombie converts to drowned
 +
|
 +
|-
 +
| 1041
 +
| Husk converts to zombie by drowning
 +
|
 
  |-
 
  |-
  | Warning Time
+
  | 1042
  | VarInt
+
  | Grindstone used
  | In seconds as set by <code>/worldborder warning time</code>
+
  |
 
  |-
 
  |-
  | Warning Blocks
+
  | 1043
  | VarInt
+
  | Book page turned
  | In meters
+
  |
 
  |-
 
  |-
|rowspan="1"| 4: set warning time
 
| Warning Time
 
| VarInt
 
| In seconds as set by <code>/worldborder warning time</code>
 
 
  |-
 
  |-
  |rowspan="1"| 5: set warning blocks
+
  !colspan="3"| Particle
  | Warning Blocks
+
  |-
  | VarInt
+
  | 1500
  | In meters
+
  | Composter composts
  |}
+
  |
 
 
The Notchian client determines how solid to display the warning by comparing to whichever is higher, the warning distance or whichever is lower, the distance from the current diameter to the target diameter or the place the border will be after warningTime seconds. In pseudocode:
 
 
 
<syntaxhighlight lang="java">
 
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 
if (playerDistance < distance) {
 
    warning = 1.0 - playerDistance / distance;
 
} else {
 
    warning = 0.0;
 
}
 
</syntaxhighlight>
 
 
 
==== Camera ====
 
 
 
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
 
 
 
The player's camera will move with the entity and look where it is looking. The entity is often another player, but can be any type of entity.  The player is unable to move this entity (move packets will act as if they are coming from the other entity).
 
 
 
If the given entity is not loaded by the player, this packet is ignored.  To return control to the player, send this packet with their entity ID.
 
 
 
The Notchian server resets this (sends it back to the default entity) whenever the spectated entity is killed or the player sneaks, but only if they were spectating an entity. It also sends this packet whenever the player switches out of spectator mode (even if they weren't spectating an entity).
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x36
+
  | 1501
  |rowspan="1"| Play
+
  | Lava converts block (either water to stone, or removes existing blocks such as torches)
|rowspan="1"| Client
+
  |
| Camera ID
 
| VarInt
 
| ID of the entity to set the client's camera to
 
  |}
 
 
 
The notchian also loads certain shaders for given entities:
 
 
 
* Creeper &rarr; <code>shaders/post/creeper.json</code>
 
* Spider (and cave spider) &rarr; <code>shaders/post/spider.json</code>
 
* Enderman &rarr; <code>shaders/post/invert.json</code>
 
* Anything else &rarr; the current shader is unloaded
 
 
 
==== Held Item Change (clientbound) ====
 
 
 
Sent to change the player's slot selection.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x37
+
  | 1502
  |rowspan="1"| Play
+
  | Redstone torch burns out
  |rowspan="1"| Client
+
  |
| Slot
 
| Byte
 
| The slot which the player has selected (0–8)
 
|}
 
 
 
==== 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"| 0x38
+
  | 1503
|rowspan="2"| Play
+
  | Ender eye placed
|rowspan="2"| Client
+
  |
| Position
 
  | Byte
 
  | The position of the scoreboard. 0: list, 1: sidebar, 2: below name.
 
 
  |-
 
  |-
  | Score Name
+
  | 2000
  | String
+
  | Spawns 10 smoke particles, e.g. from a fire
| The unique name for the scoreboard to be displayed.
+
  | Direction, see below.
  |}
 
 
 
==== Entity Metadata ====
 
 
 
Updates one or more [[Entities#Entity Metadata Format|metadata]] properties for an existing entity. Any properties not included in the Metadata field are left unchanged.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x39
+
  | 2001
|rowspan="2"| Play
+
  | Block break + block break sound
|rowspan="2"| Client
+
  | Block state, as an index into the global palette.
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Metadata
+
  | 2002
  | [[Entities#Entity Metadata Format|Entity Metadata]]
+
  | Splash potion. Particle effect + glass break sound.
  |  
+
| RGB color as an integer (e.g. 8364543 for #7FA1FF).
 +
|-
 +
| 2003
 +
| Eye of Ender entity break animation — particles and sound
 +
|
 +
|-
 +
| 2004
 +
| Mob spawn particle effect: smoke + flames
 +
|
 +
|-
 +
| 2005
 +
| Bonemeal particles
 +
| How many particles to spawn (if set to 0, 15 are spawned).
 +
|-
 +
| 2006
 +
| Dragon breath
 +
|
 +
|-
 +
| 2007
 +
| Instant splash potion. Particle effect + glass break sound.
 +
| RGB color as an integer (e.g. 8364543 for #7FA1FF).
 +
|-
 +
| 2008
 +
| Ender dragon destroys block
 +
|
 +
|-
 +
| 2009
 +
| Wet sponge vaporizes in nether
 +
|
 +
|-
 +
| 3000
 +
| End gateway spawn
 +
|
 +
|-
 +
| 3001
 +
| Enderdragon growl
 +
|
 +
|-
 +
| 3002
 +
| Electric spark
 +
|
 +
|-
 +
| 3003
 +
| Copper apply wax
 +
|
 +
|-
 +
| 3004
 +
| Copper remove wax
 +
|
 +
|-
 +
| 3005
 +
| Copper scrape oxidation
 +
  |
 
  |}
 
  |}
  
==== Attach Entity ====
+
Smoke directions:
 
 
This packet is sent when an entity has been {{Minecraft Wiki|Lead|leashed}} to another entity.
 
  
 
{| 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"| 0x3A
+
  | 4
|rowspan="2"| Play
+
  | West
|rowspan="2"| Client
 
| Attached Entity ID
 
| Int
 
  | Attached entity's EID
 
 
  |-
 
  |-
  | Holding Entity ID
+
  | 5
  | Int
+
  | East
| ID of the entity holding the lead. Set to -1 to detach.
 
 
  |}
 
  |}
  
==== Entity Velocity ====
+
Play record: This is actually a special case within this packet. You can start/stop a record at a specific location. Use a valid {{Minecraft Wiki|Music Discs|Record ID}} to start a record (or overwrite a currently playing one), any other value will stop the record.  See [[Data Generators]] for information on item IDs.
 +
 
 +
==== Particle ====
  
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).
+
Displays the named particle
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,215: Line 2,814:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x3B
+
  |rowspan="12"| 0x21
  |rowspan="4"| Play
+
  |rowspan="12"| Play
  |rowspan="4"| Client
+
  |rowspan="12"| Client
  | Entity ID
+
  | Particle ID
 
  | VarInt
 
  | VarInt
  |  
+
  | The particle ID listed in [[#Particle|the particle data type]].
 
  |-
 
  |-
  | Velocity X
+
  | Long Distance
  | Short
+
| Boolean
  | Velocity on the X axis
+
| If true, particle distance increases from 256 to 65536.
 +
|-
 +
| X
 +
  | Double
 +
  | X position of the particle.
 
  |-
 
  |-
  | Velocity Y
+
  | Y
  | Short
+
  | Double
  | Velocity on the Y axis
+
  | Y position of the particle.
 
  |-
 
  |-
  | Velocity Z
+
  | Z
  | Short
+
  | Double
  | Velocity on the Z axis
+
  | Z position of the particle.
  |}
+
  |-
 
+
| Offset X
==== Entity Equipment ====
+
| Float
 
+
| This is added to the X position after being multiplied by <code>random.nextGaussian()</code>.
{| class="wikitable"
+
|-
  ! Packet ID
+
  | Offset Y
  ! State
+
  | Float
  ! Bound To
+
  | This is added to the Y position after being multiplied by <code>random.nextGaussian()</code>.
  ! Field Name
+
  |-
  ! Field Type
+
  | Offset Z
  ! Notes
+
  | Float
 +
| This is added to the Z position after being multiplied by <code>random.nextGaussian()</code>.
 
  |-
 
  |-
  |rowspan="3"| 0x3C
+
  | Max Speed
|rowspan="3"| Play
+
  | Float
|rowspan="3"| Client
+
  |
| Entity ID
 
  | VarInt
 
  | Entity's EID
 
 
  |-
 
  |-
  | Slot
+
  | Particle Count
  | VarInt Enum
+
  | Int
  | Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
+
  | The number of particles to create.
 
  |-
 
  |-
  | Item
+
  | Data
  | [[Slot Data|Slot]]
+
| Varies
|
+
  | The variable data listed in [[#Particle|the particle data type]].
 
  |}
 
  |}
  
==== Set Experience ====
+
==== Update Light ====
  
Sent by the server when the client should change experience levels.
+
Updates light levels for a chunk.  See {{Minecraft Wiki|Light}} for information on how lighting works in Minecraft.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,269: Line 2,870:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x3D
+
  |rowspan="13"| 0x22
  |rowspan="3"| Play
+
  |rowspan="13"| Play
  |rowspan="3"| Client
+
  |rowspan="13"| Client
  | Experience bar
+
  |colspan="2"| Chunk X
  | Float
+
|colspan="2"| VarInt
  | Between 0 and 1
+
| 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
 
  |-
 
  |-
  | Level
+
  |rowspan="2"| Sky Light arrays
 +
| Length
 +
|rowspan="2"| Array
 
  | VarInt
 
  | 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.
 
  |-
 
  |-
  | Total Experience
+
  |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
 
  | VarInt
  | See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
+
  | 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.
 
  |}
 
  |}
  
==== Update Health ====
+
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.
  
Sent by the server to update/set the health of the player it is sent to.
+
==== Login (play) ====
  
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.
+
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,303: Line 2,948:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x3E
+
  |rowspan="20"| 0x23
  |rowspan="3"| Play
+
  |rowspan="20"| Play
  |rowspan="3"| Client
+
  |rowspan="20"| Client
  | Health
+
  | Entity ID
  | Float
+
| Int
  | 0 or less = dead, 20 = full HP
+
  | The player's Entity ID (EID).
 +
|-
 +
| Is hardcore
 +
| Boolean
 +
|
 +
|-
 +
| Gamemode
 +
| Unsigned Byte
 +
| 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)
 
  |-
 
  |-
  | Food
+
  | Dimension Count
 
  | VarInt
 
  | VarInt
  | 0–20
+
  | Size of the following array.
  |-  
+
  |-
  | Food Saturation
+
  | Dimension Names
  | Float
+
| Array of Identifier
  | Seems to vary from 0.0 to 5.0 in integer increments
+
| Identifiers for all dimensions on the server.
  |}
+
  |-
 +
  | Registry Codec
 +
| [[NBT|NBT Tag Compound]]
 +
| Represents certain registries that are sent from the server and are applied on the client.
 +
|-
 +
| Dimension Type
 +
| Identifier
 +
| Name of the dimension type being spawned into.
 +
|-
 +
| Dimension Name
 +
| Identifier
 +
| Name of the dimension being spawned into.
 +
|-
 +
| Hashed seed
 +
| Long
 +
| First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
 +
|-
 +
| 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.
 +
|-
 +
| Has death location
 +
| Boolean
 +
| If true, then the next two fields are present.
 +
|-
 +
| Death dimension name
 +
| Identifier
 +
| Name of the dimension the player died in.
 +
|-
 +
| Death location
 +
| Position
 +
| The location that the player died at.
 +
  |}
  
==== Scoreboard Objective ====
 
  
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
+
The '''Registry Codec''' NBT Tag Compound ([https://gist.github.com/rj00a/f2970a8ce4d09477ec8f16003b9dce86 Default value in JSON as of 1.19]) includes three registries: "minecraft:dimension_type", "minecraft:worldgen/biome", and "minecraft:chat_type".
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  !Name
  ! State
+
  !Type
  ! Bound To
+
  !style="width: 250px;" colspan="2"| Notes
  ! Field Name
+
|-
  ! Field Type
+
  | minecraft:dimension_type
  ! Notes
+
  | TAG_Compound
 +
  | The dimension type registry (see below).
 
  |-
 
  |-
  |rowspan="4"| 0x3F
+
  | minecraft:worldgen/biome
|rowspan="4"| Play
+
  | TAG_Compound
|rowspan="4"| Client
+
  | The biome registry (see below).
| Objective Name
 
  | String
 
  | An unique name for the objective
 
 
  |-
 
  |-
  | Mode
+
  | minecraft:chat_type
  | Byte
+
  | TAG_Compound
  | 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
+
  | The chat type registry (see below).
 +
|}
 +
 
 +
Dimension type registry:
 +
 
 +
{| class="wikitable"
 +
!Name
 +
!Type
 +
!style="width: 250px;" colspan="2"| Notes
 
  |-
 
  |-
  | Objective Value
+
  | type
  | Optional String
+
  | TAG_String
  | Only if mode is 0 or 2. The text to be displayed for the score
+
  | The name of the registry. Always "minecraft:dimension_type".
 
  |-
 
  |-
  | Type
+
  | value
  | Optional String
+
  | TAG_List
  | Only if mode is 0 or 2. “integer” or “hearts”
+
  | List of dimension types registry entries (see below).
 
  |}
 
  |}
  
==== Set Passengers ====
+
Dimension type registry entry:
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  !Name
! State
+
  !Type
! Bound To
+
  !style="width: 250px;" colspan="2"| Notes
! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x40
+
  | name
  |rowspan="3"| Play
+
  | TAG_String
  |rowspan="3"| Client
+
  | The name of the dimension type (for example, "minecraft:overworld").
| Entity ID
 
| VarInt
 
| Vehicle's EID
 
 
  |-
 
  |-
  | Passenger Count
+
  | id
  | VarInt
+
  | TAG_Int
  | Number of elements in the following array
+
  | The protocol ID of the dimension (matches the index of the element in the registry list).
 
  |-
 
  |-
  | Passengers
+
  | element
  | Array of VarInt
+
  | TAG_Compound
  | EIDs of entity's passengers
+
  | The dimension type (see below).
 
  |}
 
  |}
  
==== Teams ====
+
Dimension type:
 
 
Creates and updates teams.
 
  
 
{| 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
 
 
  |-
 
  |-
  |rowspan="23"| 0x41
+
  | piglin_safe
|rowspan="23"| Play
+
  | TAG_Byte
  |rowspan="23"| Client
+
  |colspan="2"| Whether piglins shake and transform to zombified piglins.
  |colspan="2"| Team Name
+
  | 1: true, 0: false.
  | String
 
| A unique name for the team. (Shared with scoreboard).
 
 
  |-
 
  |-
  |colspan="2"| Mode
+
| has_raids
| Byte
+
| TAG_Byte
  | Determines the layout of the remaining packet
+
  |colspan="2"| Whether players with the Bad Omen effect can cause a raid.
 +
  | 1: true, 0: false.
 
  |-
 
  |-
  |rowspan="9"| 0: create team
+
  | monster_spawn_light_level
  | Team Display Name
+
  | TAG_Int
  | String
+
  |colspan="2"|
  |  
+
  |
 
  |-
 
  |-
  | Team Prefix
+
  | monster_spawn_block_light_limit
  | String
+
  | TAG_Int
  | Displayed before the names of players that are part of this team
+
|colspan="2"|
 +
  |
 
  |-
 
  |-
  | Team Suffix
+
  | natural
  | String
+
  | TAG_Byte
  | Displayed after the names of players that are part of this team
+
  |colspan="2"| When false, compasses spin randomly. When true, nether portals can spawn zombified piglins.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | Friendly Flags
+
  | ambient_light
  | Byte
+
  | TAG_Float
  | Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible players on same team
+
  |colspan="2"| How much light the dimension has.
 +
| 0.0 to 1.0.
 
  |-
 
  |-
  | Name Tag Visibility
+
  | fixed_time
  | String Enum
+
  | Optional TAG_Long
  | <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
+
  |colspan="2"| If set, the time of the day is the specified value.
 +
| If set, 0 to 24000.
 
  |-
 
  |-
  | Collision Rule
+
  | infiniburn
  | String Enum
+
  | TAG_String
  | <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
+
  |colspan="2"| A resource location defining what block tag to use for infiniburn.
 +
| "#" or minecraft resource "#minecraft:...".
 
  |-
 
  |-
  | Color
+
  | respawn_anchor_works
  | Byte
+
  | TAG_Byte
  | Same as [[Chat]] colors
+
  |colspan="2"| Whether players can charge and use respawn anchors.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | Player Count
+
  | has_skylight
  | VarInt
+
  | TAG_Byte
  | Number of elements in the following array
+
  |colspan="2"| Whether the dimension has skylight access or not.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | Players
+
  | bed_works
  | Array of String
+
  | TAG_Byte
  | Usernames of the players in this team. Maximum 40 characters per entry.
+
  |colspan="2"| Whether players can use a bed to sleep.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | 1: remove team
+
  | effects
  | ''no fields''
+
  | TAG_String
  | ''no fields''
+
  |colspan="2"| ?
  |  
+
  | "minecraft:overworld", "minecraft:the_nether", "minecraft:the_end" or something else.
 
  |-
 
  |-
  |rowspan="7"| 2: update team info
+
  | min_y
  | Team Display Name
+
  | TAG_Int
  | String
+
  |colspan="2"| The minimum Y level.
  |  
+
  | A multiple of 16. Example: -64
 
  |-
 
  |-
  | Team Prefix
+
  | height
  | String
+
  | TAG_Int
  | Displayed before the names of players that are part of this team
+
  |colspan="2"| The maximum height.
 +
| A multiple of 16. Example: 256
 
  |-
 
  |-
  | Team Suffix
+
  | logical_height
  | String
+
  | TAG_Int
  | Displayed after the names of players that are part of this team
+
  |colspan="2"| The maximum height to which chorus fruits and nether portals can bring players within this dimension.
 +
| 0-384.
 
  |-
 
  |-
  | Friendly Flags
+
  | coordinate_scale
  | Byte
+
  | TAG_Double
  | Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible players on same team
+
  |colspan="2"| The multiplier applied to coordinates when traveling to the dimension.
 +
| 0.00001 - 30000000.0
 
  |-
 
  |-
  | Name Tag Visibility
+
  | ultrawarm
  | String Enum
+
  | TAG_Byte
  | <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</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.
 
  |-
 
  |-
  | Collision Rule
+
  | has_ceiling
  | String Enum
+
  | TAG_Byte
  | <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
+
  |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
 
  |-
 
  |-
  | Color
+
  | type
  | Byte
+
  | TAG_String
  | Same as [[Chat]] colors
+
  | The name of the registry. Always "minecraft:worldgen/biome".
 
  |-
 
  |-
  |rowspan="2"| 3: add players to team
+
  | value
  | Player Count
+
| TAG_List
  | VarInt
+
| List of biome registry entries (see below).
  | Number of elements in the following array
+
|}
 +
 
 +
Biome registry entry:
 +
 
 +
{| class="wikitable"
 +
  !Name
 +
  !Type
 +
  !style="width: 250px;" colspan="2"| Notes
 
  |-
 
  |-
  | Players
+
  | name
  | Array of String
+
  | TAG_String
  | Usernames of the added players. Maximum 40 characters per entry.
+
  | The name of the biome (for example, "minecraft:ocean").
 
  |-
 
  |-
  |rowspan="2"| 4: remove players from team
+
  | id
  | Player Count
+
  | TAG_Int
  | VarInt
+
  | The protocol ID of the biome (matches the index of the element in the registry list).
| Number of elements in the following array
 
 
  |-
 
  |-
  | Players
+
  | element
  | Array of String
+
  | TAG_Compound
  | Usernames of the removed players. Maximum 40 characters per entry.
+
  | The biome properties (see below).
 
  |}
 
  |}
  
==== Update Score ====
+
Biome properties:
 
 
This is sent to the client when it should update a scoreboard item.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  !colspan="3"|Name
  ! State
+
  !colspan="2"|Type
  ! Bound To
+
  !style="width: 250px;" colspan="2"| Meaning
  ! Field Name
+
  !colspan="2"|Values
  ! Field Type
+
|-
  ! Notes
+
|colspan="3"|precipitation
 +
|colspan="2"|TAG_String
 +
  |colspan="2"| The type of precipitation in the biome.
 +
  |colspan="2"|"rain", "snow", or "none".
 
  |-
 
  |-
  |rowspan="4"| 0x42
+
|colspan="3"| depth
  |rowspan="4"| Play
+
|colspan="2"| TAG_Float
  |rowspan="4"| Client
+
|colspan="2"| The depth factor of the biome.
  | Score Name
+
|colspan="2"| The default values vary between 1.5 and -1.8.
  | String
+
|-
  | The name of the score to be updated or removed
+
|colspan="3"| 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="3"| scale
 +
|colspan="2"| TAG_Float
 +
|colspan="2"| ?
 +
|colspan="2"| The default values vary between 1.225 and 0.0.
 +
|-
 +
|colspan="3"| downfall
 +
|colspan="2"| TAG_Float
 +
|colspan="2"| ?
 +
|colspan="2"| The default values vary between 1.0 and 0.0.
 +
|-
 +
|colspan="3"| 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="3"| temperature_modifier
 +
|colspan="2"| Optional TAG_String
 +
|colspan="2"| ?
 +
|colspan="2"| The only known value is "frozen".
 +
|-
 +
  |rowspan="13"| effects
 +
|colspan="2"| sky_color
 +
  |rowspan="11"| TAG_Compound
 +
| TAG_Int
 +
|colspan="2"| The color of the sky.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
|colspan="2"| water_fog_color
 +
| TAG_Int
 +
|colspan="2"| Possibly the tint color when swimming.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
|colspan="2"| 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.
 +
|-
 +
|colspan="2"| water_color
 +
| TAG_Int
 +
|colspan="2"| The tint color of the water blocks.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
|colspan="2"| foliage_color
 +
| Optional TAG_Int
 +
|colspan="2"| The tint color of the grass.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
|colspan="2"| grass_color
 +
| Optional TAG_Int
 +
| colspan="2"| ?
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
|colspan="2"| grass_color_modifier
 +
| Optional TAG_String
 +
|colspan="2"| Unknown, likely affects foliage color.
 +
| If set, known values are "swamp" and "dark_forest".
 +
|-
 +
|colspan="2"| 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).
 +
|-
 +
|colspan="2"| ambient_sound
 +
| Optional TAG_String
 +
|colspan="2"| Ambient soundtrack.
 +
| If present, the ID of a soundtrack. Example: "minecraft:ambient.basalt_deltas.loop".
 +
|-
 +
|colspan="2"| 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).
 +
|-
 +
|colspan="2"| 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.
 +
| ?
 
  |-
 
  |-
  | Action
+
  | options
  | Byte
+
  | TAG_COMPOUND
  | 0 to create/update an item. 1 to remove an item.
+
  | The properties of the particle to spawn.
 +
| Contains the field "type" (TAG_String), which identifies the particle type.
 +
|}
 +
 
 +
Chat registry:
 +
 
 +
{| class="wikitable"
 +
!Name
 +
!Type
 +
!style="width: 250px;" colspan="2"| Notes
 
  |-
 
  |-
  | Objective Name
+
  | type
  | String
+
  | TAG_String
  | The name of the objective the score belongs to
+
  | The name of the registry. Always "minecraft:chat_type".
 
  |-
 
  |-
  | Value
+
  | value
  | Optional VarInt
+
  | TAG_List
  | The score to be displayed next to the entry. Only sent when Action does not equal 1.
+
  | List of chat registry entries (see below).
 
  |}
 
  |}
  
==== Spawn Position ====
+
==== Map Data ====
  
Sent by the server after login to specify the coordinates of the spawn point (the point at which players spawn at, and which the compass points to). It can be sent at any time to update the point compasses point at.
+
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,530: Line 3,362:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x43
+
  |rowspan="17"| 0x24
  |rowspan="1"| Play
+
  |rowspan="17"| Play
  |rowspan="1"| Client
+
  |rowspan="17"| Client
  | Location
+
  |colspan="2"| Map ID
  | Position
+
  |colspan="2"| VarInt
| Spawn location
+
  | Map ID of the map being modified
  |}
+
|-
 
+
|colspan="2"| Scale
==== Time Update ====
+
  |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)
Time is based on ticks, where 20 ticks happen every second. There are 24000 ticks in a day, making Minecraft days exactly 20 minutes long.
 
 
 
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
 
 
 
The default SMP server increments the time by <code>20</code> every second.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x44
+
  |colspan="2"| Locked
  |rowspan="2"| Play
+
  |colspan="2"| Boolean
  |rowspan="2"| Client
+
  | True if the map has been locked in a cartography table
| World Age
 
| Long
 
| In ticks; not changed by server commands
 
 
  |-
 
  |-
  | Time of day
+
  |colspan="2"| Tracking Position
| Long
+
  |colspan="2"| Boolean
| The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
+
  | Specifies whether player and item frame icons are shown
|}
 
 
 
==== Title ====
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
  ! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="10"| 0x45
+
  |colspan="2"| Icon Count
|rowspan="10"| Play
+
  |colspan="2"| VarInt
|rowspan="10"| Client
+
  | Number of elements in the following array. Only present if "Tracking Position" is true.
  |colspan="2"| Action
 
| VarInt Enum
 
  |  
 
 
  |-
 
  |-
  ! Action
+
  |rowspan="6"| Icon
  ! Field Name
+
  | Type
  !
+
  |rowspan="6"| Array
  !
+
  | VarInt enum
 +
| See below
 
  |-
 
  |-
  | 0: set title
+
| X
  | Title Text
+
| Byte
  | [[Chat]]
+
| Map coordinates: -128 for furthest left, +127 for furthest right
  |  
+
|-
 +
| Z
 +
| Byte
 +
| Map coordinates: -128 for highest, +127 for lowest
 +
|-
 +
| Direction
 +
| Byte
 +
  | 0-15
 +
|-
 +
| Has Display Name
 +
| Boolean
 +
|
 +
|-
 +
  | Display Name
 +
  | Optional [[Chat]]
 +
  | Only present if previous Boolean is true
 
  |-
 
  |-
  | 1: set subtitle
+
  |colspan="2"| Columns
| Subtitle Text
+
  |colspan="2"| Unsigned Byte
| [[Chat]]
+
  | Number of columns updated
|
 
|-
 
  | 2: set action bar
 
| Action bar text
 
  | [[Chat]]
 
| Behaves the same as with position 2 in [[#Chat Message (clientbound)|Chat Message (clientbound)]]
 
 
  |-
 
  |-
  |rowspan="3"| 3: set times and display
+
  |colspan="2"| Rows
  | Fade In
+
  |colspan="2"| Optional Unsigned Byte
| Int
+
  | Only if Columns is more than 0; number of rows updated
  | Ticks to spend fading in
 
 
  |-
 
  |-
  | Stay
+
  |colspan="2"| X
  | Int
+
  |colspan="2"| Optional Byte
  | Ticks to keep the title displayed
+
  | Only if Columns is more than 0; x offset of the westernmost column
 
  |-
 
  |-
  | Fade Out
+
  |colspan="2"| Z
  | Int
+
  |colspan="2"| Optional Byte
  | Ticks to spend out, not when to start fading out
+
  | Only if Columns is more than 0; z offset of the northernmost row
 
  |-
 
  |-
  | 4: hide
+
  |colspan="2"| Length
  | ''no fields''
+
  |colspan="2"| Optional VarInt
| ''no fields''
+
  | Only if Columns is more than 0; length of the following array
  |  
 
 
  |-
 
  |-
  | 5: reset
+
  |colspan="2"| Data
  | ''no fields''
+
  |colspan="2"| Optional Array of Unsigned Byte
  | ''no fields''
+
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
|  
 
 
  |}
 
  |}
  
“Hide” makes the title disappear, but if you run times again the same title will appear. “Reset” erases the text.
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
  
The title is visible on screen for Fade In + Stay + Fade Out ticks.
+
Types are based off of rows and columns in <code>map_icons.png</code>:
 
 
==== Sound Effect ====
 
 
 
This packet is used to play a number of hardcoded sound events. For custom sounds, use [[#Named Sound Effect|Named Sound Effect]] ([[#Play|Play]], 0x19, clientbound).
 
 
 
{{Warning|Numeric sound effect IDs are liable to change between versions}}
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x46
+
  ! Icon type
|rowspan="7"| Play
+
  ! Result
  |rowspan="7"| Client
+
  |-
  | Sound ID
+
  | 0
  | VarInt
+
  | White arrow (players)
  | ID of hardcoded sound event ([http://pokechu22.github.io/Burger/1.11.html#sounds events] as of 1.11.0)
 
 
  |-
 
  |-
  | Sound Category
+
  | 1
  | VarInt Enum
+
  | Green arrow (item frames)
| The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 
 
  |-
 
  |-
  | Effect Position X
+
  | 2
  | Int
+
  | Red arrow
| Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
 
  |-
 
  |-
  | Effect Position Y
+
  | 3
| Int
+
  | Blue arrow
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
 
  |-
 
  |-
  | Effect Position Z
+
  | 4
  | Int
+
  | White cross
| Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
 
  |-
 
  |-
  | Volume
+
  | 5
  | Float
+
  | Red pointer
| 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients
 
 
  |-
 
  |-
  | Pitch
+
  | 6
  | Float
+
  | White circle (off-map players)
  | Float between 0.5 and 2.0 by Notchian clients
+
  |-
 
+
| 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
 +
  |}
  
==== Player List Header And Footer ====
+
==== Merchant Offers ====
  
This packet may be used by custom servers to display additional information above/below the player list. It is never sent by the Notchian server.
+
The list of trades a villager NPC is offering.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,690: Line 3,539:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x47
+
  |rowspan="18"| 0x25
  |rowspan="2"| Play
+
  |rowspan="18"| Play
  |rowspan="2"| Client
+
  |rowspan="18"| Client
  | Header
+
|-
  | [[Chat]]
+
| colspan="2" | Window ID
  | To remove the header, send a empty translatable component: {"translate":""}
+
| 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 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
 +
| If positive, causes the price to increase. Negative values seem to be treated the same as zero.
 +
|-
 +
|colspan="2"| Villager level
 +
|colspan="2"| VarInt
 +
| Appears on the trade GUI; meaning comes from the translation key <code>merchant.level.</code> + level.
 +
1: Novice, 2: Apprentice, 3: Journeyman, 4: Expert, 5: Master.
 +
|-
 +
|colspan="2"| Experience
 +
|colspan="2"| VarInt
 +
| Total experience for this villager (always 0 for the wandering trader).
 +
|-
 +
|colspan="2"| Is regular villager
 +
|colspan="2"| Boolean
 +
| True if this is a regular villager; false for the wandering trader.  When false, hides the villager level and some other GUI elements.
 
  |-
 
  |-
  | Footer
+
  |colspan="2"| Can restock
  | [[Chat]]
+
  |colspan="2"| Boolean
  | To remove the footer, send a empty translatable component: {"translate":""}
+
  | 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.
 
  |}
 
  |}
  
==== Collect Item ====
+