Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
(→‎Spawn Object: Modified to reflect Object velocity.)
m (More documentation on plugin message)
 
(628 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 Minecraft Protocol]].
+
   |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 irc.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 41: Line 41:
 
  |-
 
  |-
 
  | XYZ
 
  | XYZ
  | In this document, the axis names are the same as those shown in the debug screen (F3). Y points upwards, X points East, and Z points South.
+
  | In this document, the axis names are the same as those shown in the debug screen (F3). Y points upwards, X points east, and Z points south.
 
  |-
 
  |-
 
  | Meter
 
  | Meter
 
  | The meter is Minecraft's base unit of length, equal to the length of a vertex of a solid block. The term “block” may be used to mean “meter” or “cubic meter”.
 
  | The meter is Minecraft's base unit of length, equal to the length of a vertex of a solid block. The term “block” may be used to mean “meter” or “cubic meter”.
 +
|-
 +
| Global palette
 +
| A table/dictionary/palette mapping nonnegative integers to block states. Block state IDs are created in a linear fashion based off of order of assignment.  One block state ID allocated for each unique block state for a block; if a block has multiple properties then the number of allocated states is the product of the number of values for each property.  A current list of properties and state ID ranges is found on [https://pokechu22.github.io/Burger/1.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
 +
| 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 58: 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 71: 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 91: 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 99: 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 it's larger than the threshold, then it follows the regular compressed protocol format.
  
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.
+
Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all.
 
 
Compression can be disabled by sending the packet [[#Set Compression 2|Set Compression]] ([[#Login|Login]], 0x03, clientbound) with a Threshold of -1.
 
  
 
== Handshaking ==
 
== Handshaking ==
Line 132: Line 143:
 
  | Protocol Version
 
  | Protocol Version
 
  | VarInt
 
  | VarInt
  | See [[protocol version numbers]] (currently 47)
+
  | 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<!-- does this support IPv6? -->
+
  | 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
+
  | Default is 25565. The Notchian server does not use this information.
 
  |-
 
  |-
 
  | Next State
 
  | Next State
  | VarInt
+
  | VarInt Enum
  | 1 for [[#Status|status]], 2 for [[#Login|login]]
+
  | 1 for [[#Status|Status]], 2 for [[#Login|Login]].
 
  |}
 
  |}
  
Line 151: 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 166: 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 ===
  
==== Keep Alive ====
+
==== Status Response ====
  
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x00
 +
|rowspan="2"| Status
 +
|rowspan="2"| Client
 +
|-
 +
| JSON Response
 +
| String (32767)
 +
| See [[Server List Ping#Response]]; as with all strings this is prefixed by its length as a VarInt.
 +
|}
 +
 
 +
==== Ping Response ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 187: Line 217:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x00
+
  | 0x01
  |rowspan="1"| Play
+
  | Status
  |rowspan="1"| Client
+
  | Client
  | Keep Alive ID
+
  | Payload
  | VarInt
+
  | Long
  |  
+
  | Should be the same as sent by the client.
 
  |}
 
  |}
  
==== Join Game ====
+
=== Serverbound ===
  
See [[Protocol Encryption]] for information on logging in.
+
==== Status Request ====
 +
 
 +
The status can only be requested once immediately after the handshake, before any ping. The server won't respond otherwise.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 207: Line 239:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x01
+
  | 0x00
  |rowspan="7"| Play
+
| Status
  |rowspan="7"| Client
+
  | Server
| Entity ID
+
  |colspan="3"| ''no fields''
| Int
 
| The player's Entity ID (EID)
 
|-
 
| Gamemode
 
| Unsigned Byte
 
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
 
|-
 
| Dimension
 
| Byte
 
| -1: Nether, 0: Overworld, 1: End
 
|-
 
| Difficulty
 
| Unsigned Byte
 
| 0: peaceful, 1: easy, 2: normal, 3: hard
 
|-
 
| Max Players
 
| Unsigned Byte
 
| Used by the client to draw the player list
 
|-
 
| 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}}.
 
 
  |}
 
  |}
  
{{Warning|If the Dimension isn't valid then the client will crash}}
+
==== Ping Request ====
 
 
==== Chat Message ====  
 
 
 
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"
 
{| class="wikitable"
Line 253: Line 255:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x02
+
  | 0x01
  |rowspan="2"| Play
+
  | Status
  |rowspan="2"| Client
+
  | Server
  | JSON Data
+
  | Payload
  | [[Chat]]
+
  | Long
| Limited to 32767 bytes
+
  | May be any number. Notchian clients use a system-dependent time value which is counted in milliseconds.
  |-
 
| Position
 
| Byte
 
| 0: chat (chat box), 1: system message (chat box), 2: above hotbar
 
 
  |}
 
  |}
  
{{Warning|Malformed JSON will disconnect the client}}
+
== Login ==
  
==== Time Update ====
+
The login process is as follows:
  
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.
+
# 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]]
  
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
+
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]].
  
The default SMP server increments the time by <code>20</code> every second.
+
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 ===
 +
 
 +
==== Disconnect (login) ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 283: Line 294:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x03
+
  | 0x00
  |rowspan="2"| Play
+
  | Login
  |rowspan="2"| Client
+
  | Client
  | World Age
+
  | Reason
| Long
+
  | [[Chat]]
| In ticks; not changed by server commands
+
  | The reason why the player was disconnected.
  |-
 
| Time of day
 
| Long
 
  | The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
 
 
  |}
 
  |}
  
==== Entity Equipment ====
+
==== Encryption Request ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 305: Line 312:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x04
+
  |rowspan="5"| 0x01
  |rowspan="3"| Play
+
  |rowspan="5"| Login
  |rowspan="3"| Client
+
  |rowspan="5"| Client
  | Entity ID
+
  | Server ID
 +
| String (20)
 +
| Appears to be empty.
 +
|-
 +
| Public Key Length
 
  | VarInt
 
  | VarInt
  | Entity's EID
+
  | Length of Public Key
 
  |-
 
  |-
  | Slot
+
  | Public Key
  | Short
+
  | Byte Array
  | Equipment slot. 0: held, 1–4: armor slot (1: boots, 2: leggings, 3: chestplate, 4: helmet)
+
  | The server's public key, in bytes.
 +
|-
 +
| Verify Token Length
 +
| VarInt
 +
| Length of Verify Token. Always 4 for Notchian servers.
 
  |-
 
  |-
  | Item
+
  | Verify Token
  | [[Slot Data|Slot]]
+
  | Byte Array
  | Item in slot format
+
  | A sequence of random bytes generated by the server.
 
  |}
 
  |}
  
==== Spawn Position ====
+
See [[Protocol Encryption]] for details.
  
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.
+
==== Login Success ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 329: Line 344:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x05
+
  |rowspan="7"| 0x02
  |rowspan="1"| Play
+
|rowspan="7"| Login
  |rowspan="1"| Client
+
|rowspan="7"| Client
  | Location
+
|colspan="2"| UUID
  | Position
+
|colspan="2"| UUID
  | Spawn location
+
|colspan="2"|
 +
|-
 +
|colspan="2"| Username
 +
|colspan="2"| String (16)
 +
|colspan="2"|
 +
|-
 +
|colspan="2"| Number Of Properties
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array.
 +
|-
 +
  |rowspan="4"| Property
 +
| Name
 +
  |rowspan="4"| Array
 +
| String (32767)
 +
|colspan="2"|
 +
|-
 +
| Value
 +
| String (32767)
 +
|colspan="1"|
 +
  |-
 +
| Is Signed
 +
| Boolean
 +
|colspan="2"|
 +
|-
 +
| Signature
 +
  | Optional String (32767)
 +
  | Only if Is Signed is true.
 
  |}
 
  |}
  
==== Update Health ====
+
This packet switches the connection state to [[#Play|play]].
 +
 
 +
{{Warning2|The (notchian) server might take a bit to fully transition to the Play state, so it's recommended to wait before sending Play packets, either by setting a timeout, or waiting for Play packets from the server (usually [[#Login (play)|Login (play)]]).
  
Sent by the server to update/set the health of the player it is sent to.
+
The notchian client doesn't send any (non-[[#Keep Alive|keep alive]]) packets until the next tick/[[#Set Time|Set Time]] packet.
 +
}}
  
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.
+
==== 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 355: Line 401:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x06
+
  | 0x03
  |rowspan="3"| Play
+
  | Login
  |rowspan="3"| Client
+
  | Client
  | Health
+
  | Threshold
| Float
 
| 0 or less = dead, 20 = full HP
 
|-
 
| Food
 
 
  | VarInt
 
  | VarInt
  | 0–20
+
  | Maximum size of a packet before it is compressed.
|-
 
| Food Saturation
 
| Float
 
| Seems to vary from 0.0 to 5.0 in integer increments
 
 
  |}
 
  |}
  
==== Respawn ====
+
==== Login Plugin Request ====
 +
 
 +
Used to implement a custom handshaking flow together with [[#Login Plugin Response|Login Plugin Response]].
  
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.
+
Unlike plugin messages in "play" mode, these messages follow a lock-step request/response scheme, where the client is expected to respond to a request indicating whether it understood. The notchian client always responds that it hasn't understood, and sends an empty payload.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 383: Line 423:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x07
+
  |rowspan="3"| 0x04
  |rowspan="4"| Play
+
  |rowspan="3"| Login
  |rowspan="4"| Client
+
  |rowspan="3"| Client
  | Dimension
+
  | Message ID
  | Int
+
  | VarInt
  | -1: The Nether, 0: The Overworld, 1: The End
+
  | Generated by the server - should be unique to the connection.
 
  |-
 
  |-
  | Difficulty
+
  | Channel
  | Unsigned Byte
+
  | Identifier
  | 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
+
  | Name of the [[plugin channel]] used to send the data.
 
  |-
 
  |-
  | Gamemode
+
  | Data
  | Unsigned Byte
+
  | Byte Array
  | 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
|-
 
| Level Type
 
| String
 
| Same as [[#Join Game|Join Game]]
 
 
  |}
 
  |}
  
{{Warning|If the Dimension isn't valid then the client will crash}}
+
=== Serverbound ===
  
{{Warning|Avoid changing player's dimension to same dimension they were already in, weird bugs can occur i.e. such player will be unable to attack other players in new world (fixes after their death and respawn)}}
+
==== Login Start ====
 
 
==== Player Position And Look ====
 
 
 
Updates the player's position on the server.
 
 
 
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
 
 
 
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”.
 
 
 
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
 
 
 
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 
 
 
The yaw in degrees of a player standing at point (x0, z0) and looking towards point (x, z) can be calculated with:
 
 
 
  l = x-x0
 
w = z-z0
 
c = sqrt( l*l + w*w )
 
alpha1 = -arcsin(l/c)/PI*180
 
alpha2 =  arccos(w/c)/PI*180
 
if alpha2 > 90 then
 
    yaw = 180 - alpha1
 
else
 
    yaw = alpha1
 
 
 
You can get a unit vector from a given yaw/pitch via:
 
 
 
x = -cos(pitch) * sin(yaw)
 
y = -sin(pitch)
 
z =  cos(pitch) * cos(yaw)
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 445: Line 451:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x08
+
  |rowspan="7"| 0x00
  |rowspan="6"| Play
+
  |rowspan="7"| Login
  |rowspan="6"| Client
+
  |rowspan="7"| Server
  | X
+
  | Name
  | Double
+
  | String (16)
  | Absolute or relative position, depending on Flags
+
  | Player's Username.
 
  |-
 
  |-
  | Y
+
  | Has Sig Data
  | Double
+
  | Boolean
  | Absolute or relative position, depending on Flags
+
  | Whether or not the next 5 fields should be sent.
 
  |-
 
  |-
  | Z
+
  | Timestamp
  | Double
+
  | Long
  | Absolute or relative position, depending on Flags
+
  | When the key data will expire. Optional. Only sent if Has Sig Data is true.
 
  |-
 
  |-
  | Yaw
+
  | Public Key Length
  | Float
+
  | VarInt
  | Absolute or relative rotation on the X Axis, in degrees
+
  | Length of Public Key. Optional. Only sent if Has Sig Data is true.
 
  |-
 
  |-
  | Pitch
+
  | Public Key
  | Float
+
  | Byte Array
  | Absolute or relative rotation on the Y Axis, in degrees
+
  | The encoded bytes of the public key the client received from Mojang. Optional. Only sent if Has Sig Data is true.
 
  |-
 
  |-
  | Flags
+
  | Signature Length
  | Byte
+
  | VarInt
  | Bit field, see below
+
  | Length of Signature. Optional. Only sent if Has Sig Data is true.
|}
 
 
 
About the Flags field:
 
 
 
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
! Field
+
  | Signature
! Bit
+
  | Byte Array
|-
+
  | The bytes of the public key signature the client received from Mojang. Optional. Only sent if Has Sig Data is true.
| X
 
| 0x01
 
|-
 
| Y
 
| 0x02
 
|-
 
| Z
 
| 0x04
 
|-
 
| Y_ROT
 
| 0x08
 
  |-
 
  | X_ROT
 
  | 0x10
 
 
  |}
 
  |}
  
==== Held Item Change ====
+
==== Encryption Response ====
 
 
Sent to change the player's slot selection.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 510: Line 493:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x09
+
  |rowspan="8"| 0x01
  |rowspan="1"| Play
+
  |rowspan="8"| Login
  |rowspan="1"| Client
+
  |rowspan="8"| Server
  | Slot
+
  | Shared Secret Length
  | Byte
+
| VarInt
  | The slot which the player has selected (0–8)
+
| Length of Shared Secret.
 +
|-
 +
| Shared Secret
 +
  | Byte Array
 +
| Shared Secret value, encrypted with the server's public key.
 +
|-
 +
| Has Verify Token
 +
| Boolean
 +
| Whether or not the Verify Token should be sent. If not, then the salt and signature will be sent.
 +
|-
 +
| Optional Verify Token Length
 +
| VarInt
 +
| Length of Verify Token. Optional and only sent if Has Verify Token is true.
 +
|-
 +
| Optional Verify Token
 +
| Byte Array
 +
| Verify Token value, encrypted with the same public key as the shared secret. Optional and only sent if Has Verify Token is true.
 +
|-
 +
| Optional Salt
 +
| Long
 +
| Cryptography, used for validating the message signature. Optional and only sent if Has Verify Token is false.
 +
|-
 +
| Optional Message Signature Length
 +
| VarInt
 +
| Array Length. Optional and only sent if Has Verify Token is false.
 +
|-
 +
| Optional Message Signature
 +
| Byte Array
 +
  | The bytes of the public key signature the client received from Mojang. Optional and only sent if Has Verify Token is false.
 
  |}
 
  |}
  
==== Use Bed ====
+
See [[Protocol Encryption]] for details. See [[Mojang_API#Player_Certificates]] for an API to get the message signature.
  
This packet tells that a player goes to bed.
+
==== Login Plugin Response ====
 
 
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"
 
{| class="wikitable"
Line 534: Line 541:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0A
+
  |rowspan="3"| 0x02
  |rowspan="2"| Play
+
  |rowspan="3"| Login
  |rowspan="2"| Client
+
  |rowspan="3"| Server
  | Entity ID
+
  | Message ID
 
  | VarInt
 
  | VarInt
  | Sleeping player's EID
+
  | Should match ID from server.
 
  |-
 
  |-
  | Location
+
  | Successful
  | Position
+
  | Boolean
  | Block location of the head part of the bed
+
  | <code>true</code> if the client understood the request, <code>false</code> otherwise. When <code>false</code>, no payload follows.
 +
|-
 +
| Data
 +
| Optional Byte Array
 +
| Any data, depending on the channel. The length of this array must be inferred from the packet length.
 
  |}
 
  |}
  
==== Animation ====
+
== Play ==
  
Sent whenever an entity should change animation.
+
=== Clientbound ===
 +
 
 +
==== Spawn Entity ====
 +
 
 +
Sent by the server when a vehicle or other non-living entity is created.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 558: Line 573:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0B
+
  |rowspan="13"| 0x00
  |rowspan="2"| Play
+
  |rowspan="13"| Play
  |rowspan="2"| Client
+
  |rowspan="13"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player ID
+
  | A unique integer ID mostly used in the protocol to identify the entity.
 
  |-
 
  |-
  | Animation
+
  | Entity UUID
  | Unsigned Byte
+
  | UUID
  | Animation ID (see below)
+
  | A unique identifier that is mostly used in persistence and places where the uniqueness matters more.
  |}
+
|-
 
+
  | Type
Animation can be one of the following values:
+
| VarInt
 
+
| The type of the entity (see "type" field of the list of [[entity_metadata#Mobs|Mob types]]).
{| class="wikitable"
+
|-
  ! ID
+
| X
  ! Animation
+
  | Double
 +
  |
 
  |-
 
  |-
  | 0
+
  | Y
  | Swing arm
+
| Double
 +
  |
 
  |-
 
  |-
  | 1
+
  | Z
  | Take damage
+
| Double
 +
  |
 
  |-
 
  |-
  | 2
+
  | Pitch
  | Leave bed
+
  | Angle
 +
| To get the real pitch, you must divide this by (256.0F / 360.0F)
 
  |-
 
  |-
  | 3
+
  | Yaw
  | Eat food
+
  | Angle
 +
| To get the real yaw, you must divide this by (256.0F / 360.0F)
 
  |-
 
  |-
  | 4
+
  | Head Yaw
  | Critical effect
+
  | 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.
 
  |-
 
  |-
  | 5
+
  | Velocity X
  | Magic critical effect
+
  | Short
  |}
+
  |rowspan="3"| Same units as [[#Set Entity Motion|Set Entity Motion]].
 
+
|-
==== Spawn Player ====
+
| Velocity Y
 
+
| Short
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
+
|-
 
+
| Velocity Z
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 tab list entry for the UUID included in this packet is not present when this packet arrives, the entity will not be spawned. The tab includes skin/cape data.
+
| Short
 +
|}
  
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
+
==== Spawn Experience Orb ====
  
When in online-mode the UUIDs must be valid and have valid skin blobs, in offline-mode UUID v3 is used.
+
Spawns one or more experience orbs.
 
 
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>.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 619: Line 638:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x0C
+
  |rowspan="5"| 0x01
  |rowspan="9"| Play
+
  |rowspan="5"| Play
  |rowspan="9"| Client
+
  |rowspan="5"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
| Player's EID
+
  |
|-
 
| Player UUID
 
| UUID
 
  |  
 
 
  |-
 
  |-
 
  | X
 
  | X
  | Int
+
  | Double
  | Player X as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  |
 
  |-
 
  |-
 
  | Y
 
  | Y
  | Int
+
  | Double
  | Player Y as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  |
 
  |-
 
  |-
 
  | Z
 
  | Z
  | Int
+
  | Double
  | Player Z as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  |
 
  |-
 
  |-
  | Yaw
+
  | Count
| Angle
 
|
 
|-
 
| Pitch
 
| Angle
 
|
 
|-
 
| Current Item
 
 
  | Short
 
  | Short
  | The item the player is currently holding. Note that this should be 0 for “no item”, unlike -1 used in other packets.
+
  | The amount of experience this orb will reward once collected.
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Metadata]]
 
|
 
 
  |}
 
  |}
  
{{Warning|A negative Current Item crashes clients}}
+
==== Spawn Player ====
  
{{Warning|The client will crash if no Metadata is sent}}
+
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
  
==== Collect Item ====
+
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.
  
Sent by the server when someone picks up an item lying on the ground — its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each [[#Player Position|Player Position]] (and [[#Player Position And Look|Player Position And Look]]) packet sent by the client.
+
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 675: Line 678:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0D
+
  |rowspan="7"| 0x02
  |rowspan="2"| Play
+
  |rowspan="7"| Play
  |rowspan="2"| Client
+
  |rowspan="7"| Client
  | Collected Entity ID
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  |  
+
| A unique integer ID mostly used in the protocol to identify the player.
  |-  
+
|-
  | Collector Entity ID
+
| Player UUID
  | VarInt
+
| UUID
  |  
+
| See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs.
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
  |
 +
  |-
 +
  | Z
 +
| Double
 +
|
 +
|-
 +
| Yaw
 +
| Angle
 +
|
 +
|-
 +
| Pitch
 +
  | Angle
 +
  |
 
  |}
 
  |}
  
==== Spawn Object ====
+
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs.
  
Sent by the server when an Object/Vehicle is created.
+
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].
 +
 
 +
For NPCs UUID v2 should be used. Note:
 +
 
 +
<+Grum> i will never confirm this as a feature you know that :)
 +
 
 +
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 +
 
 +
==== Entity Animation (clientbound) ====
 +
 
 +
Sent whenever an entity should change animation.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 699: Line 732:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="11"| 0x0E
+
  |rowspan="2"| 0x03
  |rowspan="11"| Play
+
  |rowspan="2"| Play
  |rowspan="11"| Client
+
  |rowspan="2"| Client
  | Entity ID  
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  | EID of the object
+
  | Player ID.
 
  |-
 
  |-
  | Type
+
  | Animation
  | Byte
+
  | Unsigned Byte
  | The type of object (See [[Entities#Objects|Objects]])
+
  | Animation ID (see below).
 +
|}
 +
 
 +
Animation can be one of the following values:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Animation
 
  |-
 
  |-
  | X
+
  | 0
  | Int
+
  | Swing main arm
| X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Y
+
  | 1
  | Int
+
  | Take damage
| Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Z
+
  | 2
  | Int
+
  | Leave bed
| Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Pitch
+
  | 3
| Angle
+
  | Swing offhand
  |  
 
 
  |-
 
  |-
  | Yaw
+
  | 4
| Angle
+
  | Critical effect
  |  
 
 
  |-
 
  |-
  | Data
+
  | 5
  | [[Object Data]]
+
  | Magic critical effect
|
 
|-
 
| Velocity X
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]] (If Data > 0)
 
|-
 
| Velocity Y
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]] (If Data > 0)
 
|-
 
| Velocity Z
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]] (If Data > 0)
 
 
  |}
 
  |}
  
==== Spawn Mob ====
+
==== Award Statistics ====
  
Sent by the server when a Mob Entity is Spawned
+
Sent as a response to [[#Client Command|Client Command]] (id 1). Will only send the changed values if previously requested.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 755: Line 777:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="12"| 0x0F
+
  |rowspan="4"| 0x04
  |rowspan="12"| Play
+
  |rowspan="4"| Play
  |rowspan="12"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  |colspan="2"| Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array.
 +
|-
 +
|rowspan="3"| Statistic
 +
| Category ID
 +
|rowspan="3"| Array
 
  | VarInt
 
  | VarInt
  |  
+
  | See below.
 
  |-
 
  |-
  | Type
+
  | Statistic ID
  | Unsigned Byte
+
  | VarInt
  | The type of mob. See [[Entities#Mobs|Mobs]]
+
  | See below.
 
  |-
 
  |-
  | X
+
  | Value
  | Int
+
  | VarInt
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | The amount to set it to.
 +
|}
 +
 
 +
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! ID
 +
! Registry
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.mined</code>
  | Int
+
  | 0
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Blocks
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.crafted</code>
  | Int
+
  | 1
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Items
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.used</code>
  | Angle
+
  | 2
  |  
+
  | Items
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.broken</code>
  | Angle
+
  | 3
  |  
+
  | Items
 
  |-
 
  |-
  | Head Pitch
+
  | <code>minecraft.picked_up</code>
  | Angle
+
  | 4
  |  
+
  | Items
 
  |-
 
  |-
  | Velocity X
+
  | <code>minecraft.dropped</code>
  | Short
+
  | 5
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | Items
 
  |-
 
  |-
  | Velocity Y
+
  | <code>minecraft.killed</code>
  | Short
+
  | 6
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | Entities
 
  |-
 
  |-
  | Velocity Z
+
  | <code>minecraft.killed_by</code>
  | Short
+
  | 7
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | Entities
 
  |-
 
  |-
  | Metadata
+
  | <code>minecraft.custom</code>
  | [[Entities#Entity Metadata Format|Metadata]]
+
  | 8
  |  
+
  | Custom
 
  |}
 
  |}
  
==== Spawn Painting ====
+
Blocks, Items, and Entities use block (not block state), item, and entity ids.
  
This packet shows location, name, and type of painting.
+
Custom has the following (unit only matters for clients):
 
 
Calculating the center of an image: given a (width x height) grid of cells, with (0, 0) being the top left corner, the center is (max(0, width / 2 - 1), height / 2). E.g.
 
 
 
2x1 (1, 0)
 
4x4 (1, 2)
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
! State
+
  ! ID
! Bound To
+
  ! Unit
! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x10
+
  | <code>minecraft.leave_game</code>
|rowspan="4"| Play
+
  | 0
|rowspan="4"| Client
+
  | None
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Title
+
  | <code>minecraft.play_one_minute</code>
  | String
+
  | 1
  | Name of the painting. Max length 13
+
  | Time
 
  |-
 
  |-
  | Location
+
  | <code>minecraft.time_since_death</code>
  | Position
+
  | 2
  | Center coordinates
+
  | Time
 
  |-
 
  |-
  | Direction
+
  | <code>minecraft.time_since_rest</code>
| Unsigned Byte
+
  | 3
  | Direction the painting faces. 0: north (-z), 1: west (-x), 2: south (+z), 3: east (+x)
+
  | Time
  |}
 
 
 
==== Spawn Experience Orb ====
 
 
 
Spawns one or more experience orbs.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x11
+
  | <code>minecraft.sneak_time</code>
  |rowspan="5"| Play
+
| 4
  |rowspan="5"| Client
+
  | Time
  | Entity ID
+
  |-
  | VarInt
+
  | <code>minecraft.walk_one_cm</code>
  | Entity's ID
+
  | 5
 +
  | Distance
 
  |-
 
  |-
  | X
+
  | <code>minecraft.crouch_one_cm</code>
  | Int
+
  | 6
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.sprint_one_cm</code>
  | Int
+
  | 7
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.walk_on_water_one_cm</code>
  | Int
+
  | 8
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Count
+
  | <code>minecraft.fall_one_cm</code>
  | Short
+
  | 9
  | The amount of experience this orb will reward once collected
+
  | Distance
|}
 
 
 
==== Entity Velocity ====
 
 
 
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms); for example, -1343 would move (-1343 / 8000) = −0.167875 blocks per tick (or −3,3575 blocks per second).
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x12
+
  | <code>minecraft.climb_one_cm</code>
|rowspan="4"| Play
+
  | 10
|rowspan="4"| Client
+
  | Distance
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Velocity X
+
  | <code>minecraft.fly_one_cm</code>
  | Short
+
  | 11
  | Velocity on the X axis
+
  | Distance
 
  |-
 
  |-
  | Velocity Y
+
  | <code>minecraft.walk_under_water_one_cm</code>
  | Short
+
  | 12
  | Velocity on the Y axis
+
  | Distance
 
  |-
 
  |-
  | Velocity Z
+
  | <code>minecraft.minecart_one_cm</code>
  | Short
+
  | 13
  | Velocity on the Z axis
+
  | Distance
  |}
+
  |-
 
+
| <code>minecraft.boat_one_cm</code>
==== Destroy Entities ====
+
| 14
 
+
  | Distance
Sent by the server when a list of entities is to be destroyed on the client.
+
  |-
 
+
  | <code>minecraft.pig_one_cm</code>
{| class="wikitable"
+
  | 15
  ! Packet ID
+
  | Distance
  ! State
 
  ! Bound To
 
  ! Field Name
 
  ! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x13
+
  | <code>minecraft.horse_one_cm</code>
|rowspan="2"| Play
+
  | 16
|rowspan="2"| Client
+
  | Distance
| Count
 
  | VarInt
 
  | Number of elements in the following array
 
 
  |-
 
  |-
  | Entity IDs
+
  | <code>minecraft.aviate_one_cm</code>
| Array of VarInt
+
  | 17
  | The list of entities of destroy
+
  | Distance
  |}
 
 
 
==== Entity ====
 
 
 
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"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x14
+
  | <code>minecraft.swim_one_cm</code>
|rowspan="1"| Play
+
  | 18
|rowspan="1"| Client
+
  | Distance
| Entity ID
 
| VarInt
 
  |  
 
  |}
 
 
 
==== Entity Relative Move ====
 
 
 
This packet is sent by the server when an entity moves less then 4 blocks; if an entity moves more than 4 blocks [[#Entity Teleport|Entity Teleport]] should be sent instead.
 
 
 
This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x15
+
  | <code>minecraft.strider_one_cm</code>
|rowspan="5"| Play
+
  | 19
|rowspan="5"| Client
+
  | Distance
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Delta X
+
  | <code>minecraft.jump</code>
  | Byte
+
  | 20
  | Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Delta Y
+
  | <code>minecraft.drop</code>
  | Byte
+
  | 21
  | Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Delta Z
+
  | <code>minecraft.damage_dealt</code>
  | Byte
+
  | 22
  | Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Damage
 
  |-
 
  |-
  | On Ground
+
  | <code>minecraft.damage_dealt_absorbed</code>
| Boolean
+
  | 23
  |  
+
  | Damage
  |}
 
 
 
==== Entity Look ====
 
 
 
This packet is sent by the server when an entity rotates.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x16
+
  | <code>minecraft.damage_dealt_resisted</code>
|rowspan="5"| Play
+
  | 24
|rowspan="5"| Client
+
  | Damage
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.damage_taken</code>
  | Angle
+
  | 25
  | New angle, not a delta
+
  | Damage
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.damage_blocked_by_shield</code>
  | Angle
+
  | 26
  | New angle, not a delta
+
  | Damage
 
  |-
 
  |-
  | On Ground
+
  | <code>minecraft.damage_absorbed</code>
  | Boolean
+
  | 27
  |  
+
  | Damage
|}
 
 
 
==== Entity Look And Relative Move ====
 
 
 
This packet is sent by the server when an entity rotates and moves. Since a byte range is limited from -128 to 127, and movement is offset of fixed-point numbers, this packet allows at most four blocks movement in any direction. (-128/32 == -4)
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x17
+
  | <code>minecraft.damage_resisted</code>
|rowspan="7"| Play
+
  | 28
|rowspan="7"| Client
+
  | Damage
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Delta X
+
  | <code>minecraft.deaths</code>
  | Byte
+
  | 29
  | Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Delta Y
+
  | <code>minecraft.mob_kills</code>
  | Byte
+
  | 30
  | Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Delta Z
+
  | <code>minecraft.animals_bred</code>
  | Byte
+
  | 31
  | Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.player_kills</code>
  | Angle
+
  | 32
  | New angle, not a delta
+
  | None
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.fish_caught</code>
  | Angle
+
  | 33
  | New angle, not a delta
+
  | None
 
  |-
 
  |-
  | On Ground
+
  | <code>minecraft.talked_to_villager</code>
  | Boolean
+
  | 34
  |  
+
  | None
  |}
+
  |-
 
+
| <code>minecraft.traded_with_villager</code>
==== Entity Teleport ====
+
| 35
 
+
| None
This packet is sent by the server when an entity moves more than 4 blocks.
+
|-
 
+
| <code>minecraft.eat_cake_slice</code>
{| class="wikitable"
+
| 36
  ! Packet ID
+
| None
  ! State
+
|-
  ! Bound To
+
  | <code>minecraft.fill_cauldron</code>
  ! Field Name
+
  | 37
  ! Field Type
+
  | None
  ! Notes
+
  |-
 +
  | <code>minecraft.use_cauldron</code>
 +
  | 38
 +
| None
 
  |-
 
  |-
  |rowspan="7"| 0x18
+
  | <code>minecraft.clean_armor</code>
|rowspan="7"| Play
+
  | 39
|rowspan="7"| Client
+
  | None
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | X
+
  | <code>minecraft.clean_banner</code>
  | Int
+
  | 40
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.clean_shulker_box</code>
  | Int
+
  | 41
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.interact_with_brewingstand</code>
  | Int
+
  | 42
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.interact_with_beacon</code>
  | Angle
+
  | 43
  | New angle, not a delta
+
  | None
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.inspect_dropper</code>
  | Angle
+
  | 44
  | New angle, not a delta
+
  | None
 
  |-
 
  |-
  | On Ground
+
  | <code>minecraft.inspect_hopper</code>
  | Boolean
+
  | 45
  |  
+
  | None
  |}
+
  |-
 
+
| <code>minecraft.inspect_dispenser</code>
==== Entity Head Look ====
+
| 46
 +
| None
 +
|-
 +
| <code>minecraft.play_noteblock</code>
 +
| 47
 +
| None
 +
|-
 +
| <code>minecraft.tune_noteblock</code>
 +
| 48
 +
| None
 +
|-
 +
| <code>minecraft.pot_flower</code>
 +
| 49
 +
| None
 +
|-
 +
| <code>minecraft.trigger_trapped_chest</code>
 +
| 50
 +
| None
 +
|-
 +
| <code>minecraft.open_enderchest</code>
 +
| 51
 +
| None
 +
|-
 +
| <code>minecraft.enchant_item</code>
 +
| 52
 +
| None
 +
|-
 +
| <code>minecraft.play_record</code>
 +
| 53
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_furnace</code>
 +
| 54
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_crafting_table</code>
 +
| 55
 +
| None
 +
|-
 +
| <code>minecraft.open_chest</code>
 +
| 56
 +
| None
 +
|-
 +
| <code>minecraft.sleep_in_bed</code>
 +
| 57
 +
| None
 +
|-
 +
| <code>minecraft.open_shulker_box</code>
 +
| 58
 +
| None
 +
|-
 +
| <code>minecraft.open_barrel</code>
 +
| 59
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_blast_furnace</code>
 +
| 60
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_smoker</code>
 +
| 61
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_lectern</code>
 +
| 62
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_campfire</code>
 +
| 63
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_cartography_table</code>
 +
| 64
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_loom</code>
 +
| 65
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_stonecutter</code>
 +
| 66
 +
| None
 +
|-
 +
| <code>minecraft.bell_ring</code>
 +
| 67
 +
| None
 +
|-
 +
| <code>minecraft.raid_trigger</code>
 +
| 68
 +
| None
 +
|-
 +
| <code>minecraft.raid_win</code>
 +
| 69
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_anvil</code>
 +
| 70
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_grindstone</code>
 +
| 71
 +
| None
 +
|-
 +
| <code>minecraft.target_hit</code>
 +
| 72
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_smithing_table</code>
 +
| 73
 +
| None
 +
|}
  
Changes the direction an entity's head is facing.
+
Units:
 +
 
 +
* None: just a normal number (formatted with 0 decimal places)
 +
* Damage: value is 10 times the normal amount
 +
* Distance: a distance in centimeters (hundredths of blocks)
 +
* Time: a time span in ticks
 +
 
 +
==== Acknowledge Block Change ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,132: Line 1,170:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x19
+
  |rowspan="4"| 0x05
  |rowspan="2"| Play
+
  |rowspan="4"| Play
  |rowspan="2"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  | Sequence ID
 
  | VarInt
 
  | VarInt
  |  
+
  | Represents the sequence to acknowledge, this is used for properly syncing block changes to the client after interactions.
 
  |-
 
  |-
| Head Yaw
 
| Angle
 
| New angle, not a delta
 
 
  |}
 
  |}
  
==== Entity Status ====
 
  
{| class="wikitable"
+
==== Set Block Destroy Stage ====
  ! Packet ID
+
 
 +
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 +
 
 +
Block break animations can still be applied on air; the animation will remain visible although there is no block being broken.  However, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency.  (An effect similar to this can be seen in normal gameplay when breaking ice blocks)
 +
 
 +
If you need to display several break animations at the same time you have to give each of them a unique Entity ID. The entity ID does not need to correspond to an actual entity on the client. It is valid to use a randomly generated number.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
Line 1,154: Line 1,196:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1A
+
  |rowspan="3"| 0x06
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
 
  | Entity ID
 
  | Entity ID
  | Int
+
  | VarInt
  |  
+
  | The ID of the entity breaking the block.
 +
|-
 +
| Location
 +
| Position
 +
| Block Position.
 
  |-
 
  |-
  | Entity Status
+
  | Destroy Stage
 
  | Byte
 
  | Byte
  | See below
+
  | 0–9 to set it, any other value to remove it.
 
  |}
 
  |}
 +
 +
==== Block Entity Data ====
 +
 +
Sets the block entity associated with the block at the given location.
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Entity Status
+
  |rowspan="3"| 0x07
  ! Meaning
+
  |rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Location
 +
| Position
 +
|
 
  |-
 
  |-
  | 1
+
  | Type
  | Sent when resetting a mob spawn minecart's timer - appears to be unused by the client
+
  | VarInt
 +
| The type of the block entity
 
  |-
 
  |-
  | 2
+
  | NBT Data
  | Living Entity hurt
+
  | [[NBT|NBT Tag]]
|-
+
  | Data to set. May be a TAG_END (0), in which case the block entity at the given location is removed (though this is not required since the client will remove the block entity automatically on chunk unload or block removal).
  | 3
+
  |}
  | Living Entity dead
+
 
|-
+
==== Block Action ====
| 4
+
 
| Iron Golem throwing up arms
+
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.
|-
 
| 6
 
| Wolf/Ocelot/Horse taming — Spawn “heart” particles
 
|-
 
| 7
 
| Wolf/Ocelot/Horse tamed — Spawn “smoke” particles
 
|-
 
| 8
 
| Wolf shaking water — Trigger the shaking animation
 
|-
 
| 9
 
| (of self) Eating accepted by server
 
  |-
 
| 10
 
| Sheep eating grass
 
|-
 
| 10
 
| Play TNT ignite sound
 
|-
 
| 11
 
| Iron Golem handing over a rose
 
|-
 
  | 12
 
| Villager mating — Spawn “heart” particles
 
|-
 
| 13
 
| Spawn particles indicating that a villager is angry and seeking revenge
 
|-
 
| 14
 
| Spawn happy particles near a villager
 
|-
 
| 15
 
| Witch animation — Spawn “magic” particles
 
|-
 
| 16
 
| Play zombie converting into a villager sound
 
|-
 
| 17
 
| Firework exploding
 
|-
 
| 18
 
| Animal in love (ready to mate) — Spawn “heart” particles
 
|-
 
| 19
 
| Reset squid rotation
 
|-
 
| 20
 
| Spawn explosion particle — works for some living entities
 
|-
 
| 21
 
| Play guardian sound — works for every entity
 
|-
 
| 22
 
| Enables reduced debug for players
 
|-
 
| 23
 
| Disables reduced debug for players
 
|}
 
  
==== Attach Entity ====
+
See [[Block Actions]] for a list of values.
  
This packet is sent when a player has been attached to an entity (e.g. Minecart).
+
{{Warning2|This packet uses a block ID, not a block state.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,253: Line 1,256:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1B
+
  |rowspan="4"| 0x08
  |rowspan="3"| Play
+
  |rowspan="4"| Play
  |rowspan="3"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  | Location
  | Int
+
  | Position
  | Attached entity's EID. Set to -1 to detach.
+
  | Block coordinates.
 +
|-
 +
| Action ID (Byte 1)
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]].
 
  |-
 
  |-
  | Vehicle ID
+
  | Action Parameter (Byte 2)
  | Int
+
  | Unsigned Byte
  | Vechicle's Entity ID
+
  | Varies depending on block — see [[Block Actions]].
 
  |-
 
  |-
  | Leash
+
  | Block Type
  | Boolean
+
  | VarInt
  | If true leashes the entity to the vehicle
+
  | The block type ID for the block.  This must match the block at the given coordinates.
 
  |}
 
  |}
  
==== Entity Metadata ====
+
 
 +
==== Block Update ====
 +
 
 +
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"
Line 1,279: Line 1,291:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1C
+
  |rowspan="2"| 0x09
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Entity ID
+
  | Location
 +
| Position
 +
| Block Coordinates.
 +
|-
 +
| Block ID
 
  | VarInt
 
  | VarInt
  |  
+
  | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Metadata]]
 
|  
 
 
  |}
 
  |}
  
==== Entity Effect ====
+
==== Boss Bar ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,297: Line 1,309:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x1D
+
  |rowspan="14"| 0x0A
  |rowspan="5"| Play
+
  |rowspan="14"| Play
  |rowspan="5"| Client
+
  |rowspan="14"| Client
  | Entity ID
+
  |colspan="2"| UUID
  | VarInt
+
  | UUID
  |  
+
  | Unique ID for this bar.
 
  |-
 
  |-
  | Effect ID
+
  |colspan="2"| Action
  | Byte
+
  | VarInt Enum
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | Determines the layout of the remaining packet.
 
  |-
 
  |-
  | Amplifier
+
  ! Action
  | Byte
+
  ! Field Name
  | Notchian client displays effect level as Amplifier + 1
+
  !
 +
!
 
  |-
 
  |-
  | Duration
+
  |rowspan="5"| 0: add
  | VarInt
+
| Title
  | Seconds
+
| [[Chat]]
 +
|
 +
|-
 +
| Health
 +
| Float
 +
| From 0 to 1. Values greater than 1 do not crash a Notchian client, and start [https://i.johni0702.de/nA.png rendering part of a second health bar] at around 1.5.
 +
|-
 +
| Color
 +
| VarInt Enum
 +
| Color ID (see below).
 +
|-
 +
| Division
 +
  | VarInt Enum
 +
| Type of division (see below).
 +
|-
 +
| Flags
 +
| Unsigned Byte
 +
| Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02).
 +
|-
 +
| 1: remove
 +
| ''no fields''
 +
| ''no fields''
 +
| Removes this boss bar.
 +
|-
 +
| 2: update health
 +
| Health
 +
| Float
 +
| ''as above''
 +
|-
 +
| 3: update title
 +
| Title
 +
| [[Chat]]
 +
|
 +
|-
 +
|rowspan="2"| 4: update style
 +
| Color
 +
| VarInt Enum
 +
| Color ID (see below).
 +
|-
 +
| Dividers
 +
| VarInt Enum
 +
| ''as above''
 +
|-
 +
| 5: update flags
 +
| Flags
 +
| Unsigned Byte
 +
  | ''as above''
 
  |-
 
  |-
| Hide Particles
 
| Boolean
 
|
 
 
  |}
 
  |}
 
==== Remove Entity Effect ====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Color
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x1E
+
  | 0
|rowspan="2"| Play
+
  | Pink
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
  |  
 
 
  |-
 
  |-
  | Effect ID
+
  | 1
  | Byte
+
| Blue
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
|-
 +
| 2
 +
| Red
 +
|-
 +
| 3
 +
| Green
 +
|-
 +
| 4
 +
| Yellow
 +
|-
 +
| 5
 +
| Purple
 +
|-
 +
| 6
 +
  | White
 +
  |}
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Type of division
 +
|-
 +
| 0
 +
| No division
 +
|-
 +
| 1
 +
| 6 notches
 +
|-
 +
| 2
 +
| 10 notches
 +
|-
 +
| 3
 +
| 12 notches
 +
|-
 +
| 4
 +
| 20 notches
 
  |}
 
  |}
  
==== Set Experience ====
+
==== Change Difficulty ====
  
Sent by the server when the client should change experience levels.
+
Changes the difficulty setting in the client's option menu
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,359: Line 1,439:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1F
+
  |rowspan="2"| 0x0B
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Experience bar
+
  | Difficulty
  | Float
+
  | Unsigned Byte
  | Between 0 and 1
+
  | 0: peaceful, 1: easy, 2: normal, 3: hard.
 
  |-
 
  |-
  | Level
+
  | Difficulty locked?
  | VarInt
+
  | Boolean
  |  
+
  |
|-
 
| Total Experience
 
| VarInt
 
| See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
 
 
  |}
 
  |}
  
==== Entity Properties ====
+
==== Chat Preview (clientbound) ====
 +
 
 +
Sets the message to preview on the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,381: Line 1,459:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x20
+
  |rowspan="3"| 0x0C
  |rowspan="6"| Play
+
  |rowspan="3"| Play
  |rowspan="6"| Client
+
  |rowspan="3"| Client
  |colspan="2"| Entity ID
+
  | Query ID
  |colspan="2"| VarInt
+
  | Integer
  |  
+
  |
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | Component is Present
  |colspan="2"| Int
+
  | Boolean
  | Number of elements in the following array
+
  |
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | Message to Preview
| Key
+
  | Component
|rowspan="4"| Array
+
  |
| String
 
  | See below
 
  |-
 
| Value
 
| Double
 
| See below
 
|-
 
| Number Of Modifiers
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Modifiers
 
| Array of Modifier Data
 
| See {{Minecraft Wiki|Attribute#Modifiers}}
 
 
  |}
 
  |}
  
Known Key values:
+
==== Clear Titles ====
 +
 
 +
Clear the client's current title information, with the option to also reset it.
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Key
+
|rowspan="1"| 0x0D
  ! Default
+
|rowspan="1"| Play
  ! Min
+
|rowspan="1"| Client
  ! Max
+
| Reset
  ! Label
+
| Boolean
 +
|
 +
|}
 +
 
 +
==== 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"
 +
! Packet ID
 +
  ! State
 +
  ! Bound To
 +
  !colspan="2"| Field Name
 +
  !colspan="2"| Field Type
 +
  ! Notes
 +
|-
 +
|rowspan="8"| 0x0E
 +
|rowspan="8"| Play
 +
|rowspan="8"| Client
 
  |-
 
  |-
  | generic.maxHealth
+
  |colspan="2"| ID
  | 20.0
+
  |colspan="2"| VarInt
| 0.0
+
  | Transaction ID.
  | Double.MaxValue
 
| Max Health
 
 
  |-
 
  |-
  | generic.followRange
+
  |colspan="2"| Start
  | 32.0
+
  |colspan="2"| VarInt
| 0.0
+
  | Start of the text to replace.
  | 2048.0
 
| Follow Range
 
 
  |-
 
  |-
  | generic.knockbackResistance
+
  |colspan="2"| Length
  | 0.0
+
  |colspan="2"| VarInt
| 0.0
+
  | Length of the text to replace.
  | 1.0
 
| Knockback Resistance
 
 
  |-
 
  |-
  | generic.movementSpeed
+
  |colspan="2"| Count
  | 0.699999988079071
+
  |colspan="2"| VarInt
| 0.0
+
  | Number of elements in the following array.
  | Double.MaxValue
 
| Movement Speed
 
 
  |-
 
  |-
  | generic.attackDamage
+
  |rowspan="3"| Matches
  | 2.0
+
  | Match
  | 0.0
+
  |rowspan="3"| Array
  | Double.MaxValue
+
  | 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.
 
  |-
 
  |-
  | horse.jumpStrength
+
  | Has tooltip
  | 0.7
+
  | Boolean
  | 0.0
+
  | True if the following is present.
| 2.0
 
| Jump Strength
 
 
  |-
 
  |-
  | zombie.spawnReinforcements
+
  | Tooltip
  | 0.0
+
  | Optional [[Chat]]
  | 0.0
+
  | Tooltip to display; only present if previous boolean is true.
| 1.0
 
| Spawn Reinforcements Chance
 
 
  |}
 
  |}
  
''Modifier Data'' structure:
+
==== Commands ====
 +
 
 +
Lists all of the commands on the server, and how they are parsed.
 +
 
 +
This is a directed graph, with one root node.  Each redirect or child node must refer only to nodes that have already been declared.
  
 
{| class="wikitable"
 
{| class="wikitable"
  |-
+
  ! Packet ID
 +
! State
 +
! Bound To
 
  ! Field Name
 
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | UUID
+
  |rowspan="3"| 0x0F
  | UUID
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Count
 +
  | VarInt
 +
  | Number of elements in the following array.
 
  |-
 
  |-
  | Amount
+
  | Nodes
  | Double
+
  | Array of [[Command Data|Node]]
  |  
+
  | An array of nodes.
 
  |-
 
  |-
  | Operation
+
  | Root index
  | Byte
+
  | VarInt
  |  
+
  | Index of the <code>root</code> node in the previous array.
 
  |}
 
  |}
  
==== Chunk Data ====
+
For more information on this packet, see the [[Command Data]] article.
  
Chunks are not unloaded by the client automatically. To unload chunks, send this packet with Ground-Up Continuous=true and no 16^3 chunks (eg. Primary Bit Mask=0). The server does not send skylight information for nether-chunks, it's up to the client to know if the player is currently in the nether. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent.
+
==== Close Container (clientbound) ====
  
See also: [[SMP Map Format]]
+
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.
 
 
Changes in 1.8:
 
 
 
* Data value section removed
 
* Extended id section removed
 
* Block id section is now a unsigned short (little endian) per a block
 
* The block id is equal to <code>(id << 4) | data</code>
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,510: Line 1,590:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x21
+
  | 0x10
  |rowspan="6"| Play
+
  | Play
  |rowspan="6"| Client
+
  | Client
  | Chunk X
+
  | Window ID
  | Int
+
  | Unsigned Byte
| Chunk X coordinate
+
  | This is the ID of the window that was closed. 0 for inventory.
|-
 
| Chunk Z
 
| Int
 
| Chunk Z coordinate
 
|-
 
| Ground-Up Continuous
 
| Boolean
 
  | This is true if the packet represents all sections in this vertical column, where the Primary Bit Mask specifies exactly which sections are included, and which are air
 
|-
 
| Primary Bit Mask
 
| Unsigned Short
 
| Bitmask with 1 for every 16x16x16 section whose data follows in the compressed data
 
|-
 
| Size
 
| VarInt
 
| Size of Data
 
|-
 
| Data
 
| [[SMP Map Format#Data|Chunk]]
 
|
 
 
  |}
 
  |}
  
==== Multi Block Change ====
+
==== Set Container Content ====
Fired whenever 2 or more blocks are changed within the render distance.
+
[[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"
 
{| 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="6"| 0x22
+
  |rowspan="5"| 0x11
  |rowspan="6"| Play
+
  |rowspan="5"| Play
  |rowspan="6"| Client
+
  |rowspan="5"| Client
  |colspan="2"| Chunk X
+
  | Window ID
  |colspan="2"| Int
+
  | Unsigned Byte
  | Chunk X coordinate
+
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  | State ID
  |colspan="2"| Int
+
| VarInt
| Chunk Z coordinate
+
  | The last received State ID from either a [[#Set Container Slot|Set Container Slot]] or a [[#Set Container Content|Set Container Content]] packet
 
  |-
 
  |-
  |colspan="2"| Record Count
+
  | Count
  |colspan="2"| VarInt
+
  | VarInt
  | Number of elements in the following array, a.k.a. the number of blocks affected
+
  | Number of elements in the following array.
 
  |-
 
  |-
  |rowspan="3"| Record
+
  | Slot Data
  | Horizontal Position
+
  | Array of [[Slot Data|Slot]]
|rowspan="3"| Array
 
| Unsigned Byte
 
| The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
 
 
  |-
 
  |-
  | Y Coordinate
+
  | Carried Item
  | Unsigned Byte
+
  | [[Slot Data|Slot]]
|
+
  | Item held by player.
|-
 
| Block ID
 
| VarInt
 
  | The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
 
 
  |}
 
  |}
  
==== Block Change ====
+
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
Fired whenever a block is changed within the render distance.
+
 
 +
==== Set Container Property ====
 +
 
 +
This packet is used to inform the client that part of a GUI window should be updated.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
Line 1,588: Line 1,648:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x23
+
  |rowspan="3"| 0x12
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Location
+
  | Window ID
  | Position
+
  | Unsigned Byte
  | Block Coordinates
+
  |
 
  |-
 
  |-
  | Block ID
+
  | Property
  | VarInt
+
  | Short
  | The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
+
| The property to be updated, see below.
 +
|-
 +
| Value
 +
| Short
 +
  | The new value for the property, see below.
 
  |}
 
  |}
  
==== Block Action ====
+
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.
 
 
This packet is used for a number of things:
 
 
 
* Chests opening and closing
 
* Pistons pushing and pulling
 
* Note blocks playing
 
* Updating beacons
 
 
 
See Also: [[Block Actions]]
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x24
+
  ! Window type
  |rowspan="4"| Play
+
! Property
  |rowspan="4"| Client
+
! Value
| Location
+
  |-
  | Position
+
  |rowspan="4"| Furnace
  | Block Coordinates
+
  | 0: Fire icon (fuel left)
 +
  | counting from fuel burn time down to 0 (in-game ticks)
 
  |-
 
  |-
  | Byte 1
+
  | 1: Maximum fuel burn time
  | Unsigned Byte
+
  | fuel burn time or 0 (in-game ticks)
| Varies depending on block — see [[Block Actions]]
 
 
  |-
 
  |-
  | Byte 2
+
  | 2: Progress arrow
  | Unsigned Byte
+
  | counting from 0 to maximum progress (in-game ticks)
| Varies depending on block — see [[Block Actions]]
 
 
  |-
 
  |-
  | Block Type
+
  | 3: Maximum progress
  | VarInt
+
  | always 200 on the notchian server
| The block type for the block
 
|}
 
 
 
==== Block Break Animation ====
 
 
 
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 
 
 
You can also set an animation to air! The animation will still be visible.
 
 
 
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
 
 
 
Also if you set the coordinates to a special block like water etc. it won't show the actual break animation but some other interesting effects. (Water will lose it's transparency)
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x25
+
  |rowspan="10"| Enchantment Table
  |rowspan="3"| Play
+
| 0: Level requirement for top enchantment slot
  |rowspan="3"| Client
+
  |rowspan="3"| The enchantment's xp level requirement
  | Entity ID
+
|-
  | VarInt
+
  | 1: Level requirement for middle enchantment slot
  | EID for the animation
+
|-
 +
| 2: Level requirement for bottom enchantment slot
 +
  |-
 +
  | 3: The enchantment seed
 +
  | 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>).
 
  |-
 
  |-
  | Location
+
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
  | Position
+
  |rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
| Block Position
 
 
  |-
 
  |-
  | Destroy Stage
+
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
| Byte
 
| 0–9 to set it, any other value to remove it
 
|}
 
 
 
==== Map Chunk Bulk ====
 
 
 
1.8 changes at [[#Chunk Data|Chunk Data]]
 
 
 
To reduce the number of bytes, this packet is used to send chunks together for better compression results.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
!colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x26
+
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
|rowspan="7"| Play
 
|rowspan="7"| Client
 
|colspan="2"| Sky Light Sent
 
|colspan="2"| Boolean
 
| Whether or not Chunk Data contains light nibble arrays. This is true in the Overworld, false in the End + Nether
 
 
  |-
 
  |-
  |colspan="2"| Chunk Column Count
+
  | 7: Enchantment level shown on mouse hover over the top slot
  |colspan="2"| VarInt
+
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
| Number of elements in each of the following arrays
 
 
  |-
 
  |-
  |rowspan="3"| Chunk Meta
+
  | 8: Enchantment level shown on mouse hover over the middle slot
| Chunk X
 
|rowspan="3"| Array
 
| Int
 
| The X coordinate of the chunk
 
 
  |-
 
  |-
  | Chunk Z
+
  | 9: Enchantment level shown on mouse hover over the bottom slot
| Int
 
| The Z coordinate of the chunk
 
 
  |-
 
  |-
  | Primary Bit Mask
+
  |rowspan="3"| Beacon
  | Unsigned Short
+
  | 0: Power level
  | A bit mask which specifies which sections are not empty in this chunk
+
  | 0-4, controls what effect buttons are enabled
 
  |-
 
  |-
  |colspan="2"| Chunk Data
+
  | 1: First potion effect
  |colspan="2"| Array of [[SMP Map Format#Data|Chunk]]
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
| Each chunk in this array corresponds to the data at the same position in Chunk Meta
 
|}
 
 
 
==== Explosion ====
 
 
 
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
 
 
 
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="9"| 0x27
+
  | 2: Second potion effect
  |rowspan="9"| Play
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
|rowspan="9"| Client
 
| X
 
| Float
 
|  
 
 
  |-
 
  |-
  | Y
+
  | Anvil
  | Float
+
  | 0: Repair cost
  |  
+
  | The repair's cost in xp levels
 
  |-
 
  |-
  | Z
+
  |rowspan="2"| Brewing Stand
  | Float
+
  | 0: Brew time
  |  
+
  | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
  |-
 
  |-
  | Radius
+
  | 1: Fuel time
  | Float
+
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
| Currently unused in the client
 
 
  |-
 
  |-
  | Record Count
+
  | Stonecutter
  | Int
+
  | 0: Selected recipe
  | Number of elements in the following array
+
  | The index of the selected recipe. -1 means none is selected.
 
  |-
 
  |-
  | Records
+
  | Loom
  | Array of (Byte, Byte, Byte)
+
  | 0: Selected pattern
  | Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
+
  | The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern.
 
  |-
 
  |-
  | Player Motion X
+
  | Lectern
  | Float
+
  | 0: Page number
  | X velocity of the player being pushed by the explosion
+
  | The current page number, starting from 0.
|-
 
| Player Motion Y
 
| Float
 
| Y velocity of the player being pushed by the explosion
 
|-
 
| Player Motion Z
 
| Float
 
| Z velocity of the player being pushed by the explosion
 
 
  |}
 
  |}
  
==== Effect ====
+
For an enchanting table, the following numerical IDs are used:
 
 
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 1013 (mob.wither.spawn), and is ignored for any other value by the client.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Numerical ID
  ! State
+
  ! Enchantment ID
  ! Bound To
+
  ! Enchantment Name
  ! Field Name
+
|-
  ! Field Type
+
  | 0
  ! Notes
+
  | minecraft:protection
 +
  | Protection
 
  |-
 
  |-
  |rowspan="4"| 0x28
+
  | 1
|rowspan="4"| Play
+
  | minecraft:fire_protection
|rowspan="4"| Client
+
  | Fire Protection
| Effect ID
 
  | Int
 
  | The ID of the effect, see below
 
 
  |-
 
  |-
  | Location
+
  | 2
  | Position
+
  | minecraft:feather_falling
  | The location of the effect
+
  | Feather Falling
 
  |-
 
  |-
  | Data
+
  | 3
  | Int
+
  | minecraft:blast_protection
  | Extra data for certain effects, see below
+
  | Blast Protection
 
  |-
 
  |-
  | Disable Relative Volume
+
  | 4
  | Boolean
+
  | minecraft:projectile_protection
| See above
+
  | Projectile Protection
  |}
 
 
 
Effect IDs:
 
 
 
{| class="wikitable"
 
! ID
 
! Name
 
! Data
 
 
  |-
 
  |-
  !colspan="3"| Sound
+
  | 5
 +
| minecraft:respiration
 +
| Respiration
 
  |-
 
  |-
  | 1000
+
  | 6
  | <code>random.click</code>
+
  | minecraft:aqua_affinity
  |  
+
  | Aqua Affinity
 
  |-
 
  |-
  | 1001
+
  | 7
  | <code>random.click</code>
+
  | minecraft:thorns
  |  
+
  | Thorns
 
  |-
 
  |-
  | 1002
+
  | 8
  | <code>random.bow</code>
+
  | minecraft:depth_strider
  |  
+
  | Depth Strider
 
  |-
 
  |-
  | 1003
+
  | 9
  | <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
+
  | minecraft:frost_walker
  |  
+
  | Frost Walker
 
  |-
 
  |-
  | 1004
+
  | 10
  | <code>random.fizz</code>
+
  | minecraft:binding_curse
  |  
+
  | Curse of Binding
 
  |-
 
  |-
  | 1005
+
  | 11
  | Play a music disc.
+
  | minecraft:soul_speed
  | {{Minecraft Wiki|Music Discs|Record ID}}
+
  | Soul Speed
 
  |-
 
  |-
  | 1006
+
  | 12
  | ''not assigned''
+
  | minecraft:sharpness
  |  
+
  | Sharpness
 
  |-
 
  |-
  | 1007
+
  | 13
  | <code>mob.ghast.charge</code>
+
  | minecraft:smite
  |  
+
  | Smite
 
  |-
 
  |-
  | 1008
+
  | 14
  | <code>mob.ghast.fireball</code>
+
  | minecraft:bane_of_arthropods
  |  
+
  | Bane of Arthropods
 
  |-
 
  |-
  | 1009
+
  | 15
  | <code>mob.ghast.fireball</code>, but with a lower volume
+
  | minecraft:knockback
  |  
+
  | Knockback
 
  |-
 
  |-
  | 1010
+
  | 16
  | <code>mob.zombie.wood</code>
+
  | minecraft:fire_aspect
  |  
+
  | Fire Aspect
 
  |-
 
  |-
  | 1011
+
  | 17
  | <code>mob.zombie.metal</code>
+
  | minecraft:looting
  |  
+
  | Looting
 
  |-
 
  |-
  | 1012
+
  | 18
  | <code>mob.zombie.woodbreak</code>
+
  | minecraft:sweeping
  |  
+
  | Sweeping Edge
 
  |-
 
  |-
  | 1013
+
  | 19
  | <code>mob.wither.spawn</code>
+
  | minecraft:efficiency
  |  
+
  | Efficiency
 
  |-
 
  |-
  | 1014
+
  | 20
  | <code>mob.wither.shoot</code>
+
  | minecraft:silk_touch
  |  
+
  | Silk Touch
 
  |-
 
  |-
  | 1015
+
  | 21
  | <code>mob.bat.takeoff</code>
+
  | minecraft:unbreaking
  |  
+
  | Unbreaking
 
  |-
 
  |-
  | 1016
+
  | 22
  | <code>mob.zombie.infect</code>
+
  | minecraft:fortune
  |  
+
  | Fortune
 
  |-
 
  |-
  | 1017
+
  | 23
  | <code>mob.zombie.unfect</code>
+
  | minecraft:power
  |  
+
  | Power
 
  |-
 
  |-
  | 1018
+
  | 24
  | <code>mob.enderdragon.end</code>
+
  | minecraft:punch
  |  
+
  | Punch
 
  |-
 
  |-
  | 1020
+
  | 25
  | <code>random.anvil_break</code>
+
  | minecraft:flame
  |  
+
  | Flame
 
  |-
 
  |-
  | 1021
+
  | 26
  | <code>random.anvil_use</code>
+
  | minecraft:infinity
  |  
+
  | Infinity
 
  |-
 
  |-
  | 1022
+
  | 27
  | <code>random.anvil_land</code>
+
  | minecraft:luck_of_the_sea
  |  
+
  | Luck of the Sea
 
  |-
 
  |-
  !colspan="3"| Particle
+
  | 28
 +
| minecraft:lure
 +
| Lure
 
  |-
 
  |-
  | 2000
+
  | 29
  | Spawns 10 smoke particles, e.g. from a fire
+
  | minecraft:loyalty
  | Direction, see below
+
  | Loyalty
 
  |-
 
  |-
  | 2001
+
  | 30
  | Block break
+
  | minecraft:impaling
  | {{Minecraft Wiki|Data values|Block ID}}
+
  | Impaling
 
  |-
 
  |-
  | 2002
+
  | 31
  | Splash potion. Particle effect + glass break sound.
+
  | minecraft:riptide
  | [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
+
  | Riptide
 
  |-
 
  |-
  | 2003
+
  | 32
  | Eye of Ender entity break animation — particles and sound
+
  | minecraft:channeling
  |  
+
  | Channeling
 
  |-
 
  |-
  | 2004
+
  | 33
  | Mob spawn particle effect: smoke + flames
+
  | minecraft:multishot
  |  
+
  | Multishot
 
  |-
 
  |-
  | 2005
+
  | 34
| Spawn “happy villager” effect (green crosses), used for bonemealing vegetation
+
  | minecraft:quick_charge
  |  
+
  | Quick Charge
  |}
 
 
 
Smoke directions:
 
 
 
{| class="wikitable"
 
! ID
 
! Direction
 
 
  |-
 
  |-
  | 0
+
  | 35
  | South-East
+
  | minecraft:piercing
 +
| Piercing
 
  |-
 
  |-
  | 1
+
  | 36
  | South
+
  | minecraft:mending
 +
| Mending
 
  |-
 
  |-
  | 2
+
  | 37
  | South-West
+
  | minecraft:vanishing_curse
  |-
+
  | Curse of Vanishing
| 3
 
| East
 
|-
 
| 4
 
| (Up or middle ?)
 
|-
 
| 5
 
| West
 
|-
 
| 6
 
| North-East
 
|-
 
| 7
 
| North
 
|-
 
| 8
 
| North-West
 
 
  |}
 
  |}
  
==== Sound Effect ====
+
==== Set Container Slot ====
  
Used to play a sound effect on the client.
+
Sent by the server when an item in a slot (in a window) is added/removed.
 
 
Custom sounds may be added by resource packs.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,977: Line 1,916:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x29
+
  |rowspan="4"| 0x13
  |rowspan="6"| Play
+
  |rowspan="4"| Play
  |rowspan="6"| Client
+
  |rowspan="4"| Client
  | Sound name
+
  | Window ID
  | String
+
  | Byte
  | All known sound effect names can be seen [https://github.com/SirCmpwn/Craft.Net/blob/master/source/Craft.Net.Common/SoundEffect.cs here]
+
  | 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).
 
  |-
 
  |-
  | Effect position X
+
  | State ID
  | Int
+
  | VarInt
  | Effect X multiplied by 8
+
  | The last received State ID from either a [[#Set Container Slot|Set Container Slot]] or a [[#Set Container Content|Set Container Content]] packet
 
  |-
 
  |-
  | Effect position Y
+
  | Slot
  | Int
+
  | Short
  | Effect Y multiplied by 8
+
  | The slot that should be updated.
 
  |-
 
  |-
  | Effect position Z
+
  | Slot Data
  | Int
+
| [[Slot Data|Slot]]
  | Effect Z multiplied by 8
+
  |
 +
  |}
 +
 
 +
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 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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Volume
+
  |rowspan="2"| 0x14
  | Float
+
|rowspan="2"| Play
  | 1 is 100%, can be more
+
|rowspan="2"| Client
 +
| Item ID
 +
  | VarInt
 +
  | Numeric ID of the item to apply a cooldown to.
 
  |-
 
  |-
  | Pitch
+
  | Cooldown Ticks
  | Unsigned Byte
+
  | VarInt
  | 63 is 100%, can be more
+
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
 
  |}
 
  |}
  
==== Particle ====
+
==== 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.
  
Displays the named particle
+
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"
 
{| class="wikitable"
Line 2,017: Line 1,980:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="11"| 0x2A
+
  |rowspan="2"| 0x15
  |rowspan="11"| Play
+
  |rowspan="2"| Play
  |rowspan="11"| Client
+
  |rowspan="2"| Client
  | Particle ID
+
  | Channel
  | Int
+
| Identifier
  | See below
+
| Name of the [[plugin channel]] used to send the data.
 +
|-
 +
| Data
 +
| Byte Array
 +
  | Any data.
 +
  |}
 +
 
 +
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}}
 +
 
 +
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Long Distance
+
  |rowspan="8"| 0x16
  | Boolean
+
|rowspan="8"| Play
  | If true, particle distance increases from 256 to 65536
+
|rowspan="8"| Client
 +
| Sound Name
 +
  | Identifier
 +
  | All sound effect names can be seen [https://pokechu22.github.io/Burger/1.19.html#sounds here].
 
  |-
 
  |-
  | X
+
  | Sound Category
  | Float
+
  | VarInt Enum
  | X position of the particle
+
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories]).
 
  |-
 
  |-
  | Y
+
  | Effect Position X
  | Float
+
  | Int
  | Y position of the particle
+
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | Z
+
  | Effect Position Y
  | Float
+
  | Int
  | Z position of the particle
+
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | Offset X
+
  | Effect Position Z
  | Float
+
  | Int
  | This is added to the X position after being multiplied by random.nextGaussian()
+
  | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | Offset Y
+
  | Volume
 
  | Float
 
  | Float
  | This is added to the Y position after being multiplied by random.nextGaussian()
+
  | 1 is 100%, can be more.
 
  |-
 
  |-
  | Offset Z
+
  | Pitch
 
  | Float
 
  | Float
  | This is added to the Z position after being multiplied by random.nextGaussian()
+
  | Float between 0.5 and 2.0 by Notchian clients.
 
  |-
 
  |-
  | Particle Data
+
  | Seed
  | Float
+
  | long
  | The data of each particle
+
  | Seed used to pick sound variant.
|-
 
| Particle Count
 
| Int
 
| The number of particles to create
 
|-
 
| Data
 
| Array of VarInt
 
| Length depends on particle. "iconcrack" has length of 2, "blockcrack", and "blockdust" have lengths of 1, the rest have 0.
 
 
  |}
 
  |}
  
Particle IDs:
+
==== 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"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Particle Name
+
  | 0x17
  ! Particle ID
+
| Play
  |-
+
| Client
  | explode
+
| Reason
  | 0
+
  | [[Chat]]
 +
  | Displayed to the client when the connection terminates.
 +
  |}
 +
 
 +
==== Entity Event ====
 +
 
 +
Entity statuses generally trigger an animation for an entity. The available statuses vary by the entity's type (and are available to subclasses of that type as well).
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | largeexplosion
+
  |rowspan="2"| 0x18
  | 1
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| Int
 +
  |
 
  |-
 
  |-
  | hugeexplosion
+
  | Entity Status
  | 2
+
  | Byte Enum
 +
| See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
 +
|}
 +
 
 +
==== Explosion ====
 +
 
 +
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
 +
 
 +
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | fireworksSpark
+
  |rowspan="9"| 0x19
  | 3
+
|rowspan="9"| Play
 +
|rowspan="9"| Client
 +
| X
 +
| Double
 +
  |
 
  |-
 
  |-
  | bubble
+
  | Y
  | 4
+
| Double
 +
  |
 
  |-
 
  |-
  | splash
+
  | Z
  | 5
+
| Double
 +
  |
 
  |-
 
  |-
  | wake
+
  | Strength
  | 6
+
  | 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.
 
  |-
 
  |-
  | suspended
+
  | Record Count
  | 7
+
  | VarInt
 +
| Number of elements in the following array.
 
  |-
 
  |-
  | depthsuspend
+
  | Records
  | 8
+
  | Array of (Byte, Byte, Byte)
 +
| Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
 
  |-
 
  |-
  | crit
+
  | Player Motion X
  | 9
+
  | Float
 +
| X velocity of the player being pushed by the explosion.
 
  |-
 
  |-
  | magicCrit
+
  | Player Motion Y
  | 10
+
  | Float
 +
| Y velocity of the player being pushed by the explosion.
 
  |-
 
  |-
  | smoke
+
  | Player Motion Z
  | 11
+
  | Float
 +
| Z velocity of the player being pushed by the explosion.
 +
|}
 +
 
 +
==== Unload Chunk ====
 +
 
 +
Tells the client to unload a chunk column.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | largesmoke
+
  |rowspan="2"| 0x1A
  | 12
+
|rowspan="2"| Play
  |-
+
  |rowspan="2"| Client
  | spell
+
  | Chunk X
  | 13
+
  | Int
 +
  | Block coordinate divided by 16, rounded down.
 
  |-
 
  |-
  | instantSpell
+
  | Chunk Z
  | 14
+
  | Int
 +
| Block coordinate divided by 16, rounded down.
 +
|}
 +
 
 +
It is legal to send this packet even if the given chunk is not currently loaded.
 +
 
 +
==== Game Event ====
 +
 
 +
Used for a wide variety of game events, from weather to bed use to gamemode to demo messages.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | mobSpell
+
  |rowspan="2"| 0x1B
  | 15
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Event
 +
| Unsigned Byte
 +
  | See below.
 
  |-
 
  |-
  | mobSpellAmbient
+
  | Value
  | 16
+
  | Float
 +
| Depends on Reason.
 +
|}
 +
 
 +
''Events'':
 +
 
 +
{| class="wikitable"
 +
! Event
 +
! Effect
 +
! Value
 
  |-
 
  |-
  | witchMagic
+
  | 0
  | 17
+
  | No respawn block available
 +
| Note: Sends message 'block.minecraft.spawn.not_valid'(You have no home bed or charged respawn anchor, or it was obstructed) to the client.
 
  |-
 
  |-
  | dripWater
+
  | 1
  | 18
+
| End raining
 +
  |
 
  |-
 
  |-
  | dripLava
+
  | 2
  | 19
+
| Begin raining
 +
  |
 
  |-
 
  |-
  | angryVillager
+
  | 3
  | 20
+
  | Change gamemode
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
 
  |-
 
  |-
  | happyVillager
+
  | 4
  | 21
+
  | 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.
 
  |-
 
  |-
  | townaura
+
  | 5
  | 22
+
  | 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.
 
  |-
 
  |-
  | note
+
  | 6
  | 23
+
  | Arrow hit player
 +
| Note: Sent when any player is struck by an arrow.
 
  |-
 
  |-
  | portal
+
  | 7
  | 24
+
  | Rain level change
 +
| Note: Seems to change both skycolor and lightning.<br>Rain level starting from 0 to 1.
 
  |-
 
  |-
  | enchantmenttable
+
  | 8
  | 25
+
  | 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.
 
  |-
 
  |-
  | flame
+
  | 9
  | 26
+
  | Play pufferfish sting sound.
 
  |-
 
  |-
  | lava
+
  | 10
  | 27
+
| Play elder guardian mob appearance (effect and sound).
 +
  |
 
  |-
 
  |-
  | footstep
+
  | 11
  | 28
+
  | Enable respawn screen
  |-
+
  |  0: Enable respawn screen, 1: Immediately respawn (sent when the doImmediateRespawn gamerule changes).
| cloud
 
| 29
 
|-
 
| reddust
 
| 30
 
  |-
 
| snowballpoof
 
| 31
 
|-
 
| snowshovel
 
| 32
 
|-
 
| slime
 
| 33
 
|-
 
| heart
 
| 34
 
|-
 
| barrier
 
| 35
 
|-
 
| iconcrack_(id)_(data)
 
| 36
 
|-
 
| blockcrack_(id+(data<<12))
 
| 37
 
|-
 
| blockdust_(id)
 
| 38
 
|-
 
| droplet
 
| 39
 
|-
 
| take
 
| 40
 
|-
 
| mobappearance
 
| 41
 
 
  |}
 
  |}
  
==== Change Game State ====
+
==== Open Horse Screen ====
  
It appears when a bed can't be used as a spawn point and when the rain state changes.
+
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,211: Line 2,258:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x2B
+
  |rowspan="3"| 0x1C
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Reason
+
  | Window ID
 
  | Unsigned Byte
 
  | Unsigned Byte
  | See below
+
  |
 
  |-
 
  |-
  | Value
+
  | Slot count
  | Float
+
  | VarInt
  | Depends on Reason
+
  |
|}
 
 
 
''Reason codes'':
 
 
 
{| class="wikitable"
 
! Reason
 
! Effect
 
! Value
 
 
  |-
 
  |-
  | 0
+
  | Entity ID
  | Invalid Bed
+
  | Integer
  |  
+
  |
|-
 
| 1
 
| End raining
 
|
 
|-
 
| 2
 
| Begin raining
 
|
 
|-
 
| 3
 
| Change game mode
 
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 
|-
 
| 4
 
| Enter credits
 
|
 
|-
 
| 5
 
| Demo message
 
| 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
 
|-
 
| 6
 
| Arrow hitting player
 
| Appears to be played when an arrow strikes another player in Multiplayer
 
|-
 
| 7
 
| Fade value
 
| The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
 
|-
 
| 8
 
| Fade time
 
| Time in ticks for the sky to fade
 
|-
 
| 10
 
| Play mob appearance (effect and sound)
 
| Unknown
 
 
  |}
 
  |}
  
==== Spawn Global Entity ====
+
==== Initialize World Border ====
 
 
With this packet, the server notifies the client of thunderbolts striking within a 512 block radius around the player. The coordinates specify where exactly the thunderbolt strikes.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,283: Line 2,284:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x2C
+
  |rowspan="8"| 0x1D
  |rowspan="5"| Play
+
  |rowspan="8"| Play
  |rowspan="5"| Client
+
  |rowspan="8"| Client
  | Entity ID
+
  | X
  | VarInt
+
  | Double
  | The EID of the thunderbolt
+
  |
 
  |-
 
  |-
  | Type
+
  | Z
  | Byte
+
  | Double
  | The global entity type, currently always 1 for thunderbolt
+
  |
 +
|-
 +
| Old Diameter
 +
| Double
 +
| Current length of a single side of the world border, in meters.
 +
|-
 +
| New Diameter
 +
| Double
 +
| Target length of a single side of the world border, in meters.
 +
|-
 +
| Speed
 +
| VarLong
 +
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 +
|-
 +
| Portal Teleport Boundary
 +
| VarInt
 +
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 
  |-
 
  |-
  | X
+
  | Warning Blocks
  | Int
+
  | VarInt
  | Thunderbolt X, a [[Data Types#Fixed-point numbers|fixed-point number]]
+
  | In meters.
 
  |-
 
  |-
  | Y
+
  | Warning Time
  | Int
+
  | VarInt
  | Thunderbolt Y, a [[Data Types#Fixed-point numbers|fixed-point number]]
+
  | In seconds as set by <code>/worldborder warning time</code>.
 
  |-
 
  |-
| Z
 
| Int
 
| Thunderbolt Z, a [[Data Types#Fixed-point numbers|fixed-point number]]
 
 
  |}
 
  |}
  
==== Open Window ====
+
The Notchian client determines how solid to display the warning by comparing to whichever is higher, the warning distance or whichever is lower, the distance from the current diameter to the target diameter or the place the border will be after warningTime seconds. In pseudocode:
 +
 
 +
<syntaxhighlight lang="java">
 +
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 +
if (playerDistance < distance) {
 +
    warning = 1.0 - playerDistance / distance;
 +
} else {
 +
    warning = 0.0;
 +
}
 +
</syntaxhighlight>
 +
 
 +
==== Keep Alive (clientbound) ====
 +
 
 +
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same payload (see [[#Keep Alive (serverbound)|serverbound Keep Alive]]). If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
  
This 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.
+
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,319: Line 2,346:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x2D
+
  | 0x1E
  |rowspan="5"| Play
+
  | Play
  |rowspan="5"| Client
+
  | Client
  | Window ID
+
  | Keep Alive ID
  | Unsigned Byte
+
  | Long
  | A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
+
  |
  |-
+
  |}
| Window Type
+
 
| String
+
==== Chunk Data and Update Light ====
| The window type to use for display. See [[Inventory]] for a list.
+
{{Main|Chunk Format}}
|-
+
{{See also|#Unload Chunk}}
| Window Title
+
 
| [[Chat]]
+
{{Need Info|How do biomes work now? The biome change happened at the same time as the seed change, but it's not clear how/if biomes could be computed given that it's not the actual seed... ([https://www.reddit.com/r/Mojira/comments/e5at6i/a_discussion_for_the_changes_to_how_biomes_are/ /r/mojira discussion] which notes that it seems to be some kind of interpolation, and 3D biomes are only used in the nether)}}
  | The title of the window
+
 
|-
+
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).
| Number Of Slots
+
 
| Unsigned Byte
+
{| class="wikitable"
  | Number of slots in the window (excluding the number of slots in the player inventory)
+
  ! Packet ID
|-
 
| Entity ID
 
| Optional Int
 
| EntityHorse's EID. Only sent when Window Type is “EntityHorse”
 
  |}
 
 
 
See [[Inventory]] for further information.
 
 
 
==== Close Window ====
 
 
 
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
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x2E
+
  |rowspan="25"| 0x1F
  |rowspan="1"| Play
+
  |rowspan="25"| Play
  |rowspan="1"| Client
+
  |rowspan="25"| Client
  | Window ID
+
  |colspan="2"| Chunk X
  | Unsigned Byte
+
  |colspan="2"| Int
| This is the ID of the window that was closed. 0 for inventory.
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
  |}
 
 
 
==== Set Slot ====
 
 
 
Sent by the server when an item in a slot (in a window) is added/removed.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x2F
+
  |colspan="2"| Chunk Z
  |rowspan="3"| Play
+
|colspan="2"| Int
  |rowspan="3"| Client
+
| Chunk coordinate (block coordinate divided by 16, rounded down)
  | Window ID
+
|-
 +
|colspan="2"| Heightmaps
 +
|colspan="2"| [[NBT]]
 +
| Compound containing one long array named <code>MOTION_BLOCKING</code>, which is a heightmap for the highest solid block at each position in the chunk (as a compacted long array with 256 entries, 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"| Size
 +
|colspan="2"| VarInt
 +
| Size of Data in bytes
 +
|-
 +
|colspan="2"| Data
 +
|colspan="2"| Byte array
 +
| See [[Chunk Format#Data structure|data structure]] in Chunk Format
 +
|-
 +
|colspan="2"| Number of block entities
 +
  |colspan="2"| VarInt
 +
| Number of elements in the following array
 +
|-
 +
  |rowspan="4" | Block Entity
 +
| Packed XZ
 +
  |rowspan="4" | Array
 
  | Byte
 
  | 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).
+
  | The packed section coordinates, calculated from <code><nowiki>((blockX & 15) << 4) | (blockZ & 15)</nowiki></code>
 
  |-
 
  |-
  | Slot
+
  | Y
 
  | Short
 
  | Short
  | The slot that should be updated
+
  | The height relative to the world
 
  |-
 
  |-
  | Slot Data
+
  | Type
  | [[Slot Data|Slot]]
+
| VarInt
  |  
+
| The type of block entity
 +
|-
 +
| Data
 +
  | [[NBT]]
 +
  | The block entity's data, without the X, Y, and Z values
 +
|-
 +
|colspan="2"| Trust Edges
 +
|colspan="2"| Boolean
 +
| If edges should be trusted for light updates.
 +
|-
 +
|colspan="2"| Sky Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Sky Light array below.  The least significant bit is for blocks 16 blocks to 1 block below the min world height (one section below the world), while the most significant bit covers blocks 1 to 16 blocks above the max world height (one section above the world).
 +
|-
 +
|colspan="2"| Block Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Block Light array below.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Empty Sky Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Sky Light data.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Empty Block Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Block Light data.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Sky Light array count
 +
|colspan="2"| VarInt
 +
| Number of entries in the following array; should match the number of bits set in Sky Light Mask
 +
|-
 +
|rowspan="2"| Sky Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Sky Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the sky light mask, starting with the lowest value.  Half a byte per light value. Indexed <code><nowiki>((y<<8) | (z<<4) | x) / 2 </nowiki></code> If there's a remainder, masked 0xF0 else 0x0F.
 +
|-
 +
|colspan="2"| Block Light array count
 +
|colspan="2"| VarInt
 +
| Number of entries in the following array; should match the number of bits set in Block Light Mask
 +
|-
 +
|rowspan="2"| Block Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Block Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the block light mask, starting with the lowest value.  Half a byte per light value. Indexed <code><nowiki>((y<<8) | (z<<4) | x) / 2 </nowiki></code> If there's a remainder, masked 0xF0 else 0x0F.
 
  |}
 
  |}
  
To set the curser (the item currently dragged with the mouse), use -1 as Window ID and as Slot
+
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.
  
==== Window Items ====
+
The compacted array format has been adjusted so that individual entries no longer span across multiple longs, affecting the main data array and heightmaps.
  
[[File:Inventory-slots.png|thumb|The inventory slots]]
+
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>
  
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.
+
<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>
 +
 
 +
==== World Event ====
 +
Sent when a client is to play a sound or particle effect.
 +
 
 +
By default, the Minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1023 (wither spawn), effect 1028 (enderdragon death), and effect 1038 (end portal opening); it is ignored on other effects.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,411: Line 2,486:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x30
+
  |rowspan="4"| 0x20
  |rowspan="3"| Play
+
  |rowspan="4"| Play
  |rowspan="3"| Client
+
  |rowspan="4"| Client
  | Window ID
+
  | Event
  | Unsigned Byte
+
  | Int
  | The ID of window which items are being sent for. 0 for player inventory.
+
  | The event, see below.
 +
|-
 +
| Location
 +
| Position
 +
| The location of the event.
 
  |-
 
  |-
  | Count
+
  | Data
  | Short
+
  | Int
  | Number of elements in the following array
+
  | Extra data for certain events, see below.
 
  |-
 
  |-
  | Slot Data
+
  | Disable Relative Volume
  | Array of [[Slot Data|Slot]]
+
  | Boolean
  |  
+
  | See above.
 
  |}
 
  |}
  
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
+
Events:
 
 
==== Window Property ====
 
 
 
This packet is used to inform the client that part of a GUI window should be updated.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Name
! Bound To
+
  ! Data
! Field Name
 
  ! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x31
+
  !colspan="3"| Sound
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Window ID
 
| Unsigned Byte
 
|
 
 
  |-
 
  |-
  | Property
+
  | 1000
  | Short
+
  | Dispenser dispenses
  | The property to be updated, see below
+
  |
 +
|-
 +
| 1001
 +
| Dispenser fails to dispense
 +
|
 
  |-
 
  |-
  | Value
+
  | 1002
  | Short
+
  | Dispenser shoots
  | 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"
 
 
  |-
 
  |-
  ! Window type
+
  | 1003
  ! Property
+
  | Ender eye launched
  ! Value
+
  |
 
  |-
 
  |-
  |rowspan="2"| Furnace
+
  | 1004
  | 0: Progress arrow
+
  | Firework shot
  | 0–200 (presumably in in-game ticks)
+
  |
 
  |-
 
  |-
  | 1: Fire icon (fuel)
+
  | 1005
  | 0–200 (presumably in in-game ticks)
+
| Iron door opened
 +
  |
 
  |-
 
  |-
  |rowspan="7"| Enchantment Table
+
  | 1006
  | 0: Level requirement for top enchantment slot
+
  | Wooden door opened
  |rowspan="3"| The enchantment's xp level requirement
+
  |
 
  |-
 
  |-
  | 1: Level requirement for middle enchantment slot
+
  | 1007
 +
| Wooden trapdoor opened
 +
|
 
  |-
 
  |-
  | 2: Level requirement for bottom enchantment slot
+
  | 1008
 +
| Fence gate opened
 +
|
 
  |-
 
  |-
  | 3: The seed for generating the enchantments view for the client
+
  | 1009
  | Unknown
+
| Fire extinguished
 +
  |
 
  |-
 
  |-
  | 4: tooltip shown on mouse hover over top enchantment slot
+
  | 1010
  |rowspan="3"| Unknown (set to -1 to hide it)
+
  | Play record
 +
| Special case, see below for more info.
 
  |-
 
  |-
  | 5: tooltip shown on mouse hover over middle enchantment slot
+
  | 1011
 +
| Iron door closed
 +
|
 
  |-
 
  |-
  | 6: tooltip shown on mouse hover over bottom enchantment slot
+
  | 1012
 +
| Wooden door closed
 +
|
 
  |-
 
  |-
  |rowspan="3"| Beacon
+
  | 1013
  | 0: Power level
+
  | Wooden trapdoor closed
  | Unknown
+
  |
 
  |-
 
  |-
  | 1: First potion effect
+
  | 1014
  | Unknown
+
| Fence gate closed
 +
  |
 
  |-
 
  |-
  | 2: Second potion effect
+
  | 1015
  | Unknown
+
| Ghast warns
 +
  |
 
  |-
 
  |-
  | Anvil
+
  | 1016
  | 0: Repair cost
+
  | Ghast shoots
  | The repair's cost in xp levels
+
  |
 
  |-
 
  |-
  | Brewing Stand
+
  | 1017
  | 0: Brew time
+
  | Enderdragon shoots
  | 0–400, with 400 making the arrow empty, and 0 making the arrow full
+
  |
  |}
+
  |-
 
+
| 1018
==== Confirm Transaction ====
+
  | Blaze shoots
 
+
  |
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag).
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x32
+
  | 1019
|rowspan="3"| Play
+
  | Zombie attacks wood door
|rowspan="3"| Client
+
  |
| Window ID
 
  | Byte
 
  | The ID of the window that the action occurred in
 
 
  |-
 
  |-
  | Action Number
+
  | 1020
  | Short
+
  | Zombie attacks iron door
  | Every action that is to be accepted has a unique number. This field corresponds to that number.
+
  |
 
  |-
 
  |-
  | Accepted
+
  | 1021
  | Boolean
+
  | Zombie breaks wood door
  | Whether the action was accepted
+
  |
|}
 
 
 
==== Update Sign ====
 
 
 
This message is sent from the server to the client whenever a sign is discovered or created. This message is NOT sent when a sign is destroyed or unloaded.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x33
+
  | 1022
|rowspan="5"| Play
+
  | Wither breaks block
|rowspan="5"| Client
+
  |
| Location
 
  | Position
 
  |  
 
 
  |-
 
  |-
  | Line 1
+
  | 1023
  | [[Chat]]
+
  | Wither spawned
  | First line of text in the sign
+
  |
 
  |-
 
  |-
  | Line 2
+
  | 1024
  | [[Chat]]
+
  | Wither shoots
  | Second line of text in the sign
+
  |
 
  |-
 
  |-
  | Line 3
+
  | 1025
  | [[Chat]]
+
  | Bat takes off
  | Third line of text in the sign
+
  |
 
  |-
 
  |-
  | Line 4
+
  | 1026
  | [[Chat]]
+
  | Zombie infects
  | Fourth line of text in the sign
+
  |
  |}
+
  |-
 
+
| 1027
==== Map ====
+
  | Zombie villager converted
 
+
  |
Updates a rectangular area on a map.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
  ! Bound To
 
!colspan="2"| Field Name
 
  !colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="12"| 0x34
+
  | 1028
|rowspan="12"| Play
+
  | Ender dragon death
|rowspan="12"| Client
+
  |
  |colspan="2"| Item Damage
 
|colspan="2"| VarInt
 
  | The damage value (map ID) of the map being modified
 
 
  |-
 
  |-
  |colspan="2"| Scale
+
  | 1029
|colspan="2"| Byte
+
  | Anvil destroyed
|
+
  |
|-
 
|colspan="2"| Icon Count
 
  |colspan="2"| VarInt
 
  | Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  | 1030
| Direction And Type
+
  | Anvil used
|rowspan="3"| Array
+
  |
  | Byte
 
  | 0xF0 = Direction, 0x0F = Type
 
 
  |-
 
  |-
  | X
+
  | 1031
  | Byte
+
  | Anvil landed
  |  
+
  |
 
  |-
 
  |-
  | Z
+
  | 1032
  | Byte
+
  | Portal travel
  |  
+
  |
|-
 
|colspan="2"| Columns
 
|colspan="2"| Byte
 
| Number of columns updated
 
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | 1033
  |colspan="2"| Optional Byte
+
  | Chorus flower grown
  | Only if Columns is more than 0; number of rows updated
+
  |
 
  |-
 
  |-
  |colspan="2"| X
+
  | 1034
  |colspan="2"| Optional Byte
+
  | Chorus flower died
  | Only if Columns is more than 0; x offset of the westernmost column
+
  |
 
  |-
 
  |-
  |colspan="2"| Z
+
  | 1035
  |colspan="2"| Optional Byte
+
  | Brewing stand brewed
  | Only if Columns is more than 0; z offset of the northernmost row
+
  |
 
  |-
 
  |-
  |colspan="2"| Length
+
  | 1036
  |colspan="2"| Optional VarInt
+
  | Iron trapdoor opened
  | Only if Columns is more than 0; length of the following array
+
  |
 
  |-
 
  |-
  |colspan="2"| Data
+
  | 1037
  |colspan="2"| Optional Array of Unsigned Byte
+
| Iron trapdoor closed
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
+
  |
  |}
+
|-
 
+
  | 1038
==== Update Block Entity ====
+
| End portal created in overworld
 
+
  |
Essentially a block update on a block entity.
+
|-
 
+
| 1039
{| class="wikitable"
+
| Phantom bites
  ! Packet ID
+
|
  ! State
+
|-
  ! Bound To
+
| 1040
  ! Field Name
+
  | Zombie converts to drowned
  ! Field Type
+
  |
  ! Notes
+
  |-
 +
  | 1041
 +
  | Husk converts to zombie by drowning
 +
  |
 
  |-
 
  |-
  |rowspan="3"| 0x35
+
  | 1042
|rowspan="3"| Play
+
  | Grindstone used
|rowspan="3"| Client
+
  |
| Location
 
  | Position
 
  |  
 
 
  |-
 
  |-
  | Action
+
  | 1043
  | Unsigned Byte
+
  | Book page turned
  | The type of update to perform, see below
+
  |
 
  |-
 
  |-
| NBT Data
 
| Optional [[NBT|NBT Tag]]
 
| If not present then it's a TAG_END (0)
 
|}
 
 
''Action'' field:
 
 
* '''1''': Set SpawnPotentials of a mob spawner
 
* '''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
 
 
==== Open Sign Editor ====
 
 
Sent on placement of sign.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
|rowspan="1"| 0x36
+
  !colspan="3"| Particle
|rowspan="1"| Play
 
|rowspan="1"| Client
 
| Location
 
| Position
 
|
 
|}
 
 
 
==== Statistics ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
  !colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x37
+
  | 1500
|rowspan="3"| Play
+
  | Composter composts
|rowspan="3"| Client
+
  |
  |colspan="2"| Count
 
|colspan="2"| VarInt
 
  | Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="2"| Statistic
+
  | 1501
| Name
+
  | Lava converts block (either water to stone, or removes existing blocks such as torches)
|rowspan="2"| Array
+
  |
  | String
 
  | [https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0 https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0]
 
 
  |-
 
  |-
  | Value
+
  | 1502
  | VarInt
+
  | Redstone torch burns out
  | The amount to set it to
+
  |
|}
 
 
 
==== Player List Item ====
 
 
 
Sent by the notchian server to update the user list (<tab> in the client).
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="4"| Field Name
 
!colspan="3"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="19"| 0x38
+
  | 1503
|rowspan="19"| Play
+
  | Ender eye placed
|rowspan="19"| Client
+
  |
  |colspan="4"| Action
 
|colspan="3"| VarInt
 
  | Determines the rest of the Player format after the UUID
 
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  | 2000
  |colspan="3"| VarInt
+
  | Spawns 10 smoke particles, e.g. from a fire
  | Number of elements in the following array
+
  | Direction, see below.
 
  |-
 
  |-
  |rowspan="17"| Player
+
  | 2001
|colspan="3"| UUID
+
  | Block break + block break sound
  |rowspan="17"| Array
+
  | Block state, as an index into the global palette.
|colspan="2"| UUID
 
  |  
 
 
  |-
 
  |-
  ! Action
+
  | 2002
  !colspan="2"| Field Name
+
  | Splash potion. Particle effect + glass break sound.
  !colspan="2"|  
+
  | RGB color as an integer (e.g. 8364543 for #7FA1FF).
!
 
 
  |-
 
  |-
  |rowspan="10"| 0: add player
+
  | 2003
|colspan="2"| Name
+
  | Eye of Ender entity break animation — particles and sound
  |colspan="2"| String
+
  |
  |  
 
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | 2004
  |colspan="2"| VarInt
+
  | Mob spawn particle effect: smoke + flames
  | Number of elements in the following array
+
  |
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | 2005
| Name
+
  | Bonemeal particles
|rowspan="4"| Array
+
  | How many particles to spawn (if set to 0, 15 are spawned).
  | String
 
  |  
 
 
  |-
 
  |-
  | Value
+
  | 2006
  | String
+
  | Dragon breath
|
+
  |
|-
 
| Is Signed
 
| Boolean
 
  |  
 
 
  |-
 
  |-
  | Signature
+
  | 2007
  | Optional String
+
  | Instant splash potion. Particle effect + glass break sound.
  | Only if Is Signed is true
+
  | RGB color as an integer (e.g. 8364543 for #7FA1FF).
 
  |-
 
  |-
  |colspan="2"| Gamemode
+
  | 2008
  |colspan="2"| VarInt
+
  | Ender dragon destroys block
  |  
+
  |
 
  |-
 
  |-
  |colspan="2"| Ping
+
  | 2009
  |colspan="2"| VarInt
+
  | Wet sponge vaporizes in nether
  |  
+
  |
 
  |-
 
  |-
  |colspan="2"| Has Display Name
+
  | 3000
  |colspan="2"| Boolean
+
  | End gateway spawn
  |  
+
  |
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | 3001
  |colspan="2"| Optional [[Chat]]
+
  | Enderdragon growl
  | Only if Has Display Name is true
+
  |
 
  |-
 
  |-
  | 1: update gamemode
+
  | 3002
  |colspan="2"| Gamemode
+
  | Electric spark
|colspan="2"| VarInt
+
  |
|
 
|-
 
| 2: update latency
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
  |  
 
 
  |-
 
  |-
  |rowspan="2"| 3: update display name
+
  | 3003
|colspan="2"| Has Display Name
+
  | Copper apply wax
  |colspan="2"| Boolean
+
  |
  |  
 
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | 3004
  |colspan="2"| Optional [[Chat]]
+
  | Copper remove wax
  | Only send if Has Display Name is true
+
  |
 
  |-
 
  |-
  | 4: remove player
+
  | 3005
  |colspan="2"| ''no fields''
+
  | Copper scrape oxidation
|colspan="2"| ''no fields''
+
  |
  |  
 
 
  |}
 
  |}
  
==== Player Abilities ====
+
Smoke directions:
 
 
The latter 2 floats are used to indicate the walking and flying speeds respectively, while the first byte is used to determine the value of 4 booleans.
 
 
 
The flags are whether damage is disabled (god mode, 8, bit 3), whether the player can fly (4, bit 2), whether the player is flying (2, bit 1), and whether the player is in creative mode (1, bit 0).
 
 
 
To get the values of these booleans, simply AND (&) the byte with 1,2,4 and 8 respectively, to get the 0 or 1 bitwise value. To set them OR (|) them with their repspective masks.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Direction
  ! Bound To
+
  |-
  ! Field Name
+
| 0
  ! Field Type
+
| Down
  ! Notes
+
|-
 +
| 1
 +
| Up
 +
  |-
 +
  | 2
 +
  | North
 
  |-
 
  |-
  |rowspan="3"| 0x39
+
  | 3
|rowspan="3"| Play
+
  | South
|rowspan="3"| Client
 
| Flags
 
| Byte
 
  | Bit mask, see above
 
 
  |-
 
  |-
  | Flying Speed
+
  | 4
| Float
+
  | West
  |  
 
 
  |-
 
  |-
  | Walking Speed
+
  | 5
| Float
+
  | East
  |  
 
 
  |}
 
  |}
  
==== Tab-Complete ====
+
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.
  
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.
+
==== Particle ====
 +
 
 +
Displays the named particle
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,870: Line 2,814:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  |rowspan="12"| 0x21
  |rowspan="2"| Play
+
  |rowspan="12"| Play
  |rowspan="2"| Client
+
  |rowspan="12"| Client
  | Count
+
  | Particle ID
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array
+
  | The particle ID listed in [[#Particle|the particle data type]].
 
  |-
 
  |-
  | Matches
+
  | Long Distance
  | Array of String
+
  | Boolean
  | One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
| If true, particle distance increases from 256 to 65536.
 +
|-
 +
| X
 +
| Double
 +
| X position of the particle.
 +
|-
 +
| Y
 +
| Double
 +
| Y position of the particle.
 +
|-
 +
| Z
 +
| Double
 +
| Z position of the particle.
 +
|-
 +
| Offset X
 +
| Float
 +
| This is added to the X position after being multiplied by <code>random.nextGaussian()</code>.
 +
|-
 +
| Offset Y
 +
| Float
 +
| This is added to the Y position after being multiplied by <code>random.nextGaussian()</code>.
 +
|-
 +
  | Offset Z
 +
| Float
 +
| This is added to the Z position after being multiplied by <code>random.nextGaussian()</code>.
 +
|-
 +
| Max Speed
 +
| Float
 +
|
 +
|-
 +
| Particle Count
 +
| Int
 +
| The number of particles to create.
 +
|-
 +
| Data
 +
| Varies
 +
| The variable data listed in [[#Particle|the particle data type]].
 
  |}
 
  |}
  
==== Scoreboard Objective ====
+
==== Update Light ====
  
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
+
Updates light levels for a chunk.  See {{Minecraft Wiki|Light}} for information on how lighting works in Minecraft.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,890: Line 2,870:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x3B
+
  |rowspan="13"| 0x22
  |rowspan="4"| Play
+
  |rowspan="13"| Play
  |rowspan="4"| Client
+
  |rowspan="13"| Client
  | Objective Name
+
  |colspan="2"| Chunk X
  | String
+
  |colspan="2"| VarInt
  | An unique name for the objective
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | Mode
+
  |colspan="2"| Chunk Z
  | Byte
+
  |colspan="2"| VarInt
  | 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | Objective Value
+
  |colspan="2"| Trust Edges
  | Optional String
+
  |colspan="2"| Boolean
  | Only if mode is 0 or 2. The text to be displayed for the score
+
  | If edges should be trusted for light updates.
 
  |-
 
  |-
  | Type
+
  |colspan="2"| Sky Light Mask
  | Optional String
+
  |colspan="2"| BitSet
  | Only if mode is 0 or 2. “integer” or “hearts”
+
  | BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Sky Light array below.  The least significant bit is for blocks 16 blocks to 1 block below the min world height (one section below the world), while the most significant bit covers blocks 1 to 16 blocks above the max world height (one section above the world).
 +
|-
 +
|colspan="2"| Block Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Block Light array below.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Empty Sky Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Sky Light data.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Empty Block Light Mask
 +
|colspan="2"| BitSet
 +
| BitSet containing bits for each section in the world + 2.  Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Block Light data.  The order of bits is the same as in Sky Light Mask.
 +
|-
 +
|colspan="2"| Sky Light array count
 +
|colspan="2"| VarInt
 +
| Number of entries in the following array; should match the number of bits set in Sky Light Mask
 +
|-
 +
|rowspan="2"| Sky Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Sky Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the sky light mask, starting with the lowest value.  Half a byte per light value.
 +
|-
 +
|colspan="2"| Block Light array count
 +
|colspan="2"| VarInt
 +
| Number of entries in the following array; should match the number of bits set in Block Light Mask
 +
|-
 +
|rowspan="2"| Block Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Block Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the block light mask, starting with the lowest value.  Half a byte per light value.
 
  |}
 
  |}
  
==== Update Score ====
+
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.
  
This is sent to the client when it should update a scoreboard item.  
+
==== Login (play) ====
 +
 
 +
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,926: Line 2,948:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x3C
+
  |rowspan="20"| 0x23
  |rowspan="4"| Play
+
  |rowspan="20"| Play
  |rowspan="4"| Client
+
  |rowspan="20"| Client
  | Score Name
+
  | Entity ID
  | String
+
  | Int
  | The name of the score to be updated or removed
+
  | The player's Entity ID (EID).
 +
|-
 +
| Is hardcore
 +
| Boolean
 +
|
 +
|-
 +
| Gamemode
 +
| Unsigned Byte
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
 
  |-
 
  |-
  | Action
+
  | Previous Gamemode
 
  | Byte
 
  | Byte
  | 0 to create/update an item. 1 to remove an item.
+
  | 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)
 +
|-
 +
| Dimension Count
 +
| VarInt
 +
| Size of the following array.
 +
|-
 +
| Dimension Names
 +
| Array of Identifier
 +
| Identifiers for all dimensions on the server.
 
  |-
 
  |-
  | Objective Name
+
  | Registry Codec
  | String
+
  | [[NBT|NBT Tag Compound]]
  | The name of the objective the score belongs to
+
  | Represents certain registries that are sent from the server and are applied on the client.
 
  |-
 
  |-
  | Value
+
  | Dimension Type
  | Optional VarInt
+
| Identifier
  | The score to be displayed next to the entry. Only sent when Action does not equal 1.
+
| 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.
 +
  |}
  
==== Display Scoreboard ====
 
  
This is sent to the client when it should display a scoreboard.
+
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="2"| 0x3D
+
  | minecraft:worldgen/biome
|rowspan="2"| Play
+
  | TAG_Compound
|rowspan="2"| Client
+
  | The biome registry (see below).
| Position
 
  | Byte
 
  | The position of the scoreboard. 0: list, 1: sidebar, 2: below name.
 
 
  |-
 
  |-
  | Score Name
+
  | minecraft:chat_type
  | String
+
  | TAG_Compound
  | The unique name for the scoreboard to be displayed.
+
  | The chat type registry (see below).
 
  |}
 
  |}
  
==== Teams ====
+
Dimension type registry:
 
 
Creates and updates teams.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  !Name
! State
+
  !Type
! Bound To
+
  !style="width: 250px;" colspan="2"| Notes
! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="10"| 0x3E
+
  | type
|rowspan="10"| Play
+
  | TAG_String
|rowspan="10"| Client
+
  | The name of the registry. Always "minecraft:dimension_type".
  | Team Name
 
  | String
 
| A unique name for the team. (Shared with scoreboard).
 
 
  |-
 
  |-
  | Mode
+
  | value
  | Byte
+
  | TAG_List
  | If 0 then the team is created.
+
  | List of dimension types registry entries (see below).
 +
|}
  
If 1 then the team is removed.
+
Dimension type registry entry:
  
If 2 the team team information is updated.  
+
{| class="wikitable"
 +
!Name
 +
!Type
 +
!style="width: 250px;" colspan="2"| Notes
 +
|-
 +
| name
 +
| TAG_String
 +
| The name of the dimension type (for example, "minecraft:overworld").
 +
|-
 +
| id
 +
| TAG_Int
 +
| The protocol ID of the dimension (matches the index of the element in the registry list).
 +
|-
 +
| element
 +
| TAG_Compound
 +
| The dimension type (see below).
 +
|}
  
If 3 then new players are added to the team.
+
Dimension type:
  
If 4 then players are removed from the team.
+
{| class="wikitable"
 +
! Name
 +
! Type
 +
!style="width: 250px;" colspan="2"| Meaning
 +
! Values
 
  |-
 
  |-
  | Team Display Name
+
  | piglin_safe
  | Optional String
+
| TAG_Byte
  | Only if Mode = 0 or 2.
+
|colspan="2"| Whether piglins shake and transform to zombified piglins.
 +
| 1: true, 0: false.
 +
|-
 +
| has_raids
 +
| TAG_Byte
 +
|colspan="2"| Whether players with the Bad Omen effect can cause a raid.
 +
| 1: true, 0: false.
 +
|-
 +
| monster_spawn_light_level
 +
| TAG_Int
 +
|colspan="2"|
 +
|
 +
|-
 +
| monster_spawn_block_light_limit
 +
| TAG_Int
 +
|colspan="2"|
 +
|
 +
|-
 +
| natural
 +
| TAG_Byte
 +
|colspan="2"| When false, compasses spin randomly. When true, nether portals can spawn zombified piglins.
 +
| 1: true, 0: false.
 +
|-
 +
| ambient_light
 +
| TAG_Float
 +
|colspan="2"| How much light the dimension has.
 +
| 0.0 to 1.0.
 +
|-
 +
| fixed_time
 +
  | Optional TAG_Long
 +
  |colspan="2"| If set, the time of the day is the specified value.
 +
| If set, 0 to 24000.
 +
|-
 +
| infiniburn
 +
| TAG_String
 +
|colspan="2"| A resource location defining what block tag to use for infiniburn.
 +
| "#" or minecraft resource "#minecraft:...".
 +
|-
 +
| respawn_anchor_works
 +
| TAG_Byte
 +
|colspan="2"| Whether players can charge and use respawn anchors.
 +
| 1: true, 0: false.
 +
|-
 +
| has_skylight
 +
| TAG_Byte
 +
|colspan="2"| Whether the dimension has skylight access or not.
 +
| 1: true, 0: false.
 +
|-
 +
| bed_works
 +
| TAG_Byte
 +
|colspan="2"| Whether players can use a bed to sleep.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | Team Prefix
+
  | effects
  | Optional String
+
  | TAG_String
  | Only if Mode = 0 or 2. Displayed before the players' name that are part of this team
+
  |colspan="2"| ?
 +
| "minecraft:overworld", "minecraft:the_nether", "minecraft:the_end" or something else.
 
  |-
 
  |-
  | Team Suffix
+
  | min_y
  | Optional String
+
  | TAG_Int
  | Only if Mode = 0 or 2. Displayed after the players' name that are part of this team
+
  |colspan="2"| The minimum Y level.
 +
| A multiple of 16. Example: -64
 
  |-
 
  |-
  | Friendly Fire
+
  | height
  | Optional Byte
+
  | TAG_Int
  | Only if Mode = 0 or 2. 0 for off, 1 for on, 3 for seeing friendly invisibles
+
  |colspan="2"| The maximum height.
 +
| A multiple of 16. Example: 256
 
  |-
 
  |-
  | Name Tag Visibility
+
  | logical_height
  | Optional String
+
  | TAG_Int
  | Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never
+
  |colspan="2"| The maximum height to which chorus fruits and nether portals can bring players within this dimension.
 +
| 0-384.
 
  |-
 
  |-
  | Color
+
  | coordinate_scale
  | Optional Byte
+
  | TAG_Double
  | Only if Mode = 0 or 2. Same as [[Chat]] colors
+
  |colspan="2"| The multiplier applied to coordinates when traveling to the dimension.
 +
| 0.00001 - 30000000.0
 
  |-
 
  |-
  | Player Count
+
  | ultrawarm
  | Optional VarInt
+
  | TAG_Byte
  | Only if Mode = 0 or 3 or 4. Number of players in the array
+
  |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.
 
  |-
 
  |-
  | Players
+
  | has_ceiling
  | Optional Array of String
+
  | TAG_Byte
  | Only if Mode = 0 or 3 or 4. Players to be added/remove from the team. Max 40 characters so may be uuid's later
+
  |colspan="2"| Whether the dimension has a bedrock ceiling or not. When true, causes lava to spread faster.
 +
| 1: true, 0: false.
 
  |}
 
  |}
  
==== Plugin Message ====
+
Biome registry:
  
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>.
+
{| class="wikitable"
 +
!Name
 +
!Type
 +
!style="width: 250px;" colspan="2"| Notes
 +
|-
 +
| type
 +
| TAG_String
 +
| The name of the registry. Always "minecraft:worldgen/biome".
 +
|-
 +
| value
 +
| TAG_List
 +
| List of biome registry entries (see below).
 +
|}
  
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/]
+
Biome registry entry:
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  !Name
  ! State
+
!Type
  ! Bound To
+
!style="width: 250px;" colspan="2"| Notes
  ! Field Name
+
|-
  ! Field Type
+
| name
  ! Notes
+
| TAG_String
 +
| The name of the biome (for example, "minecraft:ocean").
 +
|-
 +
| id
 +
| TAG_Int
 +
| The protocol ID of the biome (matches the index of the element in the registry list).
 +
|-
 +
| element
 +
| TAG_Compound
 +
| The biome properties (see below).
 +
|}
 +
 
 +
Biome properties:
 +
 
 +
{| class="wikitable"
 +
  !colspan="3"|Name
 +
  !colspan="2"|Type
 +
!style="width: 250px;" colspan="2"| Meaning
 +
!colspan="2"|Values
 +
|-
 +
|colspan="3"|precipitation
 +
|colspan="2"|TAG_String
 +
|colspan="2"| The type of precipitation in the biome.
 +
|colspan="2"|"rain", "snow", or "none".
 +
|-
 +
|colspan="3"| depth
 +
|colspan="2"| TAG_Float
 +
|colspan="2"| The depth factor of the biome.
 +
|colspan="2"| The default values vary between 1.5 and -1.8.
 +
|-
 +
|colspan="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.
 +
| ?
 +
|-
 +
| options
 +
| TAG_COMPOUND
 +
| 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
 
  |-
 
  |-
  |rowspan="2"| 0x3F
+
  | type
  |rowspan="2"| Play
+
  | TAG_String
  |rowspan="2"| Client
+
  | The name of the registry. Always "minecraft:chat_type".
| Channel
 
| String
 
| Name of the [[plugin channel]] used to send the data
 
 
  |-
 
  |-
  | Data
+
  | value
  | Byte Array
+
  | TAG_List
  | Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].
+
  | List of chat registry entries (see below).
 
  |}
 
  |}
  
==== Disconnect ====
+
==== Map Data ====
  
Sent by the server before it disconnects a client. The server assumes that the sender has already closed the connection by the time the packet arrives.
+
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,068: Line 3,362:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x40
+
  |rowspan="17"| 0x24
  |rowspan="1"| Play
+
  |rowspan="17"| Play
  |rowspan="1"| Client
+
  |rowspan="17"| Client
  | Reason
+
  |colspan="2"| Map ID
| [[Chat]]
+
  |colspan="2"| VarInt
  | Displayed to the client when the connection terminates.
+
  | Map ID of the map being modified
|}
 
 
 
==== 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"| 0x41
+
  |colspan="2"| Scale
  |rowspan="1"| Play
+
  |colspan="2"| Byte
|rowspan="1"| Client
+
  | From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
| Difficulty
 
| Unsigned Byte
 
  | 0: peaceful, 1: easy, 2: normal, 3: hard
 
|}
 
 
 
==== Combat Event ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x42
+
  |colspan="2"| Locked
  |rowspan="6"| Play
+
  |colspan="2"| Boolean
|rowspan="6"| Client
+
  | True if the map has been locked in a cartography table
| Event
 
| VarInt
 
  | 0: enter combat, 1: end combat, 2: entity dead
 
 
  |-
 
  |-
  | Duration
+
  |colspan="2"| Tracking Position
  | Optional VarInt
+
  |colspan="2"| Boolean
  | Only for end combat
+
  | Specifies whether player and item frame icons are shown
 
  |-
 
  |-
  | Player ID
+
  |colspan="2"| Icon Count
  | Optional VarInt
+
  |colspan="2"| VarInt
  | Only for entity dead
+
  | Number of elements in the following array. Only present if "Tracking Position" is true.
 +
|-
 +
|rowspan="6"| Icon
 +
| Type
 +
|rowspan="6"| Array
 +
| VarInt enum
 +
| See below
 +
|-
 +
| X
 +
| Byte
 +
| Map coordinates: -128 for furthest left, +127 for furthest right
 +
|-
 +
| Z
 +
| Byte
 +
| 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
 +
|-
 +
|colspan="2"| Columns
 +
|colspan="2"| Unsigned Byte
 +
| Number of columns updated
 +
|-
 +
|colspan="2"| Rows
 +
|colspan="2"| Optional Unsigned Byte
 +
| Only if Columns is more than 0; number of rows updated
 +
|-
 +
|colspan="2"| X
 +
|colspan="2"| Optional Byte
 +
| Only if Columns is more than 0; x offset of the westernmost column
 +
|-
 +
|colspan="2"| Z
 +
|colspan="2"| Optional Byte
 +
| Only if Columns is more than 0; z offset of the northernmost row
 
  |-
 
  |-
  | Entity ID
+
  |colspan="2"| Length
  | Optional Int
+
  |colspan="2"| Optional VarInt
  | Only for end combat and entity dead
+
  | Only if Columns is more than 0; length of the following array
 
  |-
 
  |-
  | Message
+
  |colspan="2"| Data
  | String
+
  |colspan="2"| Optional Array of Unsigned Byte
  | Only for entity dead
+
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
  |}
 
  |}
  
==== Camera ====
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
 +
 
 +
Types are based off of rows and columns in <code>map_icons.png</code>:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x43
+
  ! Icon type
  |rowspan="1"| Play
+
  ! Result
  |rowspan="1"| Client
+
  |-
  | Camera ID
+
  | 0
  | VarInt
+
  | White arrow (players)
|
 
|}
 
 
 
==== World Border ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="18"| 0x44
+
  | 1
|rowspan="18"| Play
+
  | Green arrow (item frames)
|rowspan="18"| Client
 
|colspan="2"| Action
 
| VarInt
 
  | Determines the format of the rest of the packet
 
 
  |-
 
  |-
  ! Action
+
  | 2
  ! Field Name
+
  | Red arrow
!
 
!
 
 
  |-
 
  |-
  | 0: set size
+
  | 3
  | Radius
+
  | Blue arrow
| Double
 
| meters
 
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
  | 4
| Old Radius
+
  | White cross
| Double
 
  | meters
 
 
  |-
 
  |-
  | New Radius
+
  | 5
  | Double
+
  | Red pointer
| meters
 
 
  |-
 
  |-
  | Speed
+
  | 6
  | VarLong
+
  | White circle (off-map players)
| number of real-time ticks/seconds (?) until New Radius is reached. From experiments, it appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag
 
 
  |-
 
  |-
  |rowspan="2"| 2: set center
+
  | 7
| X
+
  | Small white circle (far-off-map players)
| Double
 
  |  
 
 
  |-
 
  |-
  | Z
+
  | 8
  | Double
+
  | Mansion
  |  
+
  |-
 +
| 9
 +
| Temple
 
  |-
 
  |-
  |rowspan="8"| 3: initialize
+
  | 10
| X
+
  | White Banner
| Double
 
  |  
 
 
  |-
 
  |-
  | Z
+
  | 11
| Double
+
  | Orange Banner
  |  
 
 
  |-
 
  |-
  | Old Radius
+
  | 12
| Double
+
  | Magenta Banner
  |  
 
 
  |-
 
  |-
  | New Radius
+
  | 13
| Double
+
  | Light Blue Banner
  |  
 
 
  |-
 
  |-
  | Speed
+
  | 14
| VarLong
+
  | Yellow Banner
  |  
 
 
  |-
 
  |-
  | Portal Teleport Boundary
+
  | 15
  | VarInt
+
  | Lime Banner
| Resulting coordinates from a portal teleport are limited to +-value. Usually 29999984.
 
 
  |-
 
  |-
  | Warning Time
+
  | 16
| VarInt
+
  | Pink Banner
  |  
 
 
  |-
 
  |-
  | Warning Blocks
+
  | 17
| VarInt
+
  | Gray Banner
  |  
 
 
  |-
 
  |-
  |rowspan="1"| 4: set warning time
+
  | 18
| Warning Time
+
  | Light Gray Banner
| VarInt
 
  | unit?
 
 
  |-
 
  |-
  |rowspan="1"| 5: set warning blocks
+
  | 19
| Warning Blocks
+
  | Cyan Banner
| VarInt
 
|
 
|}
 
 
 
==== Title ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
  !colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="9"| 0x45
+
  | 20
|rowspan="9"| Play
+
  | Purple Banner
|rowspan="9"| Client
 
|colspan="2"| Action
 
| VarInt
 
  |  
 
 
  |-
 
  |-
  ! Action
+
  | 21
  ! Field Name
+
  | Blue Banner
!
 
!
 
 
  |-
 
  |-
  | 0: set title
+
  | 22
| Title Text
+
  | Brown Banner
| [[Chat]]
 
  |  
 
 
  |-
 
  |-
  | 1: set subtitle
+
  | 23
| Subtitle Text
+
  | Green Banner
| [[Chat]]
 
  |  
 
 
  |-
 
  |-
  |rowspan="3"| 2: set times and display
+
  | 24
| Fade In
+
  | Red Banner
| Int
 
  | ticks
 
 
  |-
 
  |-
  | Stay
+
  | 25
  | Int
+
  | Black Banner
| ticks
 
 
  |-
 
  |-
  | Fade Out
+
  | 26
| Int
+
  | Treasure marker
| ticks
 
|-
 
| 3: hide
 
| ''no fields''
 
| ''no fields''
 
|
 
|-
 
| 4: reset
 
| ''no fields''
 
| ''no fields''
 
  |  
 
 
  |}
 
  |}
  
“Hide” makes the title disappear, but if you run times again the same title will appear. “Reset” erases the text.
+
==== Merchant Offers ====
  
==== Set Compression ====
+
The list of trades a villager NPC is offering.
 
 
{{Warning|This packet is completely broken and will be removed in a future 1.9 snapshot, as announced by Grum in #mcdevs on 2015-11-09 20:00:34 UTC. The packet [[#Set Compression 2|Set Compression]] ([[#Login|Login]], 0x03, clientbound) should be used instead.}}
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,311: Line 3,539:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x46
+
  |rowspan="18"| 0x25
  |rowspan="1"| Play
+
  |rowspan="18"| Play
  |rowspan="1"| Client
+
  |rowspan="18"| Client
  | Threshold
+
  |-
  | VarInt
+
  | colspan="2" | Window ID
  | Packets of this size or higher ''may'' be compressed
+
| colspan="2" | VarInt
  |}
+
  | The ID of the window that is open; this is an int rather than a byte.
 
+
  |-
==== Player List Header And Footer ====
+
| colspan="2" | Size
 
+
| colspan="2" | Byte
{| class="wikitable"
+
| The number of trades in the following array.
  ! Packet ID
+
|-
  ! State
+
| rowspan="11" | Trades
  ! Bound To
+
| Input item 1
  ! Field Name
+
| rowspan="11" | Array
  ! Field Type
+
| [[Slot]]
  ! Notes
+
| 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).
 
  |-
 
  |-
  |rowspan="2"| 0x47
+
  |colspan="2"| Is regular villager
  |rowspan="2"| Play
+
  |colspan="2"| Boolean
  |rowspan="2"| Client
+
  | True if this is a regular villager; false for the wandering trader. When false, hides the villager level and some other GUI elements.
  | Header
 
| [[Chat]]
 
|
 
 
  |-
 
  |-
  | Footer
+
  |colspan="2"| Can restock
  | [[Chat]]
+
  |colspan="2"| Boolean
  |  
+
  | True for regular villagers and false for the wandering trader. If true, the "Villagers restock up to two times per day." message is displayed when hovering over disabled trades.
 
  |}
 
  |}
  
==== Resource Pack Send ====  
+
Modifiers can increase or decrease the number of items for the first input slot. The second input slot and the output slot never change the nubmer of items. The number of items may never be less than 1, and never more than the stack size. If special price and demand are both zero, only the default price is displayed. If either is non-zero, then the adjusted price is displayed next to the crossed-out default price. The adjusted prices is calculated as follows:
 +
 
 +
Adjusted price = default price + floor(default price x multiplier x demand) + special price
 +
 
 +
[[File:1.14-merchant-slots.png|thumb|The merchant UI, for reference]]
 +
{{-}}
 +
 
 +
==== Update Entity Position ====
 +
 
 +
This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Teleport Entity|Teleport Entity]] should be sent instead.
 +
 
 +
This packet allows at most 8 blocks movement in any direction, because short range is from -32768 to 32767. And <code>32768 / (128 * 32)</code> = 8.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,355: Line 3,640:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x48
+
  |rowspan="5"| 0x26
  |rowspan="2"| Play
+
  |rowspan="5"| Play
  |rowspan="2"| Client
+
  |rowspan="5"| Client
  | URL
+
  | Entity ID
  | String
+
  | VarInt
  | The URL to the resource pack.
+
  |
 +
|-
 +
| Delta X
 +
| Short
 +
| Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>.
 +
|-
 +
| Delta Y
 +
| Short
 +
| Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>.
 +
|-
 +
| Delta Z
 +
| Short
 +
| Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>.
 
  |-
 
  |-
  | Hash
+
  | On Ground
  | String
+
  | Boolean
  | 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
+
  |
 
  |}
 
  |}
  
==== Update Entity NBT ====  
+
==== Update Entity Position and Rotation ====
 +
 
 +
This packet is sent by the server when an entity rotates and moves. Since a short range is limited from -32768 to 32767, and movement is offset of fixed-point numbers, this packet allows at most 8 blocks movement in any direction. (<code>-32768 / (32 * 128) == -8</code>)
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,377: Line 3,676:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x49
+
  |rowspan="7"| 0x27
  |rowspan="2"| Play
+
  |rowspan="7"| Play
  |rowspan="2"| Client
+
  |rowspan="7"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  |  
+
  |
 
  |-
 
  |-
  | Tag
+
  | Delta X
  | [[NBT|NBT Tag]]
+
  | Short
  |  
+
| Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>.
 +
|-
 +
| Delta Y
 +
| Short
 +
| Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>.
 +
|-
 +
| Delta Z
 +
| Short
 +
| Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>.
 +
|-
 +
| Yaw
 +
| Angle
 +
| New angle, not a delta.
 +
|-
 +
| Pitch
 +
| Angle
 +
| New angle, not a delta.
 +
|-
 +
| On Ground
 +
| Boolean
 +
  |
 
  |}
 
  |}
  
=== Serverbound ===
+
==== Update Entity Rotation ====
  
==== Keep Alive ====
+
This packet is sent by the server when an entity rotates.
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,403: Line 3,720:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x00
+
  |rowspan="4"| 0x28
  |rowspan="1"| Play
+
  |rowspan="4"| Play
  |rowspan="1"| Server
+
  |rowspan="4"| Client
  | Keep Alive ID
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  |  
+
|
 +
|-
 +
| Yaw
 +
| Angle
 +
| New angle, not a delta.
 +
|-
 +
| Pitch
 +
| Angle
 +
| New angle, not a delta.
 +
|-
 +
| On Ground
 +
| Boolean
 +
  |
 
  |}
 
  |}
  
==== Chat Message ====
+
==== Move Vehicle (clientbound) ====
  
The default server will check the message to see if it begins with a '/'. If it doesn't, the username of the sender is prepended and sent to all other clients (including the original sender). If it does, the server assumes it to be a command and attempts to process it. A message longer than 100 characters will cause the server to kick the client. This change was initially done by allowing the client to not slice the message up to 119 (the previous limit), without changes to the server. For this reason, the vanilla server kept the code to cut messages at 119, but this isn't a protocol limitation and can be ignored.
+
Note that all fields use absolute positioning and do not allow for relative positioning.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,423: Line 3,752:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x01
+
  |rowspan="5"| 0x29
  |rowspan="1"| Play
+
  |rowspan="5"| Play
  |rowspan="1"| Server
+
  |rowspan="5"| Client
  | Message
+
  | X
  | String
+
  | Double
  | The client sends the raw input, not [[Chat]]
+
  | Absolute position (X coordinate).
 +
|-
 +
| Y
 +
| Double
 +
| Absolute position (Y coordinate).
 +
|-
 +
| Z
 +
| Double
 +
| Absolute position (Z coordinate).
 +
|-
 +
| Yaw
 +
| Float
 +
| Absolute rotation on the vertical axis, in degrees.
 +
|-
 +
| Pitch
 +
| Float
 +
| Absolute rotation on the horizontal axis, in degrees.
 
  |}
 
  |}
  
==== Use Entity ====
+
==== Open Book ====
  
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
+
Sent when a player right clicks with a signed book. This tells the client to open the book GUI.
 
 
A Notchian server only accepts this packet if the entity being attacked/used is visible without obstruction and within a 4-unit radius of the player's position.
 
 
 
Note that middle-click in creative mode is interpreted by the client and sent as a [[#Creative Inventory Action|Creative Inventory Action]] packet instead.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,447: Line 3,788:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x02
+
  | 0x2A
  |rowspan="5"| Play
+
  | Play
  |rowspan="5"| Server
+
  | Client
  | Target
+
  | Hand
| VarInt
+
  | VarInt enum
|
+
  | 0: Main hand, 1: Off hand .
|-
 
| Type
 
  | VarInt
 
  | 0: interact, 1: attack, 2: interact at
 
|-
 
| Target X
 
| Optional Float
 
| Only if Type is interact at
 
|-
 
| Target Y
 
| Optional Float
 
| Only if Type is interact at
 
|-
 
| Target Z
 
| Optional Float
 
| Only if Type is interact at
 
 
  |}
 
  |}
  
==== Player ====
+
==== Open Screen ====
  
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
+
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. Resending this packet with already existing window id, will update the window title and window type without closing the window.
 
+
For horses, use [[#Open Horse Screen|Open Horse Screen]].
When dropping from sufficient height, fall damage is applied when this state goes from false to true. The amount of damage applied is based on the point where it last changed from true to false. Note that there are several movement related packets containing this state.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,485: Line 3,809:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x03
+
  |rowspan="3"| 0x2B
  |rowspan="1"| Play
+
  |rowspan="3"| Play
  |rowspan="1"| Server
+
  |rowspan="3"| Client
  | On Ground
+
  | Window ID
  | Boolean
+
  | VarInt
  | True if the client is on the ground, false otherwise
+
  | A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 +
|-
 +
| Window Type
 +
| VarInt
 +
| The window type to use for display. Contained in the <code>minecraft:menu</code> registry; see [[Inventory]] for the different values.
 +
|-
 +
| Window Title
 +
| [[Chat]]
 +
| The title of the window.
 
  |}
 
  |}
  
==== Player Position ====
+
==== Open Sign Editor ====
 
 
Updates the player's XYZ position on the server.
 
 
 
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 units, this will result in the client being kicked for “You moved too quickly :( (Hacking?)”
 
 
 
If the distance is greater than 10 units, the server will log the warning message "<name> moved too quickly!", followed by two coordinate triples (maybe movement delta?), but will not kick the client.
 
  
Also if the fixed-point number of X or Z is set greater than 3.2×10<sup>7</sup> the client will be kicked for “Illegal position”.
+
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]]. There must already be a sign at the given location (which the client does not do automatically) - send a [[#Block Update|Block Update]] first.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,511: Line 3,837:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x04
+
  | 0x2C
  |rowspan="4"| Play
+
  | Play
  |rowspan="4"| Server
+
  | Client
| X
+
  | Location
| Double
+
  | Position
| Absolute position
+
  |
|-
+
  |}
| Feet Y
 
| Double
 
| Absolute position, normally Head Y - 1.62
 
|-
<