Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
m (→‎Handshake: formatting)
m (→‎Chunk Data: fix link)
 
(505 intermediate revisions by 98 users not shown)
Line 1: Line 1:
{{About|the protocol for the latest stable release of Minecraft computer edition|the current pre-release protocol|Pre-release protocol}}
+
{{Box
 +
  |BORDER = #9999FF
 +
  |BACKGROUND = #99CCFF
 +
  |WIDTH = 100%
 +
  |ICON =
 +
  |HEADING = Heads up!
 +
  |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''Java Edition''' ([[Protocol version numbers|1.16.5, protocol 754]]). 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'''. The protocol for Pocket Minecraft is substantially different, and is documented at [[Pocket 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://chat.freenode.net:6697/mcdevs #mcdevs on chat.freenode.net] ([http://wiki.vg/MCDevs More Information]).
  
 
'''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, etc… you still need to provide attribution to #mcdevs if you copy any of the contents of this page for publication elsewhere.
 
'''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, etc… you still need to provide attribution to #mcdevs if you copy any of the contents of this page for publication elsewhere.
Line 11: 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 ===
  
<!-- Transcluded contents of Data Types article in here - go to that page if you want to edit it -->
+
{{:Data types}} <!-- Transcluded contents of Data types article in here go to that page if you want to edit it -->
 
 
{{:Data Types}}
 
  
 
=== Other definitions ===
 
=== Other definitions ===
Line 36: 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
 +
| 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.16.5.html burger].
 +
 
 +
Alternatively, the vanilla server now includes an option to export the current block state ID mapping, by running <code>java -cp minecraft_server.jar net.minecraft.data.Main --reports</code>.  See [[Data Generators]] for more information.
 
  |-
 
  |-
  !colspan="2"| See also: [[Units of Measurement]]
+
  | Notchian
 +
| The official implementation of vanilla Minecraft as developed and released by Mojang.
 
  |}
 
  |}
  
 
== Packet format ==
 
== Packet format ==
 +
 +
Packets cannot be larger than 2097151 bytes (the maximum that can be sent in a 3-byte VarInt).  For compressed packets, this applies to both the compressed length and uncompressed lengths.
  
 
=== Without compression ===
 
=== Without compression ===
Line 52: Line 68:
 
  | Length
 
  | Length
 
  | VarInt
 
  | VarInt
  | Length of packet data + length of the packet ID
+
  | Length of Packet ID + Data
 
  |-
 
  |-
 
  | Packet ID
 
  | Packet ID
Line 65: Line 81:
 
=== 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
 +
! Compressed?
 
  ! Field Name
 
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
 +
| No
 
  | Packet Length
 
  | Packet Length
 
  | VarInt
 
  | VarInt
  | Length of Data + length of Data Length
+
  | Length of Data Length + compressed length of (Packet ID + Data)
 
  |-
 
  |-
 +
| No
 
  | Data Length
 
  | Data Length
 
  | VarInt
 
  | VarInt
  | Length of uncompressed Data or 0
+
  | Length of uncompressed (Packet ID + Data) or 0
 +
|-
 +
|rowspan="2"| Yes
 +
| Packet ID
 +
| VarInt
 +
| zlib compressed packet ID (see the sections below)
 
  |-
 
  |-
 
  | Data
 
  | Data
 
  | Byte Array
 
  | Byte Array
  | zlib compressed packet, including packet ID (see the sections below)
+
  | zlib compressed packet data (see the sections below)
 
  |}
 
  |}
  
Line 89: Line 113:
 
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
 
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
  
If compressed, the length of Data must be equal to or over the threshold set in the Set Compression packet, otherwise the client/server will disconnect.
+
If compressed, the uncompressed length of (Packet ID + Data) must be equal to or over the threshold set in the packet [[#Set Compression|Set Compression]], otherwise the receiving party will disconnect.
  
Compression can be disabled by sending a threshold of -1.
+
Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all.
  
 
== Handshaking ==
 
== Handshaking ==
 +
 +
=== Clientbound ===
 +
 +
There are no clientbound packets in the Handshaking state, since the protocol immediately switches to a different state after the client sends the first packet.
  
 
=== Serverbound ===
 
=== Serverbound ===
Line 110: Line 138:
 
  |-
 
  |-
 
  |rowspan="4"| 0x00
 
  |rowspan="4"| 0x00
  |rowspan="4"| Handshake
+
  |rowspan="4"| Handshaking
 
  |rowspan="4"| Server
 
  |rowspan="4"| Server
 
  | Protocol Version
 
  | Protocol Version
 
  | VarInt
 
  | VarInt
  | See [[protocol version numbers]] (currently 47)
+
  | See [[protocol version numbers]] (currently 754 in Minecraft 1.16.5).
 
  |-
 
  |-
 
  | 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 complete redirect, e.g. if _minecraft._tcp.example.com points to mc.example.org, users connecting to example.com will provide mc.example.org as server address in addition to connecting to it.
 
  |-  
 
  |-  
 
  | Server Port
 
  | Server Port
 
  | 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]].
 
  |}
 
  |}
  
== Play ==
+
==== Legacy Server List Ping ====
 
 
=== Clientbound ===
 
  
==== Keep Alive ====
+
{{Warning|This packet uses a nonstandard format. It is never length-prefixed, and the packet ID is an Unsigned Byte instead of a VarInt.}}
  
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.
+
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.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 145: Line 171:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x00
+
  | 0xFE
  |rowspan="1"| Play
+
  | Handshaking
  |rowspan="1"| Client
+
  | Server
  | Keep Alive ID
+
  | Payload
  | VarInt
+
  | Unsigned Byte
  |  
+
  | always 1 (<code>0x01</code>).
 
  |}
 
  |}
  
==== Join Game ====
+
See [[Server List Ping#1.6]] for the details of the protocol that follows this packet.
 +
 
 +
== Status ==
 +
{{Main|Server List Ping}}
 +
 
 +
=== Clientbound ===
  
See [[Protocol Encryption]] for information on logging in.
+
==== Response ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 165: Line 196:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x01
+
  |rowspan="2"| 0x00
  |rowspan="7"| Play
+
  |rowspan="2"| Status
  |rowspan="7"| Client
+
  |rowspan="2"| Client
| Entity ID
 
| Int
 
| The player's Entity ID (EID)
 
 
  |-
 
  |-
  | Gamemode
+
  | JSON Response
  | Unsigned Byte
+
  | String (32767)
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
+
  | See [[Server List Ping#Response]]; as with all strings this is prefixed by its length as a VarInt.
  |-
+
  |}
  | Dimension
+
 
  | Byte
+
==== Pong ====
  | -1: Nether, 0: Overworld, 1: End
+
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Difficulty
+
  | 0x01
  | Unsigned Byte
+
  | Status
  | 0: peaceful, 1: easy, 2: normal, 3: hard
+
  | Client
  |-
+
  | Payload
  | Max Players
+
  | Long
  | Unsigned Byte
+
  | Should be the same as sent by the client.
| Used by the client to draw the player list
 
|-
 
| Level Type
 
| String
 
| default, flat, largeBiomes, amplified, default_1_1
 
|-
 
| Reduced Debug Info
 
| Boolean
 
|
 
 
  |}
 
  |}
  
{{Warning|If the Dimension isn't valid then the client will crash}}
+
=== Serverbound ===
  
==== Chat Message ====  
+
==== Request ====
 
 
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 211: Line 235:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x02
+
  | 0x00
  |rowspan="2"| Play
+
| Status
  |rowspan="2"| Client
+
  | Server
| JSON Data
+
  |colspan="3"| ''no fields''
| [[Chat]]
 
| Limited to 32767 bytes
 
|-
 
| Position
 
| Byte
 
| 0: chat (chat box), 1: system message (chat box), 2: above action bar
 
 
  |}
 
  |}
  
{{Warning|Malformed JSON will disconnect the client}}
+
==== Ping ====
 
 
==== Time Update ====
 
 
 
Time is based on ticks, where 20 ticks happen every second. There are 24000 ticks in a day, making Minecraft days exactly 20 minutes long.
 
 
 
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
 
 
 
The default SMP server increments the time by <code>20</code> every second.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 241: Line 251:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x03
+
  | 0x01
  |rowspan="2"| Play
+
  | Status
  |rowspan="2"| Client
+
  | Server
  | World Age
+
  | Payload
 
  | Long
 
  | Long
  | In ticks; not changed by server commands
+
  | May be any number. Notchian clients use a system-dependent time value which is counted in milliseconds.
|-
 
| 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 ====
+
== Login ==
 +
 
 +
The login process is as follows:
 +
 
 +
# C→S: [[#Handshake|Handshake]] with Next State set to 2 (login)
 +
# C→S: [[#Login Start|Login Start]]
 +
# S→C: [[#Encryption Request|Encryption Request]]
 +
# Client auth
 +
# C→S: [[#Encryption Response|Encryption Response]]
 +
# Server auth, both enable encryption
 +
# S→C: [[#Set Compression|Set Compression]] (optional)
 +
# S→C: [[#Login Success|Login Success]]
 +
 
 +
Set Compression, if present, must be sent before Login Success. Note that anything sent after Set Compression must use the [[#With_compression|Post Compression packet format]].
 +
 
 +
For unauthenticated ("cracked"/offline-mode) and localhost connections (either of the two conditions is enough for an unencrypted connection) there is no encryption. In that case [[#Login Start|Login Start]] is directly followed by [[#Login Success|Login Success]]. 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 263: Line 290:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x04
+
  | 0x00
  |rowspan="3"| Play
+
  | Login
  |rowspan="3"| Client
+
  | Client
  | Entity ID
+
  | Reason
| VarInt
+
  | [[Chat]]
| Entity's EID
+
  |  
|-
 
| Slot
 
| Short
 
| Equipment slot. 0: held, 1–4: armor slot (1: boots, 2: leggings, 3: chestplate, 4: helmet)
 
|-
 
| Item
 
  | [[Slot Data|Slot]]
 
  | Item in slot format
 
 
  |}
 
  |}
  
==== Spawn Position ====
+
==== Encryption Request ====
 
 
Sent by the server after login to specify the coordinates of the spawn point (the point at which players spawn at, and which the compass points to). It can be sent at any time to update the point compasses point at.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 291: Line 308:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x05
+
  |rowspan="5"| 0x01
  |rowspan="1"| Play
+
  |rowspan="5"| Login
  |rowspan="1"| Client
+
  |rowspan="5"| Client
  | Location
+
  | Server ID
  | Position
+
  | String (20)
  | Spawn location
+
  | Appears to be empty.
  |}
+
|-
 +
| Public Key Length
 +
| VarInt
 +
| Length of Public Key
 +
|-
 +
| Public Key
 +
| Byte Array
 +
| The server's public key in bytes
 +
|-
 +
| Verify Token Length
 +
| VarInt
 +
| Length of Verify Token. Always 4 for Notchian servers.
 +
|-
 +
| Verify Token
 +
| Byte Array
 +
| A sequence of random bytes generated by the server.
 +
  |}
  
==== Update Health ====
+
See [[Protocol Encryption]] for details.
  
Sent by the server to update/set the health of the player it is sent to.
+
==== Login Success ====
 
 
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 313: Line 344:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x06
+
  |rowspan="2"| 0x02
  |rowspan="3"| Play
+
  |rowspan="2"| Login
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Health
+
  | UUID
  | Float
+
  | UUID
  | 0 or less = dead, 20 = full HP
+
  |  
 
  |-
 
  |-
  | Food
+
  | Username
  | VarInt
+
  | String (16)
  | 0–20
+
  |  
|-
 
| Food Saturation
 
| Float
 
| Seems to vary from 0.0 to 5.0 in integer increments
 
 
  |}
 
  |}
  
==== Respawn ====
+
This packet switches the connection state to [[#Play|play]].
 +
 
 +
{{Warning2|The (notchian) server might take a bit to fully transition to the Play state, so it's recommended to wait before sending Play packets, either by setting a timeout, or waiting for Play packets from the server (usually [[#Player Info|Player Info]]).
 +
 
 +
The notchian client doesn't send any (non-[[#Keep Alive|keep alive]]) packets until the next tick/[[#Time Update|time update]] packet.
 +
}}
 +
 
 +
==== Set Compression ====
  
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.
+
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 341: Line 375:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x07
+
  | 0x03
  |rowspan="4"| Play
+
  | Login
  |rowspan="4"| Client
+
  | Client
  | Dimension
+
  | Threshold
  | Int
+
  | VarInt
  | -1: The Nether, 0: The Overworld, 1: The End
+
  | Maximum size of a packet before it is compressed.
|-
 
| Difficulty
 
| Unsigned Byte
 
| 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
 
|-
 
| Gamemode
 
| Unsigned Byte
 
| 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
 
|-
 
| Level Type
 
| String
 
| Same as [[#Join Game|Join Game]]
 
 
  |}
 
  |}
  
{{Warning|If the Dimension isn't valid then the client will crash}}
+
==== Login Plugin Request ====
 
 
{{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)}}
 
 
 
==== Player Position And Look ====  
 
 
 
Updates the players 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 will result in the client being 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 of player (in degrees), standing at point (x0, z0) and looking towards point (x, z) one can be calculated with:
 
  
l = x-x0
+
Used to implement a custom handshaking flow together with [[#Login_Plugin_Response | Login Plugin Response]].
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:
+
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.
 
 
x = -cos(pitch) * sin(yaw)
 
y = -sin(pitch)
 
z =  cos(pitch) * cos(yaw)
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 403: Line 397:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x08
+
  |rowspan="3"| 0x04
  |rowspan="6"| Play
+
  |rowspan="3"| Login
  |rowspan="6"| Client
+
  |rowspan="3"| Client
  | X
+
  | Message ID
  | Double
+
  | VarInt
  | Absolute or relative position, depending on Flags
+
  | Generated by the server - should be unique to the connection.
 
  |-
 
  |-
  | Y
+
  | Channel
  | Double
+
  | Identifier
  | Absolute or relative position, depending on Flags
+
  | Name of the [[plugin channel]] used to send the data.
 
  |-
 
  |-
  | Z
+
  | Data
  | Double
+
  | Byte Array
  | Absolute or relative position, depending on Flags
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
|-
+
  |}
| Yaw
 
| Float
 
| Absolute or relative rotation on the X Axis, in degrees
 
|-
 
| Pitch
 
| Float
 
| Absolute or relative rotation on the Y Axis, in degrees
 
|-
 
| Flags
 
| Byte
 
| Bit field, see below
 
  |}
 
  
About the Flags field:
+
=== Serverbound ===
  
  <Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
+
==== Login Start ====
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
! Field
+
  | 0x00
! Bit
+
  | Login
|-
+
  | Server
| X
+
  | Name
| 0x01
+
  | String (16)
|-
+
  | Player's Username.
| 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 468: Line 443:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x09
+
  |rowspan="4"| 0x01
  |rowspan="1"| Play
+
  |rowspan="4"| Login
  |rowspan="1"| Client
+
  |rowspan="4"| 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.
 +
  |-
 +
| Verify Token Length
 +
| VarInt
 +
| Length of Verify Token.
 +
|-
 +
| Verify Token
 +
| Byte Array
 +
| Verify Token value, encrypted with the same public key as the shared secret.
 
  |}
 
  |}
  
==== Use Bed ====
+
See [[Protocol Encryption]] for details.
  
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 492: Line 475:
 
  ! 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.
 +
|-
 +
| Successful
 +
| Boolean
 +
| <code>true</code> if the client understands the request, <code>false</code> otherwise. When <code>false</code>, no payload follows.
 
  |-
 
  |-
  | Location
+
  | Data
  | Position
+
  | Optional Byte Array
  | Block location of the head part of the bed
+
  | 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 516: Line 507:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0B
+
  |rowspan="12"| 0x00
  |rowspan="2"| Play
+
  |rowspan="12"| Play
  |rowspan="2"| Client
+
  |rowspan="12"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player ID
+
  | EID of the entity.
 +
|-
 +
| Object UUID
 +
| UUID
 +
|
 
  |-
 
  |-
  | Animation
+
  | Type
  | Unsigned Byte
+
  | VarInt
  | Animation ID (see below)
+
  | The type of entity (same as in [[#Spawn Living Entity|Spawn Living Entity]]).
  |}
+
|-
 
+
| X
Animation can be one of the following values:
+
  | Double
 
+
|
{| class="wikitable"
+
|-
  ! ID
+
| Y
  ! Animation
+
| Double
 +
|
 +
|-
 +
| Z
 +
  | Double
 +
  |
 
  |-
 
  |-
  | 0
+
  | Pitch
  | Swing arm
+
| Angle
 +
  |  
 
  |-
 
  |-
  | 1
+
  | Yaw
  | Take damage
+
| Angle
 +
  |  
 
  |-
 
  |-
  | 2
+
  | Data
  | Leave bed
+
  | Int
 +
| Meaning dependent on the value of the Type field, see [[Object Data]] for details.
 
  |-
 
  |-
  | 3
+
  | Velocity X
  | Eat food
+
| Short
 +
  |rowspan="3"| Same units as [[#Entity Velocity|Entity Velocity]].  Always sent, but only used when Data is greater than 0 (except for some entities which always ignore it; see [[Object Data]] for details).
 
  |-
 
  |-
  | 4
+
  | Velocity Y
  | Critical effect
+
  | Short
 
  |-
 
  |-
  | 5
+
  | Velocity Z
  | Magic critical effect
+
  | Short
 
  |}
 
  |}
  
==== Spawn Player ====
+
==== Spawn Experience Orb ====
  
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
+
Spawns one or more experience orbs.
 
 
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. The tab includes skin/cape data.
 
 
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
 
 
When in online-mode the UUIDs must be valid and have valid skin blobs, in offline-mode UUID v3 is used.
 
 
 
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 577: Line 569:
 
  ! 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
 
| Angle
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Pitch
+
  | Count
| 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 Living Entity ====
  
{{Warning|The client will crash if no Metadata is sent}}
+
Sent by the server when a living entity is spawned.
 
 
==== Collect Item ====
 
 
 
Sent by the server when someone picks up an item lying on the ground — its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each [[#Player Position|Player Position]] (and [[#Player Position And Look|Player Position And Look]]) packet sent by the client.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 633: Line 605:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0D
+
  |rowspan="12"| 0x02
  |rowspan="2"| Play
+
  |rowspan="12"| Play
  |rowspan="2"| Client
+
  |rowspan="12"| Client
  | Collected Entity ID
+
  | Entity ID
 
  | VarInt
 
  | VarInt
 
  |  
 
  |  
  |-  
+
  |-
  | Collector Entity ID
+
  | Entity UUID
  | VarInt
+
  | UUID
 
  |  
 
  |  
|}
 
 
==== Spawn Object ====
 
 
Sent by the server when an Object/Vehicle is created.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="8"| 0x0E
+
  | Type
|rowspan="8"| Play
 
|rowspan="8"| Client
 
| Entity ID
 
 
  | VarInt
 
  | VarInt
| EID of the object
+
  | The type of mob. See [[Entities#Mobs]].
|-
 
| Type
 
| Byte
 
  | The type of object (See [[Entities#Objects|Objects]])
 
 
  |-
 
  |-
 
  | X
 
  | X
  | Int
+
  | Double
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  |  
 
  |-
 
  |-
 
  | Y
 
  | Y
  | Int
+
  | Double
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  |  
 
  |-
 
  |-
 
  | Z
 
  | Z
  | Int
+
  | Double
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
|
 +
  |-
 +
| Yaw
 +
| Angle
 +
|  
 
  |-
 
  |-
 
  | Pitch
 
  | Pitch
Line 684: Line 640:
 
  |  
 
  |  
 
  |-
 
  |-
  | Yaw
+
  | Head Pitch
 
  | Angle
 
  | Angle
 
  |  
 
  |  
 
  |-
 
  |-
  | Data
+
  | Velocity X
  | [[Object Data]]
+
  | Short
  |  
+
| Same units as [[#Entity Velocity|Entity Velocity]].
 +
|-
 +
| Velocity Y
 +
  | Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]].
 +
|-
 +
| Velocity Z
 +
| Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]].
 
  |}
 
  |}
  
==== Spawn Mob ====
+
==== Spawn Painting ====
  
Sent by the server when a Mob Entity is Spawned
+
This packet shows location, name, and type of painting.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 705: Line 669:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="12"| 0x0F
+
  |rowspan="5"| 0x03
  |rowspan="12"| Play
+
  |rowspan="5"| Play
  |rowspan="12"| Client
+
  |rowspan="5"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Type
+
  | Entity UUID
  | Unsigned Byte
+
  | UUID
  | The type of mob. See [[Entities#Mobs|Mobs]]
+
  |  
 
  |-
 
  |-
  | X
+
  | Motive
  | Int
+
  | VarInt
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Painting's ID, see below.
 
  |-
 
  |-
  | Y
+
  | Location
  | Int
+
  | Position
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Center coordinates (see below).
 
  |-
 
  |-
  | Z
+
  | Direction
  | Int
+
  | Byte Enum
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Direction the painting faces (North = 2, South = 0, West = 1, East = 3).
 +
|}
 +
 
 +
Calculating the center of an image: given a (width × height) grid of cells, with <code>(0, 0)</code> being the top left corner, the center is <code>(max(0, width / 2 - 1), height / 2)</code>. E.g. <code>(1, 0)</code> for a 2×1 painting, or <code>(1, 2)</code> for a 4×4 painting.
 +
 
 +
List of paintings by coordinates in <code>paintings_kristoffer_zetterstrand.png</code> (where x and y are in pixels from the top left and width and height are in pixels or 16ths of a block):
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! ID
 +
! x
 +
! y
 +
! width
 +
! height
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft:kebab</code>
  | Angle
+
  | 0
  |  
+
  | 0
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft:aztec</code>
  | Angle
+
  | 1
  |  
+
  | 16
 +
| 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:alban</code>
 +
| 2
 +
| 32
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Head Pitch
+
  | <code>minecraft:aztec2</code>
  | Angle
+
  | 3
  |  
+
  | 48
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Velocity X
+
  | <code>minecraft:bomb</code>
  | Short
+
  | 4
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | 64
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Velocity Y
+
  | <code>minecraft:plant</code>
  | Short
+
  | 5
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | 80
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Velocity Z
+
  | <code>minecraft:wasteland</code>
  | Short
+
  | 6
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | 96
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Metadata
+
  | <code>minecraft:pool</code>
  | [[Entities#Entity Metadata Format|Metadata]]
+
  | 7
  |  
+
  | 0
  |}
+
  | 32
 
+
  | 32
==== Spawn Painting ====
+
  | 16
 
 
This packet shows location, name, and type of painting.
 
 
 
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"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x10
+
  | <code>minecraft:courbet</code>
  |rowspan="4"| Play
+
  | 8
  |rowspan="4"| Client
+
  | 32
  | Entity ID
+
  | 32
  | VarInt
+
  | 32
  |  
+
  | 16
 
  |-
 
  |-
  | Title
+
  | <code>minecraft:sea</code>
  | String
+
  | 9
  | Name of the painting. Max length 13
+
  | 64
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Location
+
  | <code>minecraft:sunset</code>
  | Position
+
  | 10
  | Center coordinates
+
  | 96
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Direction
+
  | <code>minecraft:creebet</code>
  | Unsigned Byte
+
  | 11
  | Direction the painting faces. 0: north (-z), 1: west (-x), 2: south (+z), 3: east (+x)
+
  | 128
  |}
+
  | 32
 
+
| 32
==== Spawn Experience Orb ====
+
  | 16
 
 
Spawns one or more experience orbs.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x11
+
  | <code>minecraft:wanderer</code>
  |rowspan="5"| Play
+
  | 12
  |rowspan="5"| Client
+
  | 0
  | Entity ID
+
  | 64
  | VarInt
+
  | 16
  | Entity's ID
+
  | 32
 
  |-
 
  |-
  | X
+
  | <code>minecraft:graham</code>
  | Int
+
  | 13
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | 16
 +
| 64
 +
| 16
 +
| 32
 
  |-
 
  |-
  | Y
+
  | <code>minecraft:match</code>
  | Int
+
  | 14
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | 0
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Z
+
  | <code>minecraft:bust</code>
  | Int
+
  | 15
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | 32
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Count
+
  | <code>minecraft:stage</code>
  | Short
+
  | 16
  | The amount of experience this orb will reward once collected
+
  | 64
 +
| 128
 +
| 32
 +
| 32
 +
|-
 +
| <code>minecraft:void</code>
 +
| 17
 +
| 96
 +
| 128
 +
| 32
 +
| 32
 +
|-
 +
| <code>skull_and_roses</code>
 +
| 18
 +
| 128
 +
| 128
 +
| 32
 +
| 32
 +
|-
 +
| <code>minecraft:wither</code>
 +
| 19
 +
| 160
 +
| 128
 +
| 32
 +
| 32
 +
|-
 +
| <code>minecraft:fighters</code>
 +
| 20
 +
| 0
 +
| 96
 +
| 64
 +
| 32
 +
|-
 +
| <code>minecraft:pointer</code>
 +
| 21
 +
| 0
 +
| 192
 +
| 64
 +
| 64
 +
|-
 +
| <code>minecraft:pigscene</code>
 +
| 22
 +
| 64
 +
| 192
 +
| 64
 +
| 64
 +
|-
 +
| <code>minecraft:burning_skull</code>
 +
| 23
 +
| 128
 +
| 192
 +
| 64
 +
| 64
 +
|-
 +
| <code>minecraft:skeleton</code>
 +
| 24
 +
| 192
 +
| 64
 +
| 64
 +
| 48
 +
|-
 +
| <code>minecraft:donkey_kong</code>
 +
| 25
 +
| 192
 +
| 112
 +
| 64
 +
| 48
 
  |}
 
  |}
  
==== Entity Velocity ====
+
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
 +
 
 +
==== Spawn Player ====
 +
 
 +
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
 +
 
 +
This packet must be sent after the [[#Player Info|Player Info]] packet that adds the player data for the client to use when spawning a player. If the Player Info for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player Info packet includes skin/cape data.
  
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).
+
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 842: Line 906:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x12
+
  |rowspan="7"| 0x04
  |rowspan="4"| Play
+
  |rowspan="7"| Play
  |rowspan="4"| Client
+
  |rowspan="7"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  |  
+
  | Player's EID.
 
  |-
 
  |-
  | Velocity X
+
  | Player UUID
  | Short
+
  | UUID
  | Velocity on the X axis
+
  | See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs.
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 
  |-
 
  |-
  | Velocity Y
+
  | Yaw
  | Short
+
  | Angle
  | Velocity on the Y axis
+
  |  
 
  |-
 
  |-
  | Velocity Z
+
  | Pitch
  | Short
+
  | Angle
  | Velocity on the Z axis
+
  |  
 
  |}
 
  |}
  
==== Destroy Entities ====
+
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs.
 +
 
 +
In offline mode, [[Wikipedia:Universally unique identifier#Versions 3 and 5 (namespace name-based)|UUID v3]] is used with the String <code>OfflinePlayer:&lt;player name&gt;</code>, encoded in UTF-8 (and case-sensitive).  The Notchain server uses <code>UUID.nameUUIDFromBytes</code>, implemented by OpenJDK [https://github.com/AdoptOpenJDK/openjdk-jdk8u/blob/9a91972c76ddda5c1ce28b50ca38cbd8a30b7a72/jdk/src/share/classes/java/util/UUID.java#L153-L175 here].
 +
 
 +
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 by the server when a list of entities is to be destroyed on the client.
+
Sent whenever an entity should change animation.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 874: Line 960:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x13
+
  |rowspan="2"| 0x05
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Count
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array
+
  | Player ID.
 
  |-
 
  |-
  | Entity IDs
+
  | Animation
  | Array of VarInt
+
  | Unsigned Byte
  | The list of entities of destroy
+
  | Animation ID (see below).
 
  |}
 
  |}
  
==== Entity ====
+
Animation can be one of the following values:
  
Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.
+
{| class="wikitable"
 
+
! ID
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.
+
! Animation
 +
|-
 +
| 0
 +
| Swing main arm
 +
|-
 +
| 1
 +
| Take damage
 +
|-
 +
| 2
 +
| Leave bed
 +
|-
 +
| 3
 +
| Swing offhand
 +
|-
 +
| 4
 +
| Critical effect
 +
|-
 +
| 5
 +
| Magic critical effect
 +
|}
 +
 
 +
==== Statistics ====
 +
 
 +
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1). Will only send the changed values if previously requested.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
  ! Bound To
+
  ! Bound To  
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x14
+
  |rowspan="4"| 0x06
  |rowspan="1"| Play
+
  |rowspan="4"| Play
  |rowspan="1"| 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
 +
| See below.
 +
|-
 +
| Statistic ID
 +
| VarInt
 +
| See below.
 +
|-
 +
| Value
 
  | VarInt
 
  | VarInt
  |  
+
  | The amount to set it to.
 
  |}
 
  |}
  
==== Entity Relative Move ====
+
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 
 
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"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
! ID
  ! Bound To
+
  ! Registry
  ! Field Name
+
  |-
  ! Field Type
+
| <code>minecraft.mined</code>
  ! Notes
+
| 0
 +
| Blocks
 +
|-
 +
| <code>minecraft.crafted</code>
 +
| 1
 +
| Items
 +
|-
 +
| <code>minecraft.used</code>
 +
| 2
 +
| Items
 +
|-
 +
  | <code>minecraft.broken</code>
 +
  | 3
 +
  | Items
 
  |-
 
  |-
  |rowspan="5"| 0x15
+
  | <code>minecraft.picked_up</code>
|rowspan="5"| Play
+
  | 4
|rowspan="5"| Client
+
  | Items
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Delta X
+
  | <code>minecraft.dropped</code>
  | Byte
+
  | 5
  | Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Items
 
  |-
 
  |-
  | Delta Y
+
  | <code>minecraft.killed</code>
  | Byte
+
  | 6
  | Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Entities
 
  |-
 
  |-
  | Delta Z
+
  | <code>minecraft.killed_by</code>
  | Byte
+
  | 7
  | Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Entities
 
  |-
 
  |-
  | On Ground
+
  | <code>minecraft.custom</code>
  | Boolean
+
  | 8
  |  
+
  | Custom
 
  |}
 
  |}
  
==== Entity Look ====
+
Blocks, Items, and Entities use block (not block state), item, and entity ids.
  
This packet is sent by the server when an entity rotates.
+
Custom has the following (unit only matters for clients):
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
! State
+
  ! ID
! Bound To
+
  ! Unit
! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x16
+
  | <code>minecraft.leave_game</code>
|rowspan="5"| Play
+
  | 0
|rowspan="5"| Client
+
  | None
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.play_one_minute</code>
  | Angle
+
  | 1
  | New angle, not a delta
+
  | Time
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.time_since_death</code>
  | Angle
+
  | 2
  | New angle, not a delta
+
  | Time
 
  |-
 
  |-
  | On Ground
+
  | <code>minecraft.time_since_rest</code>
  | Boolean
+
  | 3
  |  
+
  | Time
|}
 
 
 
==== 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.sneak_time</code>
|rowspan="7"| Play
+
  | 4
|rowspan="7"| Client
+
  | Time
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Delta X
+
  | <code>minecraft.walk_one_cm</code>
  | Byte
+
  | 5
  | Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Delta Y
+
  | <code>minecraft.crouch_one_cm</code>
  | Byte
+
  | 6
  | Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Delta Z
+
  | <code>minecraft.sprint_one_cm</code>
  | Byte
+
  | 7
  | Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.walk_on_water_one_cm</code>
  | Angle
+
  | 8
  | New angle, not a delta
+
  | Distance
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.fall_one_cm</code>
  | Angle
+
  | 9
  | New angle, not a delta
+
  | Distance
 
  |-
 
  |-
  | On Ground
+
  | <code>minecraft.climb_one_cm</code>
| Boolean
+
  | 10
  |  
+
  | Distance
  |}
 
 
 
==== Entity Teleport ====
 
 
 
This packet is sent by the server when an entity moves more than 4 blocks.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x18
+
  | <code>minecraft.fly_one_cm</code>
|rowspan="7"| Play
+
  | 11
|rowspan="7"| Client
+
  | Distance
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | X
+
  | <code>minecraft.walk_under_water_one_cm</code>
  | Int
+
  | 12
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.minecart_one_cm</code>
  | Int
+
  | 13
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.boat_one_cm</code>
  | Int
+
  | 14
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.pig_one_cm</code>
  | Angle
+
  | 15
  | New angle, not a delta
+
  | Distance
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.horse_one_cm</code>
  | Angle
+
  | 16
  | New angle, not a delta
+
  | Distance
 +
|-
 +
| <code>minecraft.aviate_one_cm</code>
 +
| 17
 +
| Distance
 
  |-
 
  |-
  | On Ground
+
  | <code>minecraft.swim_one_cm</code>
| Boolean
+
  | 18
  |  
+
  | Distance
  |}
 
 
 
==== Entity Head Look ====
 
 
 
Changes the direction an entity's head is facing.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x19
+
  | <code>minecraft.strider_one_cm</code>
|rowspan="2"| Play
+
  | 19
|rowspan="2"| Client
+
  | Distance
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Head Yaw
+
  | <code>minecraft.jump</code>
  | Angle
+
  | 20
  | New angle, not a delta
+
  | None
|}
 
 
 
==== Entity Status ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x1A
+
  | <code>minecraft.drop</code>
|rowspan="2"| Play
+
  | 21
|rowspan="2"| Client
+
  | None
| Entity ID
 
  | Int
 
  |  
 
 
  |-
 
  |-
  | Entity Status
+
  | <code>minecraft.damage_dealt</code>
  | Byte
+
  | 22
  | See below
+
  | Damage
|}
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Entity Status
+
  | <code>minecraft.damage_dealt_absorbed</code>
  ! Meaning
+
  | 23
 +
| Damage
 
  |-
 
  |-
  | 1
+
  | <code>minecraft.damage_dealt_resisted</code>
  | Sent when resetting a mob spawn minecart's timer - appears to be unused by the client
+
  | 24
 +
| Damage
 
  |-
 
  |-
  | 2
+
  | <code>minecraft.damage_taken</code>
  | Living Entity hurt
+
  | 25
 +
| Damage
 
  |-
 
  |-
  | 3
+
  | <code>minecraft.damage_blocked_by_shield</code>
  | Living Entity dead
+
  | 26
 +
| Damage
 
  |-
 
  |-
  | 4
+
  | <code>minecraft.damage_absorbed</code>
  | Iron Golem throwing up arms
+
  | 27
 +
| Damage
 
  |-
 
  |-
  | 6
+
  | <code>minecraft.damage_resisted</code>
  | Wolf/Ocelot/Horse taming — Spawn “heart” particles
+
| 28
 +
  | Damage
 
  |-
 
  |-
  | 7
+
  | <code>minecraft.deaths</code>
  | Wolf/Ocelot/Horse tamed — Spawn “smoke” particles
+
| 29
 +
  | None
 
  |-
 
  |-
  | 8
+
  | <code>minecraft.mob_kills</code>
  | Wolf shaking water — Trigger the shaking animation
+
  | 30
 +
| None
 
  |-
 
  |-
  | 9
+
  | <code>minecraft.animals_bred</code>
  | (of self) Eating accepted by server
+
  | 31
 +
| None
 
  |-
 
  |-
  | 10
+
  | <code>minecraft.player_kills</code>
  | Sheep eating grass
+
  | 32
 +
| None
 
  |-
 
  |-
  | 10
+
  | <code>minecraft.fish_caught</code>
  | Play TNT ignite sound
+
  | 33
 +
| None
 
  |-
 
  |-
  | 11
+
  | <code>minecraft.talked_to_villager</code>
  | Iron Golem handing over a rose
+
  | 34
 +
| None
 
  |-
 
  |-
  | 12
+
  | <code>minecraft.traded_with_villager</code>
  | Villager mating — Spawn “heart” particles
+
  | 35
 +
| None
 
  |-
 
  |-
  | 13
+
  | <code>minecraft.eat_cake_slice</code>
  | Spawn particles indicating that a villager is angry and seeking revenge
+
  | 36
 +
| None
 
  |-
 
  |-
  | 14
+
  | <code>minecraft.fill_cauldron</code>
  | Spawn happy particles near a villager
+
  | 37
 +
| None
 
  |-
 
  |-
  | 15
+
  | <code>minecraft.use_cauldron</code>
  | Witch animation — Spawn “magic” particles
+
  | 38
 +
| None
 
  |-
 
  |-
  | 16
+
  | <code>minecraft.clean_armor</code>
  | Play zombie converting into a villager sound
+
  | 39
 +
| None
 
  |-
 
  |-
  | 17
+
  | <code>minecraft.clean_banner</code>
  | Firework exploding
+
  | 40
 +
| None
 
  |-
 
  |-
  | 18
+
  | <code>minecraft.clean_shulker_box</code>
  | Animal in love (ready to mate) — Spawn “heart” particles
+
  | 41
 +
| None
 
  |-
 
  |-
  | 19
+
  | <code>minecraft.interact_with_brewingstand</code>
  | Reset squid rotation
+
  | 42
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_beacon</code>
 +
| 43
 +
| None
 +
|-
 +
| <code>minecraft.inspect_dropper</code>
 +
| 44
 +
| None
 +
|-
 +
| <code>minecraft.inspect_hopper</code>
 +
| 45
 +
| None
 +
|-
 +
| <code>minecraft.inspect_dispenser</code>
 +
| 46
 +
| None
 +
|-
 +
| <code>minecraft.play_noteblock</code>
 +
| 47
 +
| None
 +
|-
 +
| <code>minecraft.tune_noteblock</code>
 +
| 48
 +
| None
 +
|-
 +
| <code>minecraft.pot_flower</code>
 +
| 49
 +
| None
 +
|-
 +
| <code>minecraft.trigger_trapped_chest</code>
 +
| 50
 +
| None
 +
|-
 +
| <code>minecraft.open_enderchest</code>
 +
| 51
 +
| None
 +
|-
 +
| <code>minecraft.enchant_item</code>
 +
| 52
 +
| None
 +
|-
 +
| <code>minecraft.play_record</code>
 +
| 53
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_furnace</code>
 +
| 54
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_crafting_table</code>
 +
| 55
 +
| None
 +
|-
 +
| <code>minecraft.open_chest</code>
 +
| 56
 +
| None
 +
|-
 +
| <code>minecraft.sleep_in_bed</code>
 +
| 57
 +
| None
 +
|-
 +
| <code>minecraft.open_shulker_box</code>
 +
| 58
 +
| None
 +
|-
 +
| <code>minecraft.open_barrel</code>
 +
| 59
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_blast_furnace</code>
 +
| 60
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_smoker</code>
 +
| 61
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_lectern</code>
 +
| 62
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_campfire</code>
 +
| 63
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_cartography_table</code>
 +
| 64
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_loom</code>
 +
| 65
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_stonecutter</code>
 +
| 66
 +
| None
 +
|-
 +
| <code>minecraft.bell_ring</code>
 +
| 67
 +
| None
 +
|-
 +
| <code>minecraft.raid_trigger</code>
 +
| 68
 +
| None
 +
|-
 +
| <code>minecraft.raid_win</code>
 +
| 69
 +
| None
 
  |-
 
  |-
  | 20
+
  | <code>minecraft.interact_with_anvil</code>
  | Spawn explosion particle — works for some living entities
+
  | 70
 +
| None
 
  |-
 
  |-
  | 21
+
  | <code>minecraft.interact_with_grindstone</code>
  | Play guardian sound — works for every entity
+
  | 71
 +
| None
 
  |-
 
  |-
  | 22
+
  | <code>minecraft.target_hit</code>
  | Enables reduced debug for players
+
  | 72
 +
| None
 
  |-
 
  |-
  | 23
+
  | <code>minecraft.interact_with_smithing_table</code>
  | Disables reduced debug for players
+
  | 73
 +
| None
 
  |}
 
  |}
  
==== Attach Entity ====
+
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
  
This packet is sent when a player has been attached to an entity (e.g. Minecart).
+
==== Acknowledge Player Digging ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,199: Line 1,398:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1B
+
  |rowspan="4"| 0x07
  |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.
+
  | Position where the digging was happening.
 
  |-
 
  |-
  | Vehicle ID
+
  | Block
  | Int
+
| VarInt
  | Vechicle's Entity ID
+
| Block state ID of the block that should be at that position now.
 +
|-
 +
  | Status
 +
  | VarInt enum
 +
| Same as Player Digging.  Only Started digging (0), Cancelled digging (1), and Finished digging (2) are used.
 
  |-
 
  |-
  | Leash
+
  | Successful
 
  | Boolean
 
  | Boolean
  | If true leashes the entity to the vehicle
+
  | True if the digging succeeded; false if the client should undo any changes it made locally.
 
  |}
 
  |}
  
==== Entity Metadata ====
+
==== Block Break Animation ====
 +
 
 +
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 +
 
 +
Block break animations can still be applied on air; the animation will remain visible although there is no block being broken.  However, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency.  (An effect similar to this can be seen in normal gameplay when breaking ice blocks)
 +
 
 +
If you need to display several break animations at the same time you have to give each of them a unique Entity ID. The entity ID does not need to correspond to an actual entity on the client. It is valid to use a randomly generated number.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,225: Line 1,434:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1C
+
  |rowspan="3"| 0x08
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  |  
+
  | Entity ID of the entity breaking the block.
 +
|-
 +
| Location
 +
| Position
 +
| Block Position.
 
  |-
 
  |-
  | Metadata
+
  | Destroy Stage
  | [[Entities#Entity Metadata Format|Metadata]]
+
  | Byte
  |  
+
  | 0–9 to set it, any other value to remove it.
 
  |}
 
  |}
  
==== Entity Effect ====
+
==== Block Entity Data ====
 +
 
 +
Sets the block entity associated with the block at the given location.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,247: Line 1,462:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x1D
+
  |rowspan="3"| 0x09
  |rowspan="5"| Play
+
  |rowspan="3"| Play
  |rowspan="5"| Client
+
  |rowspan="3"| Client
  | Entity ID
+
  | Location
  | VarInt
+
  | Position
 
  |  
 
  |  
 
  |-
 
  |-
  | Effect ID
+
  | Action
  | Byte
+
  | Unsigned Byte
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | The type of update to perform, see below.
 
  |-
 
  |-
  | Amplifier
+
  | NBT Data
  | Byte
+
  | [[NBT|NBT Tag]]
  | Notchian client displays effect level as Amplifier + 1
+
  | 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).
  |-
+
  |}
| Duration
+
 
| VarInt
+
''Action'' field:
| Seconds
+
 
|-
+
* '''1''': Set data of a mob spawner (everything except for SpawnPotentials: current delay, min/max delay, mob to be spawned, spawn count, spawn range, etc.)
| Hide Particles
+
* '''2''': Set command block text (command and last execution status)
| Boolean
+
* '''3''': Set the level, primary, and secondary powers of a beacon
|
+
* '''4''': Set rotation and skin of mob head
|}
+
* '''5''': Declare a conduit
 +
* '''6''': Set base color and patterns on a banner
 +
* '''7''': Set the data for a Structure tile entity
 +
* '''8''': Set the destination for a end gateway
 +
* '''9''': Set the text on a sign
 +
* '''10''': Unused
 +
* '''11''': Declare a bed
 +
* '''12''': Set data of a jigsaw block
 +
* '''13''': Set items in a campfire
 +
* '''14''': Beehive information
 +
 
 +
==== Block Action ====
 +
 
 +
This packet is used for a number of actions and animations performed by blocks, usually non-persistent.
 +
 
 +
See [[Block Actions]] for a list of values.
  
==== Remove Entity Effect ====
+
{{Warning2|This packet uses a block ID, not a block state.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,281: Line 1,511:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1E
+
  |rowspan="4"| 0x0A
  |rowspan="2"| Play
+
  |rowspan="4"| Play
  |rowspan="2"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  | Location
 +
| Position
 +
| Block coordinates.
 +
|-
 +
| Action ID (Byte 1)
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]].
 +
|-
 +
| Action Param (Byte 2)
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]].
 +
|-
 +
| Block Type
 
  | VarInt
 
  | VarInt
  |  
+
  | The block type ID for the block. This must match the block at the given coordinates.
|-
 
| Effect ID
 
| Byte
 
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
 
 
  |}
 
  |}
  
==== Set Experience ====
+
==== Block Change ====
 +
 
 +
Fired whenever a block is changed within the render distance.
  
Sent by the server when the client should change experience levels.
+
{{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,305: Line 1,545:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1F
+
  |rowspan="2"| 0x0B
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Experience bar
+
  | Location
  | Float
+
  | Position
  | Between 0 and 1
+
  | Block Coordinates.
 
  |-
 
  |-
  | Level
+
  | 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.
|-
 
| Total Experience
 
| VarInt
 
| See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
 
 
  |}
 
  |}
  
==== Entity Properties ====
+
==== Boss Bar ====  
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,328: Line 1,564:
 
  ! Bound To
 
  ! Bound To
 
  !colspan="2"| Field Name
 
  !colspan="2"| Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x20
+
  |rowspan="14"| 0x0C
  |rowspan="6"| Play
+
  |rowspan="14"| Play
  |rowspan="6"| Client
+
  |rowspan="14"| Client
  |colspan="2"| Entity ID
+
  |colspan="2"| UUID
  |colspan="2"| VarInt
+
| UUID
 +
| Unique ID for this bar.
 +
|-
 +
  |colspan="2"| Action
 +
| VarInt Enum
 +
| Determines the layout of the remaining packet.
 +
|-
 +
! Action
 +
! Field Name
 +
!
 +
!
 +
|-
 +
|rowspan="5"| 0: add
 +
| Title
 +
| [[Chat]]
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | Health
  |colspan="2"| Int
+
  | Float
  | Number of elements in the following array
+
  | 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.
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | Color
| Key
+
  | VarInt Enum
|rowspan="4"| Array
+
  | Color ID (see below).
  | String
 
  | See below
 
 
  |-
 
  |-
  | Value
+
  | Division
  | Double
+
  | VarInt Enum
  | See below
+
  | Type of division (see below).
 
  |-
 
  |-
  | Number Of Modifiers
+
  | Flags
  | VarInt
+
  | Unsigned Byte
  | Number of elements in the following array
+
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02).
|-
 
| Modifiers
 
| Array of Modifier Data
 
| See {{Minecraft Wiki|Attribute#Modifiers}}
 
|}
 
 
 
Known Key values:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Key
+
  | 1: remove
  ! Default
+
  | ''no fields''
  ! Min
+
  | ''no fields''
  ! Max
+
  | Removes this boss bar.
! Label
 
 
  |-
 
  |-
  | generic.maxHealth
+
  | 2: update health
  | 20.0
+
  | Health
  | 0.0
+
  | Float
  | Double.MaxValue
+
  | ''as above''
| Max Health
 
 
  |-
 
  |-
  | generic.followRange
+
  | 3: update title
  | 32.0
+
  | Title
  | 0.0
+
  | [[Chat]]
  | 2048.0
+
  |  
| Follow Range
 
 
  |-
 
  |-
  | generic.knockbackResistance
+
  |rowspan="2"| 4: update style
  | 0.0
+
  | Color
  | 0.0
+
  | VarInt Enum
  | 1.0
+
  | Color ID (see below).
| Knockback Resistance
 
 
  |-
 
  |-
  | generic.movementSpeed
+
  | Dividers
  | 0.699999988079071
+
  | VarInt Enum
  | 0.0
+
  | ''as above''
| Double.MaxValue
 
| Movement Speed
 
 
  |-
 
  |-
  | generic.attackDamage
+
  | 5: update flags
  | 2.0
+
  | Flags
  | 0.0
+
  | Unsigned Byte
  | Double.MaxValue
+
  | ''as above''
|
 
|-
 
| horse.jumpStrength
 
| 0.7
 
| 0.0
 
| 2.0
 
| Jump Strength
 
 
  |-
 
  |-
| zombie.spawnReinforcements
 
| 0.0
 
| 0.0
 
| 1.0
 
| Spawn Reinforcements Chance
 
 
  |}
 
  |}
 
''Modifier Data'' structure:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! ID
 +
! Color
 
  |-
 
  |-
  ! Field Name
+
  | 0
  ! Field Type
+
  | Pink
  ! Notes
+
  |-
 +
| 1
 +
| Blue
 +
|-
 +
| 2
 +
| Red
 +
|-
 +
| 3
 +
| Green
 
  |-
 
  |-
  | UUID
+
  | 4
| UUID
+
  | Yellow
  |  
 
 
  |-
 
  |-
  | Amount
+
  | 5
| Double
+
  | Purple
  |  
 
 
  |-
 
  |-
  | Operation
+
  | 6
| Byte
+
  | White
  |  
 
 
  |}
 
  |}
  
==== Chunk Data ====
+
{| class="wikitable"
 +
! ID
 +
! Type of division
 +
|-
 +
| 0
 +
| No division
 +
|-
 +
| 1
 +
| 6 notches
 +
|-
 +
| 2
 +
| 10 notches
 +
|-
 +
| 3
 +
| 12 notches
 +
|-
 +
| 4
 +
| 20 notches
 +
|}
  
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.
+
==== Server Difficulty ====
  
See also: [[SMP Map Format]]
+
Changes the difficulty setting in the client's option menu
 
 
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,456: Line 1,693:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x21
+
  |rowspan="2"| 0x0D
  |rowspan="6"| Play
+
  |rowspan="2"| Play
  |rowspan="6"| Client
+
  |rowspan="2"| Client
  | Chunk X
+
  | Difficulty
  | Int
+
  | Unsigned Byte
  | Chunk X coordinate
+
  | 0: peaceful, 1: easy, 2: normal, 3: hard.
 
  |-
 
  |-
  | Chunk Z
+
  | Difficulty locked?
  | Int
+
  | Boolean
  | Chunk Z coordinate
+
  |
 +
|}
 +
 
 +
==== Chat Message (clientbound) ====
 +
 
 +
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options.  See [[Chat#Processing chat|processing chat]] for more info about these positions.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Ground-Up Continuous
+
  |rowspan="3"| 0x0E
  | Boolean
+
|rowspan="3"| Play
  | 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
+
|rowspan="3"| Client
 +
| JSON Data
 +
  | [[Chat]]
 +
  | Limited to 262144 bytes.
 
  |-
 
  |-
  | Primary Bit Mask
+
  | Position
  | Unsigned Short
+
  | Byte
  | Bitmask with 1 for every 16x16x16 section whose data follows in the compressed data
+
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
|-
 
| Size
 
| VarInt
 
| Size of Data
 
 
  |-
 
  |-
  | Data
+
  | Sender
  | [[SMP Map Format#Data|Chunk]]
+
  | UUID
  |  
+
  | Used by the Notchian client for the disableChat launch option. Setting both longs to 0 will always display the message regardless of the setting.
 
  |}
 
  |}
  
==== Multi Block Change ====
+
==== Tab-Complete (clientbound) ====
 +
 
 +
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported. The client sorts these alphabetically before listing them.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,494: Line 1,745:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x22
+
  |rowspan="8"| 0x0F
  |rowspan="6"| Play
+
  |rowspan="8"| Play
  |rowspan="6"| Client
+
  |rowspan="8"| Client
|colspan="2"| Chunk X
 
|colspan="2"| Int
 
| Chunk X coordinate
 
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  |colspan="2"| ID
  |colspan="2"| Int
+
  |colspan="2"| VarInt
  | Chunk Z coordinate
+
  | Transaction ID.
 +
|-
 +
|colspan="2"| Start
 +
|colspan="2"| VarInt
 +
| Start of the text to replace.
 +
|-
 +
|colspan="2"| Length
 +
|colspan="2"| VarInt
 +
| Length of the text to replace.
 
  |-
 
  |-
  |colspan="2"| Record Count
+
  |colspan="2"| Count
 
  |colspan="2"| VarInt
 
  |colspan="2"| 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
+
  |rowspan="3"| Matches
  | Horizontal Position
+
  | Match
 
  |rowspan="3"| Array
 
  |rowspan="3"| Array
  | Unsigned Byte
+
  | String (32767)
  | 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.
+
  | 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.
 
  |-
 
  |-
  | Y Coordinate
+
  | Has tooltip
  | Unsigned Byte
+
  | Boolean
  |  
+
  | True if the following is present.
 
  |-
 
  |-
  | Block ID
+
  | Tooltip
  | VarInt
+
  | Optional [[Chat]]
  | The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
+
  | Tooltip to display; only present if previous boolean is true.
 
  |}
 
  |}
  
==== Block Change ====
+
==== Declare Commands ====
 +
 
 +
Lists all of the commands on the server, and how they are parsed.
 +
 
 +
This is a directed graph, with one root node.  Each redirect or child node must refer only to nodes that have already been declared.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,534: Line 1,794:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x23
+
  |rowspan="3"| 0x10
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Location
+
  | Count
  | Position
+
  | VarInt
  | Block Coordinates
+
  | Number of elements in the following array.
 +
|-
 +
| Nodes
 +
| Array of [[Command Data|Node]]
 +
| An array of nodes.
 
  |-
 
  |-
  | Block ID
+
  | Root index
 
  | VarInt
 
  | VarInt
  | The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
+
  | Index of the <code>root</code> node in the previous array.
 
  |}
 
  |}
  
==== Block Action ====
+
For more information on this packet, see the [[Command Data]] article.
  
This packet is used for a number of things:
+
==== Window Confirmation (clientbound) ====
  
* Chests opening and closing
+
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag).  If the packet was not accepted, the client must respond with a [[#Window Confirmation (serverbound)|serverbound window confirmation]] packet.
* Pistons pushing and pulling
 
* Note blocks playing
 
* Updating beacons
 
 
 
See Also: [[Block Actions]]  
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,565: Line 1,824:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x24
+
  |rowspan="3"| 0x11
  |rowspan="4"| Play
+
  |rowspan="3"| Play
  |rowspan="4"| Client
+
  |rowspan="3"| Client
  | Location
+
  | Window ID
  | Position
+
  | Byte
  | Block Coordinates
+
  | The ID of the window that the action occurred in.
 
  |-
 
  |-
  | Byte 1
+
  | Action Number
  | Unsigned Byte
+
  | Short
  | Varies depending on block — see [[Block Actions]]
+
  | Every action that is to be accepted has a unique number. This number is an incrementing integer (starting at 0) with separate counts for each window ID.
 
  |-
 
  |-
  | Byte 2
+
  | Accepted
  | Unsigned Byte
+
  | Boolean
  | Varies depending on block — see [[Block Actions]]
+
  | Whether the action was accepted.
|-
 
| Block Type
 
| VarInt
 
| The block type for the block
 
 
  |}
 
  |}
  
==== Block Break Animation ====
+
==== Close Window (clientbound) ====
  
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
+
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.
  
You can also set an animation to air! The animation will still be visible.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| 0x12
 +
| Play
 +
| Client
 +
| Window ID
 +
| Unsigned Byte
 +
| This is the ID of the window that was closed. 0 for inventory.
 +
|}
  
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
+
==== Window Items ====
 +
[[File:Inventory-slots.png|thumb|The inventory slots]]
  
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)
+
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"
Line 1,603: Line 1,873:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x25
+
  |rowspan="3"| 0x13
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
 
  |rowspan="3"| Client
 
  |rowspan="3"| Client
  | Entity ID
+
  | Window ID
  | VarInt
+
  | Unsigned Byte
  | EID for the animation
+
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  | Location
+
  | Count
  | Position
+
  | Short
  | Block Position
+
  | Number of elements in the following array.
 
  |-
 
  |-
  | Destroy Stage
+
  | Slot Data
  | Byte
+
  | Array of [[Slot Data|Slot]]
  | 0–9 to set it, any other value to remove it
+
  |  
 
  |}
 
  |}
  
==== Map Chunk Bulk ====
+
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
  
1.8 changes at [[#Chunk Data|Chunk Data]]
+
==== Window Property ====
  
To reduce the number of bytes, this packet is used to send chunks together for better compression results.
+
This packet is used to inform the client that part of a GUI window should be updated.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,629: Line 1,899:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x26
+
  |rowspan="3"| 0x14
  |rowspan="7"| Play
+
  |rowspan="3"| Play
  |rowspan="7"| Client
+
  |rowspan="3"| Client
  |colspan="2"| Sky Light Sent
+
  | Window ID
  |colspan="2"| Boolean
+
  | Unsigned Byte
  | 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
+
  | Property
  |colspan="2"| VarInt
+
  | Short
  | Number of elements in each of the following arrays
+
  | The property to be updated, see below.
 
  |-
 
  |-
  |rowspan="3"| Chunk Meta
+
  | Value
  | Chunk X
+
  | Short
|rowspan="3"| Array
+
  | The new value for the property, see below.
| Int
 
  | The X coordinate of the chunk
 
|-
 
| Chunk Z
 
| Int
 
| The Z coordinate of the chunk
 
|-
 
| Primary Bit Mask
 
| Unsigned Short
 
| A bit mask which specifies which sections are not empty in this chunk
 
|-
 
|colspan="2"| Chunk Data
 
|colspan="2"| Array of [[SMP Map Format#Data|Chunk]]
 
| Each chunk in this array corresponds to the data at the same position in Chunk Meta
 
 
  |}
 
  |}
  
==== Explosion ====
+
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.
 
 
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
 
 
 
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="9"| 0x27
+
  ! Window type
  |rowspan="9"| Play
+
  ! Property
  |rowspan="9"| Client
+
  ! Value
| X
 
| Float
 
|
 
 
  |-
 
  |-
  | Y
+
  |rowspan="4"| Furnace
  | Float
+
  | 0: Fire icon (fuel left)
  |  
+
  | counting from fuel burn time down to 0 (in-game ticks)
 
  |-
 
  |-
  | Z
+
  | 1: Maximum fuel burn time
| Float
+
  | fuel burn time or 0 (in-game ticks)
  |  
 
 
  |-
 
  |-
  | Radius
+
  | 2: Progress arrow
  | Float
+
  | counting from 0 to maximum progress (in-game ticks)
| Currently unused in the client
 
 
  |-
 
  |-
  | Record Count
+
  | 3: Maximum progress
  | Int
+
  | always 200 on the notchian server
  | Number of elements in the following array
+
|-
 +
|rowspan="10"| Enchantment Table
 +
| 0: Level requirement for top enchantment slot
 +
|rowspan="3"| The enchantment's xp level requirement
 +
|-
 +
| 1: Level requirement for middle enchantment slot
 +
|-
 +
  | 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>).
 +
|-
 +
| 4: Enchantment ID shown on mouse hover over top enchantment slot
 +
|rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
 +
|-
 +
| 5: Enchantment ID shown on mouse hover over middle enchantment slot
 +
|-
 +
| 6: Enchantment ID shown on mouse hover over bottom enchantment slot
 +
|-
 +
| 7: Enchantment level shown on mouse hover over the top slot
 +
|rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
 +
|-
 +
| 8: Enchantment level shown on mouse hover over the middle slot
 +
|-
 +
| 9: Enchantment level shown on mouse hover over the bottom slot
 +
|-
 +
|rowspan="3"| Beacon
 +
| 0: Power level
 +
| 0-4, controls what effect buttons are enabled
 +
|-
 +
| 1: First potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
 +
|-
 +
| 2: Second potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
 +
|-
 +
| Anvil
 +
| 0: Repair cost
 +
| The repair's cost in xp levels
 +
|-
 +
|rowspan="2"| Brewing Stand
 +
| 0: Brew time
 +
| 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
  |-
 
  |-
  | Records
+
  | 1: Fuel time
  | Array of (Byte, Byte, Byte)
+
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
| Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
 
 
  |-
 
  |-
  | Player Motion X
+
  | Stonecutter
  | Float
+
  | 0: Selected recipe
  | X velocity of the player being pushed by the explosion
+
  | The index of the selected recipe. -1 means none is selected.
 
  |-
 
  |-
  | Player Motion Y
+
  | Loom
  | Float
+
  | 0: Selected pattern
  | Y velocity of the player being pushed by the explosion
+
  | The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern.
 
  |-
 
  |-
  | Player Motion Z
+
  | Lectern
  | Float
+
  | 0: Page number
  | Z velocity of the player being pushed by the explosion
+
  | The current page number, starting from 0.
 
  |}
 
  |}
  
==== 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
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x28
+
  | 0
|rowspan="4"| Play
+
  | minecraft:protection
|rowspan="4"| Client
+
  | Protection
| Effect ID
 
  | Int
 
  | The ID of the effect, see below
 
 
  |-
 
  |-
  | Location
+
  | 1
  | Position
+
  | minecraft:fire_protection
  | The location of the effect
+
  | Fire Protection
 
  |-
 
  |-
  | Data
+
  | 2
  | Int
+
  | minecraft:feather_falling
  | Extra data for certain effects, see below
+
  | Feather Falling
 
  |-
 
  |-
  | Disable Relative Volume
+
  | 3
  | Boolean
+
  | minecraft:blast_protection
| See above
+
  | Blast Protection
  |}
 
 
 
Effect IDs:
 
 
 
{| class="wikitable"
 
! ID
 
! Name
 
! Data
 
 
  |-
 
  |-
  !colspan="3"| Sound
+
  | 4
 +
| minecraft:projectile_protection
 +
| Projectile Protection
 
  |-
 
  |-
  | 1000
+
  | 5
  | <code>random.click</code>
+
  | minecraft:respiration
  |  
+
  | Respiration
 
  |-
 
  |-
  | 1001
+
  | 6
  | <code>random.click</code>
+
  | minecraft:aqua_affinity
  |  
+
  | Aqua Affinity
 
  |-
 
  |-
  | 1002
+
  | 7
  | <code>random.bow</code>
+
  | minecraft:thorns
  |  
+
  | Thorns
 
  |-
 
  |-
  | 1003
+
  | 8
  | <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
+
  | minecraft:depth_strider
  |  
+
  | Depth Strider
 
  |-
 
  |-
  | 1004
+
  | 9
  | <code>random.fizz</code>
+
  | minecraft:frost_walker
  |  
+
  | Frost Walker
 
  |-
 
  |-
  | 1005
+
  | 10
  | Play a music disc.
+
  | minecraft:binding_curse
  | {{Minecraft Wiki|Music Discs|Record ID}}
+
  | Curse of Binding
 
  |-
 
  |-
  | 1006
+
  | 11
  | ''not assigned''
+
  | minecraft:soul_speed
  |  
+
  | Soul Speed
 
  |-
 
  |-
  | 1007
+
  | 12
  | <code>mob.ghast.charge</code>
+
  | minecraft:sharpness
  |  
+
  | Sharpness
 
  |-
 
  |-
  | 1008
+
  | 13
  | <code>mob.ghast.fireball</code>
+
  | minecraft:smite
  |  
+
  | Smite
 
  |-
 
  |-
  | 1009
+
  | 14
  | <code>mob.ghast.fireball</code>, but with a lower volume
+
  | minecraft:bane_of_arthropods
  |  
+
  | Bane of Arthropods
 
  |-
 
  |-
  | 1010
+
  | 15
  | <code>mob.zombie.wood</code>
+
  | minecraft:knockback
  |  
+
  | Knockback
 
  |-
 
  |-
  | 1011
+
  | 16
  | <code>mob.zombie.metal</code>
+
  | minecraft:fire_aspect
  |  
+
  | Fire Aspect
 
  |-
 
  |-
  | 1012
+
  | 17
  | <code>mob.zombie.woodbreak</code>
+
  | minecraft:looting
  |  
+
  | Looting
 
  |-
 
  |-
  | 1013
+
  | 18
  | <code>mob.wither.spawn</code>
+
  | minecraft:sweeping
  |  
+
  | Sweeping Edge
 
  |-
 
  |-
  | 1014
+
  | 19
  | <code>mob.wither.shoot</code>
+
  | minecraft:efficiency
  |  
+
  | Efficiency
 
  |-
 
  |-
  | 1015
+
  | 20
  | <code>mob.bat.takeoff</code>
+
  | minecraft:silk_touch
  |  
+
  | Silk Touch
 
  |-
 
  |-
  | 1016
+
  | 21
  | <code>mob.zombie.infect</code>
+
  | minecraft:unbreaking
  |  
+
  | Unbreaking
 
  |-
 
  |-
  | 1017
+
  | 22
  | <code>mob.zombie.unfect</code>
+
  | minecraft:fortune
  |  
+
  | Fortune
 
  |-
 
  |-
  | 1018
+
  | 23
  | <code>mob.enderdragon.end</code>
+
  | minecraft:power
  |  
+
  | Power
 
  |-
 
  |-
  | 1020
+
  | 24
  | <code>random.anvil_break</code>
+
  | minecraft:punch
  |  
+
  | Punch
 
  |-
 
  |-
  | 1021
+
  | 25
  | <code>random.anvil_use</code>
+
  | minecraft:flame
  |  
+
  | Flame
 
  |-
 
  |-
  | 1022
+
  | 26
  | <code>random.anvil_land</code>
+
  | minecraft:infinity
  |  
+
  | Infinity
 
  |-
 
  |-
  !colspan="3"| Particle
+
  | 27
 +
| minecraft:luck_of_the_sea
 +
| Luck of the Sea
 
  |-
 
  |-
  | 2000
+
  | 28
  | Spawns 10 smoke particles, e.g. from a fire
+
  | minecraft:lure
  | Direction, see below
+
  | Lure
 
  |-
 
  |-
  | 2001
+
  | 29
  | Block break
+
  | minecraft:loyalty
  | {{Minecraft Wiki|Data values|Block ID}}
+
  | Loyalty
 
  |-
 
  |-
  | 2002
+
  | 30
  | Splash potion. Particle effect + glass break sound.
+
  | minecraft:impaling
  | [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
+
  | Impaling
 
  |-
 
  |-
  | 2003
+
  | 31
  | Eye of Ender entity break animation — particles and sound
+
  | minecraft:riptide
  |  
+
  | Riptide
 
  |-
 
  |-
  | 2004
+
  | 32
  | Mob spawn particle effect: smoke + flames
+
  | minecraft:channeling
  |  
+
  | Channeling
 
  |-
 
  |-
  | 2005
+
  | 33
| Spawn “happy villager” effect (green crosses), used for bonemealing vegetation
+
  | minecraft:multishot
  |  
+
  | Multishot
  |}
 
 
 
Smoke directions:
 
 
 
{| class="wikitable"
 
! ID
 
! Direction
 
 
  |-
 
  |-
  | 0
+
  | 34
  | South-East
+
  | minecraft:quick_charge
 +
| Quick Charge
 
  |-
 
  |-
  | 1
+
  | 35
  | South
+
  | minecraft:piercing
  |-
+
  | Piercing
| 2
 
| South-West
 
|-
 
| 3
 
| East
 
|-
 
| 4
 
| (Up or middle ?)
 
|-
 
| 5
 
| West
 
|-
 
| 6
 
| North-East
 
 
  |-
 
  |-
  | 7
+
  | 36
  | North
+
  | minecraft:mending
 +
| Mending
 
  |-
 
  |-
  | 8
+
  | 37
  | North-West
+
  | minecraft:vanishing_curse
 +
| Curse of Vanishing
 
  |}
 
  |}
  
==== Sound Effect ====
+
==== Set 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,923: Line 2,171:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x29
+
  |rowspan="3"| 0x15
  |rowspan="6"| Play
+
  |rowspan="3"| Play
  |rowspan="6"| Client
+
  |rowspan="3"| 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
+
  | Slot
  | Int
+
  | Short
  | Effect X multiplied by 8
+
  | The slot that should be updated.
 
  |-
 
  |-
  | Effect position Y
+
  | Slot Data
  | Int
+
| [[Slot Data|Slot]]
  | Effect Y 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 44).  If the window ID is set to -2, then any slot in the inventory can be used but no add item animation will be played.
 +
 
 +
==== Set Cooldown ====
 +
 
 +
Applies a cooldown period to all items with the given type.  Used by the Notchian server with enderpearls.  This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing).
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Effect position Z
+
  |rowspan="2"| 0x16
  | Int
+
|rowspan="2"| Play
  | Effect Z multiplied by 8
+
|rowspan="2"| Client
 +
| Item ID
 +
  | VarInt
 +
  | Numeric ID of the item to apply a cooldown to.
 
  |-
 
  |-
  | Volume
+
  | Cooldown Ticks
  | Float
+
  | VarInt
  | 1 is 100%, can be more
+
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
|-
 
| Pitch
 
| Unsigned Byte
 
| 63 is 100%, can be more
 
 
  |}
 
  |}
  
==== 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 documentation on this: [http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/]
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,963: Line 2,231:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="11"| 0x2A
+
  |rowspan="2"| 0x17
  |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.
 
  |-
 
  |-
  | Long Distance
+
  | Data
  | Boolean
+
  | Byte Array
  | If true, particle distance increases from 256 to 65536
+
  | Any data, depending on the channel. <code>minecraft:</code> channels are documented [[plugin channel|here]].  The length of this array must be inferred from the packet length.
 +
|}
 +
 
 +
==== Named Sound Effect ====
 +
{{See also|#Sound Effect}}
 +
 
 +
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | X
+
  |rowspan="7"| 0x18
  | Float
+
|rowspan="7"| Play
  | X position of the particle
+
|rowspan="7"| Client
 +
| Sound Name
 +
  | Identifier
 +
  | All sound effect names as of 1.16.5 can be seen [https://pokechu22.github.io/Burger/1.16.5.html#sounds here].
 
  |-
 
  |-
  | Y
+
  | Sound Category
  | Float
+
  | VarInt Enum
  | Y position of the particle
+
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories]).
 
  |-
 
  |-
  | Z
+
  | Effect Position X
  | Float
+
  | Int
  | Z 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).
 
  |-
 
  |-
  | Offset X
+
  | Effect Position Y
  | Float
+
  | Int
  | This is added to the X position after being multiplied by random.nextGaussian()
+
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part).
 
  |-
 
  |-
  | Offset Y
+
  | Effect Position Z
  | Float
+
  | Int
  | This is added to the Y 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 Z
+
  | Volume
 
  | Float
 
  | Float
  | This is added to the Z position after being multiplied by random.nextGaussian()
+
  | 1 is 100%, can be more.
 
  |-
 
  |-
  | Particle Data
+
  | Pitch
 
  | Float
 
  | Float
  | The data of each particle
+
  | Float between 0.5 and 2.0 by Notchian clients.
 +
|}
 +
 
 +
==== Disconnect (play) ====
 +
 
 +
Sent by the server before it disconnects a client. The client assumes that the server has already closed the connection by the time the packet arrives.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Particle Count
+
  | 0x19
  | Int
+
  | Play
  | The number of particles to create
+
  | Client
  |-
+
  | Reason
  | Data
+
  | [[Chat]]
  | Array of VarInt
+
  | Displayed to the client when the connection terminates.
| Length depends on particle. ICON_CRACK has length of 2, BLOCK_CRACK, and BLOCK_DUST have lengths of 1, the rest have 0.
 
 
  |}
 
  |}
  
Particle IDs:
+
==== Entity Status ====
 +
 
 +
Entity statuses generally trigger an animation for an entity.  The available statuses vary by the entity's type (and are available to subclasses of that type as well).
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Particle Name
+
  |rowspan="2"| 0x1A
  ! Particle ID
+
  |rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| Int
 +
|
 
  |-
 
  |-
  | explode
+
  | Entity Status
  | 0
+
  | Byte Enum
  |-
+
  | See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
  | largeexplosion
+
  |}
  | 1
+
 
  |-
+
==== Explosion ====
  | hugeexplosion
+
 
  | 2
+
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"| 0x1B
  | 3
+
|rowspan="9"| Play
 +
|rowspan="9"| Client
 +
| X
 +
| Float
 +
  |  
 
  |-
 
  |-
  | bubble
+
  | Y
  | 4
+
| Float
 +
  |  
 
  |-
 
  |-
  | wake
+
  | Z
  | 5
+
| Float
 +
  |  
 
  |-
 
  |-
  | splash
+
  | 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
+
  | Int
 +
| Number of elements in the following array.
 
  |-
 
  |-
  | townaura
+
  | 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.
  | largesmoke
+
  |}
  | 12
+
 
 +
==== Unload Chunk ====
 +
 
 +
Tells the client to unload a chunk column.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | mobSpell?
+
  |rowspan="2"| 0x1C
  | 13
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Chunk X
 +
| 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.
 +
 
 +
==== Change Game State ====
 +
 
 +
Used for a wide variety of game state things, from weather to bed use to gamemode to demo messages.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | spell
+
  |rowspan="2"| 0x1D
  | 15
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Reason
 +
| Unsigned Byte
 +
  | See below.
 
  |-
 
  |-
  | witchMagic
+
  | Value
  | 17
+
  | Float
  |-
+
  | Depends on Reason.
  | dripWater
+
  |}
  | 18
+
 
 +
''Reason codes'':
 +
 
 +
{| class="wikitable"
 +
! Reason
 +
  ! Effect
 +
! Value
 
  |-
 
  |-
  | dripLava
+
  | 0
  | 19
+
  | 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.
 
  |-
 
  |-
  | angryVillager
+
  | 1
  | 20
+
| End raining
 +
  |  
 
  |-
 
  |-
  | happyVillager
+
  | 2
  | 21
+
| Begin raining
 +
  |  
 
  |-
 
  |-
  | depthsuspend
+
  | 3
  | 22
+
  | Change gamemode
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
 
  |-
 
  |-
  | note
+
  | 4
  | 23
+
  | 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.
 
  |-
 
  |-
  | portal
+
  | 5
  | 24
+
  | Demo event
 +
| 0: Show welcome to demo screen<br> 101: Tell movement controls<br> 102: Tell jump control<br> 103: Tell inventory control<br> 104: Tell that the demo is over and print a message about how to take a screenshot.
 +
|-
 +
| 6
 +
| Arrow hit player
 +
| Note: Sent when any player is struck by an arrow.
 
  |-
 
  |-
  | enchantmenttable
+
  | 7
  | 25
+
  | Rain level change
 +
| Note: Seems to change both skycolor and lightning. <strong>[https://imgur.com/a/K6wSrkW You can see some level images here]</strong><br>This can cause [https://imgur.com/gallery/ZQX0Wd5 <strong>HUD color change in client</strong>], when level is higher than 20. It goes away only when game is restarted or client receives same packet (from any server) but with value of 0. Is this a bug?<br><br>Rain level starting from 0.
 
  |-
 
  |-
  | flame
+
  | 8
  | 26
+
  | Thunder level change
 +
| Note: Seems to change both skycolor and lightning (same as Rain level change, but doesn't start rain). It also requires rain to render by notchian client. <br>This can cause [https://imgur.com/gallery/ZQX0Wd5 <strong>HUD color change in client</strong>], when level is higher than 20. It goes away only when game is restarted or client receives same packet (from any server) but with value of 0. Is this a bug?<br><br>Thunder level starting from 0.
 
  |-
 
  |-
  | lava
+
  | 9
  | 27
+
  | Play pufferfish sting sound.
 
  |-
 
  |-
  | footstep
+
  | 10
  | 28
+
| Play elder guardian mob appearance (effect and sound).
 +
  |  
 
  |-
 
  |-
  | cloud
+
  | 11
  | 29
+
  | Enable respawn screen
  |-
+
  | 0: Enable respawn screen, 1: Immediately respawn (sent when the doImmediateRespawn gamerule changes).
  | reddust
+
  |}
  | 30
+
 
  |-
+
==== Open Horse Window ====
  | snowballpoof
+
 
  | 31
+
This packet is used exclusively for opening the horse GUI. [[#Open Window|Open Window]] is used for all other GUIs.
  |-
+
 
  | snowshovel
+
{| class="wikitable"
  | 32
+
  ! Packet ID
 +
  ! State
 +
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | slime
+
  |rowspan="3"| 0x1E
  | 33
+
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Window ID?
 +
| Byte
 +
  |
 
  |-
 
  |-
  | heart
+
  | Number of slots?
  | 34
+
| VarInt
 +
  |
 
  |-
 
  |-
  | barrier
+
  | Entity ID?
  | 35
+
| Integer
 +
  |
 
  |}
 
  |}
  
==== Change Game State ====
+
==== 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.
  
It appears when a bed can't be used as a spawn point and when the rain state changes.
+
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,136: Line 2,533:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x2B
+
  | 0x1F
  |rowspan="2"| Play
+
  | Play
  |rowspan="2"| Client
+
  | Client
  | Reason
+
  | Keep Alive ID
| Unsigned Byte
+
  | Long
| See below
+
  |  
|-
 
| Value
 
  | Float
 
  | Depends on reason
 
 
  |}
 
  |}
  
''Reason codes'':
+
==== Chunk Data ====
 +
{{Main|Chunk Format}}
 +
{{See also|#Unload Chunk}}
 +
 
 +
{{Need Info|How do biomes work now?  The biome change happened at the same time as the seed change, but it's not clear how/if biomes could be computed given that it's not the actual seed...  ([https://www.reddit.com/r/Mojira/comments/e5at6i/a_discussion_for_the_changes_to_how_biomes_are/ /r/mojira discussion] which notes that it seems to be some kind of interpolation, and 3D biomes are only used in the nether)}}
 +
 
 +
The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which dimension the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent.  This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with [[#Block Entity Data|Block Entity Data]] later).
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Code
+
  ! Packet ID
  ! Effect
+
  ! State
  ! Value
+
  ! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 0
+
  |rowspan="11"| 0x20
  | Invalid Bed
+
|rowspan="11"| Play
  |  
+
|rowspan="11"| Client
 +
| Chunk X
 +
  | Int
 +
  | Chunk coordinate (block coordinate divided by 16, rounded down).
 
  |-
 
  |-
  | 1
+
  | Chunk Z
  | End raining
+
  | Int
  |  
+
  | Chunk coordinate (block coordinate divided by 16, rounded down).
 
  |-
 
  |-
  | 2
+
  | Full chunk
  | Begin raining
+
  | Boolean
  |  
+
  | See [[Chunk Format#Full chunk|Chunk Format]].
 
  |-
 
  |-
  | 3
+
  | Primary Bit Mask
  | Change game mode
+
  | VarInt
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
+
  | Bitmask with bits set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
 
  |-
 
  |-
  | 4
+
  | Heightmaps
  | Enter credits
+
  | [[NBT]]
  |  
+
  | Compound containing one long array named <code>MOTION_BLOCKING</code>, which is a heightmap for the highest solid block at each position in the chunk (as a compacted long array with 256 entries at 9 bits per entry totaling 36 longs). The Notchian server also adds a <code>WORLD_SURFACE</code> long array, the purpose of which is unknown, but it's not required for the chunk to be accepted.
 +
|-
 +
| Biomes length
 +
| Optional VarInt
 +
| Size of the following array; should always be 1024.  Not present if full chunk is false.
 
  |-
 
  |-
  | 5
+
  | Biomes
  | Demo message
+
  | Optional array of VarInt
  | 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
+
  | 1024 biome IDs, ordered by x then z then y, in 4&times;4&times;4 blocks.  Not present if full chunk is false.  See [[Chunk Format#Biomes|Chunk Format § Biomes]].
 
  |-  
 
  |-  
  | 6
+
  | Size
  | Arrow hitting player
+
  | VarInt
  | Appears to be played when an arrow strikes another player in Multiplayer
+
  | Size of Data in bytes.
 
  |-
 
  |-
  | 7
+
  | Data
  | Fade value
+
  | Byte array
  | The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
+
  | See [[Chunk Format#Data structure|data structure]] in Chunk Format.
 
  |-
 
  |-
  | 8
+
  | Number of block entities
  | Fade time
+
  | VarInt
  | Time in ticks for the sky to fade
+
  | Number of elements in the following array.
 
  |-
 
  |-
  | 10
+
  | Block entities
  | Play mob appearance (effect and sound)
+
  | Array of [[NBT|NBT Tag]]
 +
| All block entities in the chunk. Use the x, y, and z tags in the NBT to determine their positions.
 
  |}
 
  |}
  
==== Spawn Global Entity ====
+
Note that the Notchian client requires an [[#Update View Position|Update View Position]] packet when it crosses a chunk border, otherwise it'll only display render distance + 2 chunks around the chunk it spawned in.
 +
 
 +
The compacted array format has been adjusted so that individual entries no longer span across multiple longs, affecting the main data array and heightmaps.
 +
 
 +
New format, 5 bits per block, containing the following references to blocks in a palette (not shown): <span style="border: solid 2px hsl(0, 90%, 60%)">1</span><span style="border: solid 2px hsl(30, 90%, 60%)">2</span><span style="border: solid 2px hsl(60, 90%, 60%)">2</span><span style="border: solid 2px hsl(90, 90%, 60%)">3</span><span style="border: solid 2px hsl(120, 90%, 60%)">4</span><span style="border: solid 2px hsl(150, 90%, 60%)">4</span><span style="border: solid 2px hsl(180, 90%, 60%)">5</span><span style="border: solid 2px hsl(210, 90%, 60%)">6</span><span style="border: solid 2px hsl(240, 90%, 60%)">6</span><span style="border: solid 2px hsl(270, 90%, 60%)">4</span><span style="border: solid 2px hsl(300, 90%, 60%)">8</span><span style="border: solid 2px hsl(330, 90%, 60%)">0</span><span style="border: solid 2px hsl(0, 90%, 30%)">7</span><span style="border: solid 2px hsl(30, 90%, 30%)">4</span><span style="border: solid 2px hsl(60, 90%, 30%)">3</span><span style="border: solid 2px hsl(90, 90%, 30%)">13</span><span style="border: solid 2px hsl(120, 90%, 30%)">15</span><span style="border: solid 2px hsl(150, 90%, 30%)">16</span><span style="border: solid 2px hsl(180, 90%, 30%)">9</span><span style="border: solid 2px hsl(210, 90%, 30%)">14</span><span style="border: solid 2px hsl(240, 90%, 30%)">10</span><span style="border: solid 2px hsl(270, 90%, 30%)">12</span><span style="border: solid 2px hsl(300, 90%, 30%)">0</span><span style="border: solid 2px hsl(330, 90%, 30%)">2</span>
 +
 
 +
<code>0020863148418841</code> <code><span style="outline: dashed 2px black">0000</span><span style="outline: solid 2px hsl(330, 90%, 60%)">00000</span><span style="outline: solid 2px hsl(300, 90%, 60%)">01000</span><span style="outline: solid 2px hsl(270, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(240, 90%, 60%)">00110</span><span style="outline: solid 2px hsl(210, 90%, 60%)">00110</span><span style="outline: solid 2px hsl(180, 90%, 60%)">00101</span><span style="outline: solid 2px hsl(150, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(120, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(90, 90%, 60%)">00011</span><span style="outline: solid 2px hsl(60, 90%, 60%)">00010</span><span style="outline: solid 2px hsl(30, 90%, 60%)">00010</span><span style="outline: solid 2px hsl(0, 90%, 60%)">00001</span></code><br>
 +
<code>01018A7260F68C87</code> <code><span style="outline: dashed 2px black">0000</span><span style="outline: solid 2px hsl(330, 90%, 30%)">00010</span><span style="outline: solid 2px hsl(300, 90%, 30%)">00000</span><span style="outline: solid 2px hsl(270, 90%, 30%)">01100</span><span style="outline: solid 2px hsl(240, 90%, 30%)">01010</span><span style="outline: solid 2px hsl(210, 90%, 30%)">01110</span><span style="outline: solid 2px hsl(180, 90%, 30%)">01001</span><span style="outline: solid 2px hsl(150, 90%, 30%)">10000</span><span style="outline: solid 2px hsl(120, 90%, 30%)">01111</span><span style="outline: solid 2px hsl(90, 90%, 30%)">01101</span><span style="outline: solid 2px hsl(60, 90%, 30%)">00011</span><span style="outline: solid 2px hsl(30, 90%, 30%)">00100</span><span style="outline: solid 2px hsl(0, 90%, 30%)">00111</span></code>
 +
 
 +
==== Effect ====
 +
Sent when a client is to play a sound or particle effect.
  
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.
+
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,207: Line 2,627:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x2C
+
  |rowspan="4"| 0x21
  |rowspan="5"| Play
+
  |rowspan="4"| Play
  |rowspan="5"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  | Effect ID
  | VarInt
+
  | Int
  | The EID of the thunderbolt
+
  | The ID of the effect, see below.
 
  |-
 
  |-
  | Type
+
  | Location
  | Byte
+
  | Position
  | The global entity type, currently always 1 for thunderbolt
+
  | The location of the effect.
 
  |-
 
  |-
  | X
+
  | Data
 
  | Int
 
  | Int
  | Thunderbolt X, a [[Data Types#Fixed-point numbers|fixed-point number]]
+
  | Extra data for certain effects, see below.
 
  |-
 
  |-
  | Y
+
  | Disable Relative Volume
  | Int
+
  | Boolean
  | Thunderbolt Y, a [[Data Types#Fixed-point numbers|fixed-point number]]
+
  | See above.
|-
 
| Z
 
| Int
 
| Thunderbolt Z, a [[Data Types#Fixed-point numbers|fixed-point number]]
 
 
  |}
 
  |}
  
==== Open Window ====
+
Effect IDs:
 
 
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Name
! Bound To
+
  ! Data
! Field Name
 
  ! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x2D
+
  !colspan="3"| Sound
|rowspan="5"| Play
 
|rowspan="5"| Client
 
| Window ID
 
| Unsigned Byte
 
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
 
  |-
 
  |-
  | Window Type
+
  | 1000
  | String
+
  | Dispenser dispenses
  | The window type to use for display. See below
+
  |  
 
  |-
 
  |-
  | Window Title
+
  | 1001
  | [[Chat]]
+
  | Dispenser fails to dispense
  | The title of the window
+
  |  
 
  |-
 
  |-
  | Number Of Slots
+
  | 1002
  | Unsigned Byte
+
  | Dispenser shoots
  | Number of slots in the window (excluding the number of slots in the player inventory)
+
  |  
 
  |-
 
  |-
  | Entity ID
+
  | 1003
  | Optional Int
+
  | Ender eye launched
  | EntityHorse's EID. Only sent when Window Type is “EntityHorse”
+
  |  
|}
 
 
 
See [[Inventory#Windows|inventory windows]] 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
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  | 0x2E
+
  | 1004
  |rowspan="1"| Play
+
  | Firework shot
  |rowspan="1"| Client
+
  |  
| Window ID
 
| Unsigned Byte
 
| This is the ID of the window that was closed. 0 for inventory.
 
|}
 
 
 
==== 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
+
  | 1005
  |rowspan="3"| Play
+
  | Iron door opened
|rowspan="3"| Client
+
  |  
| Window ID
 
  | Byte
 
| The window which is being updated. 0 for player inventory. Note that all known window types include the player inventory. This packet will only be sent for the currently opened window while the player is performing actions, even if it affects the player inventory. After the window is closed, a number of these packets are sent to update the player's inventory window (0).
 
 
  |-
 
  |-
  | Slot
+
  | 1006
  | Short
+
  | Wooden door opened
  | The slot that should be updated
+
  |  
 
  |-
 
  |-
  | Slot Data
+
  | 1007
  | [[Slot Data|Slot]]
+
  | Wooden trapdoor opened
 +
|
 +
|-
 +
| 1008
 +
| Fence gate opened
 +
|
 +
|-
 +
| 1009
 +
| Fire extinguished
 
  |  
 
  |  
|}
 
 
==== Window Items ====
 
 
[[File:Inventory-slots.png|thumb|The inventory slots]]
 
 
Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x30
+
  | 1010
  |rowspan="3"| Play
+
  | Play record
  |rowspan="3"| Client
+
  | Special case, see below for more info.
| Window ID
 
| Unsigned Byte
 
| The ID of window which items are being sent for. 0 for player inventory.
 
 
  |-
 
  |-
  | Count
+
  | 1011
  | Short
+
  | Iron door closed
  | Number of elements in the following array
+
  |  
 
  |-
 
  |-
  | Slot Data
+
  | 1012
  | Array of [[Slot Data|Slot]]
+
  | Wooden door closed
 +
|
 +
|-
 +
| 1013
 +
| Wooden trapdoor closed
 +
|
 +
|-
 +
| 1014
 +
| Fence gate closed
 +
|
 +
|-
 +
| 1015
 +
| Ghast warns
 +
|
 +
|-
 +
| 1016
 +
| Ghast shoots
 +
|
 +
|-
 +
| 1017
 +
| Enderdragon shoots
 
  |  
 
  |  
|}
 
 
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 
 
==== Window Property ====
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x31
+
  | 1018
|rowspan="3"| Play
+
  | Blaze shoots
|rowspan="3"| Client
 
| Window ID
 
  | Unsigned Byte
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Property
+
  | 1019
  | Short
+
  | Zombie attacks wood door
  | The property to be updated, see below
+
  |  
 
  |-
 
  |-
  | Value
+
  | 1020
  | Short
+
  | Zombie attacks iron door
  | The new value for the property, see below
+
  |  
  |}
+
  |-
 
+
| 1021
'''Furnace'''
+
  | Zombie breaks wood door
 
+
  |
Properties:
 
 
 
* 0: Progress arrow
 
* 1: Fire icon (fuel)
 
 
 
Values:
 
 
 
* 0–200 for progress arrow
 
* 0–200 for fuel indicator
 
 
 
Ranges are presumably in in-game ticks
 
 
 
'''Enchantment Table'''
 
 
 
Properties: 0, 1 or 2 depending on the “enchantment slot” being given.
 
 
 
Values: The enchantment's level.
 
 
 
'''Beacon'''
 
 
 
* 0: Power level
 
* 1: Potion effect one
 
* 2: Potion effect two
 
 
 
'''Anvil'''
 
 
 
* 0: Maximum cost
 
 
 
'''Brewing Stand'''
 
 
 
* 0: Brew time
 
 
 
Brew time is a value between 0 and 400, with 400 making the arrow empty, and 0 making the arrow full.
 
 
 
==== Confirm Transaction ====
 
 
 
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag). This packet is also sent from the client to the server in response to a server transaction rejection packet.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x32
+
  | 1022
|rowspan="3"| Play
+
  | Wither breaks block
|rowspan="3"| Client
+
  |
| Window ID
 
  | Byte
 
  | The ID of the window that the action occurred in
 
 
  |-
 
  |-
  | Action Number
+
  | 1023
  | Short
+
  | Wither spawned
  | Every action that is to be accepted has a unique number. This field corresponds to that number.
+
  |  
 
  |-
 
  |-
  | Accepted
+
  | 1024
  | Boolean
+
  | Wither shoots
  | 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
+
  | 1025
  |rowspan="5"| Play
+
| Bat takes off
  |rowspan="5"| Client
+
  |
  | Location
+
  |-
  | Position
+
  | 1026
  |  
+
  | Zombie infects
 +
  |
 
  |-
 
  |-
  | Line 1
+
  | 1027
  | [[Chat]]
+
  | Zombie villager converted
  | First line of text in the sign
+
  |
 
  |-
 
  |-
  | Line 2
+
  | 1028
  | [[Chat]]
+
  | Ender dragon death
  | Second line of text in the sign
+
  |
 
  |-
 
  |-
  | Line 3
+
  | 1029
  | [[Chat]]
+
  | Anvil destroyed
  | Third line of text in the sign
+
  |  
 
  |-
 
  |-
  | Line 4
+
  | 1030
  | [[Chat]]
+
  | Anvil used
  | Fourth line of text in the sign
+
  |  
|}
 
 
 
==== Maps ====
 
 
 
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
+
  | 1031
|rowspan="12"| Play
+
  | Anvil landed
|rowspan="12"| Client
+
  |
  |colspan="2"| Item Damage
 
|colspan="2"| VarInt
 
  | The damage value (map ID) of the map being modified
 
 
  |-
 
  |-
  |colspan="2"| Scale
+
  | 1032
  |colspan="2"| Byte
+
  | Portal travel
 
  |  
 
  |  
|-
 
|colspan="2"| Icon Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  | 1033
| Direction And Type
+
  | Chorus flower grown
|rowspan="3"| Array
+
  |
  | Byte
 
  | 0xF0 = Direction, 0x0F = Type
 
 
  |-
 
  |-
  | X
+
  | 1034
  | Byte
+
  | Chorus flower died
 
  |  
 
  |  
 
  |-
 
  |-
  | Z
+
  | 1035
  | Byte
+
  | Brewing stand brewed
 +
|
 +
|-
 +
| 1036
 +
| Iron trapdoor opened
 
  |  
 
  |  
|-
 
|colspan="2"| Columns
 
|colspan="2"| Byte
 
| Number of columns updated
 
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | 1037
  |colspan="2"| Optional Byte
+
| Iron trapdoor closed
  | Only if Columns is more than 0; number of rows updated
+
|
 +
  |-
 +
| 1038
 +
| End portal created in overworld
 +
  |
 
  |-
 
  |-
  |colspan="2"| X
+
  | 1039
  |colspan="2"| Optional Byte
+
  | Phantom bites
  | Only if Columns is more than 0; x offset of the westernmost column
+
  |
 
  |-
 
  |-
  |colspan="2"| Z
+
  | 1040
  |colspan="2"| Optional Byte
+
  | Zombie converts to drowned
  | Only if Columns is more than 0; z offset of the northernmost row
+
  |
 
  |-
 
  |-
  |colspan="2"| Length
+
  | 1041
  |colspan="2"| Optional VarInt
+
  | Husk converts to zombie by drowning
  | Only if Columns is more than 0; length of the following array
+
  |
 
  |-
 
  |-
  |colspan="2"| Data
+
  | 1042
  |colspan="2"| Optional Array of Unsigned Byte
+
  | Grindstone used
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
+
  |
|}
 
 
 
==== Update Block Entity ====
 
 
 
Essentially a block update on a block entity.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x35
+
  | 1043
|rowspan="3"| Play
+
  | Book page turned
|rowspan="3"| Client
+
  |
| Location
 
  | Position
 
  |  
 
 
  |-
 
  |-
| Action
 
| Unsigned Byte
 
| The type of update to perform, see below
 
 
  |-
 
  |-
  | NBT Data
+
  !colspan="3"| Particle
  | Optional [[NBT|NBT Tag]]
+
  |-
  | If not present then it's a TAG_END (0)
+
  | 1500
  |}
+
  | Composter composts
 
+
|
''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
 
 
 
==== Sign Editor Open ====
 
 
 
Sent on placement of sign.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x36
+
  | 1501
|rowspan="1"| Play
+
  | Lava converts block (either water to stone, or removes existing blocks such as torches)
|rowspan="1"| Client
+
  |
| Location
 
| Position
 
|
 
  |}
 
 
 
==== Statistics ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
  ! State
 
! Bound To
 
!colspan="2"| Field Name
 
!colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x37
+
  | 1502
  |rowspan="3"| Play
+
| Redstone torch burns out
  |rowspan="3"| Client
+
  |
  |colspan="2"| Count
+
  |-
  |colspan="2"| VarInt
+
  | 1503
  | Number of elements in the following array
+
  | Ender eye placed
 +
  |
 
  |-
 
  |-
  |rowspan="2"| Statistic
+
  | 2000
  | Name
+
  | Spawns 10 smoke particles, e.g. from a fire
  |rowspan="2"| Array
+
  | Direction, see below.
| String
 
| [https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0 https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0]
 
 
  |-
 
  |-
  | Value
+
  | 2001
  | VarInt
+
  | Block break + block break sound
  | The amount to set it to
+
  | Block state, as an index into the global palette.
|}
 
 
 
==== 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
+
  | 2002
|rowspan="19"| Play
+
  | Splash potion. Particle effect + glass break sound.
|rowspan="19"| Client
+
  | RGB color as an integer (e.g. 8364543 for #7FA1FF).
  |colspan="4"| Action
 
|colspan="3"| VarInt
 
  | Determines the rest of the Player format after the UUID
 
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  | 2003
  |colspan="3"| VarInt
+
  | Eye of Ender entity break animation — particles and sound
  | Number of elements in the following array
+
  |  
 
  |-
 
  |-
  |rowspan="17"| Player
+
  | 2004
|colspan="3"| UUID
+
  | Mob spawn particle effect: smoke + flames
  |rowspan="17"| Array
 
|colspan="2"| UUID
 
 
  |  
 
  |  
 
  |-
 
  |-
  ! Action
+
  | 2005
  !colspan="2"| Field Name
+
  | Bonemeal particles
  !colspan="2"|  
+
  | How many particles to spawn (if set to 0, 15 are spawned).
!
 
 
  |-
 
  |-
  |rowspan="10"| 0: add player
+
  | 2006
|colspan="2"| Name
+
  | Dragon breath
  |colspan="2"| String
+
  |
  |  
 
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | 2007
  |colspan="2"| VarInt
+
| Instant splash potion. Particle effect + glass break sound.
  | Number of elements in the following array
+
| RGB color as an integer (e.g. 8364543 for #7FA1FF).
 +
  |-
 +
| 2008
 +
| Ender dragon destroys block
 +
  |
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | 2009
| Name
+
  | Wet sponge vaporizes in nether
|rowspan="4"| Array
+
  |
  | String
 
  |  
 
 
  |-
 
  |-
  | Value
+
  | 3000
  | String
+
  | End gateway spawn
|
 
|-
 
| Is Signed
 
| Boolean
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Signature
+
  | 3001
  | Optional String
+
  | Enderdragon growl
  | Only if Is Signed is true
+
  |
 +
|}
 +
 
 +
Smoke directions:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Direction
 
  |-
 
  |-
  |colspan="2"| Gamemode
+
  | 0
|colspan="2"| VarInt
+
  | Down
  |  
 
 
  |-
 
  |-
  |colspan="2"| Ping
+
  | 1
|colspan="2"| VarInt
+
  | Up
  |  
 
 
  |-
 
  |-
  |colspan="2"| Has Display Name
+
  | 2
|colspan="2"| Boolean
+
  | North
  |  
 
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | 3
|colspan="2"| Optional [[Chat]]
+
  | South
  | Only if Has Display Name is true
 
 
  |-
 
  |-
  | 1: update gamemode
+
  | 4
|colspan="2"| Gamemode
+
  | West
|colspan="2"| VarInt
 
|
 
|-
 
| 2: update latency
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
  |  
 
 
  |-
 
  |-
  |rowspan="2"| 3: update display name
+
  | 5
|colspan="2"| Has Display Name
+
  | East
|colspan="2"| Boolean
 
|
 
|-
 
|colspan="2"| Display Name
 
|colspan="2"| Optional [[Chat]]
 
| Only send if Has Display Name is true
 
|-
 
| 4: remove player
 
|colspan="2"| ''no fields''
 
|colspan="2"|
 
  |  
 
 
  |}
 
  |}
  
==== Player Abilities ====
+
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 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.
+
==== Particle ====
  
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).
+
Displays the named particle
 
 
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"
Line 2,746: Line 2,939:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x39
+
  |rowspan="11"| 0x22
  |rowspan="3"| Play
+
  |rowspan="11"| Play
  |rowspan="3"| Client
+
  |rowspan="11"| Client
  | Flags
+
  | Particle ID
  | Byte
+
  | Int
  | Bit mask, see above
+
  | The particle ID listed in [[#Particle|the particle data type]].
 +
|-
 +
| Long Distance
 +
| Boolean
 +
| If true, particle distance increases from 256 to 65536.
 
  |-
 
  |-
  | Flying Speed
+
  | X
  | Float
+
  | Double
  |  
+
  | X position of the particle.
 
  |-
 
  |-
  | Walking Speed
+
  | Y
  | Float
+
  | Double
  |  
+
| Y position of the particle.
  |}
+
|-
 
+
  | Z
==== Tab-Complete ====
+
  | Double
 
+
| Z position of the particle.
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.
+
|-
 
+
| Offset X
{| class="wikitable"
+
| Float
  ! Packet ID
+
| This is added to the X position after being multiplied by <code>random.nextGaussian()</code>.
  ! State
+
|-
  ! Bound To
+
| Offset Y
  ! Field Name
+
| Float
  ! Field Type
+
| This is added to the Y position after being multiplied by <code>random.nextGaussian()</code>.
  ! Notes
+
|-
 +
| Offset Z
 +
  | Float
 +
  | This is added to the Z position after being multiplied by <code>random.nextGaussian()</code>.
 +
  |-
 +
  | Particle Data
 +
  | Float
 +
  | The data of each particle.
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  | Particle Count
|rowspan="2"| Play
+
  | Int
|rowspan="2"| Client
+
  | The number of particles to create.
| Count
 
  | VarInt
 
  | Number of elements in the following array
 
 
  |-
 
  |-
  | Matches
+
  | Data
  | Array of String
+
  | Varies
  | One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
  | 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.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,794: Line 2,995:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x3B
+
  |rowspan="11"| 0x23
  |rowspan="4"| Play
+
  |rowspan="11"| Play
  |rowspan="4"| Client
+
  |rowspan="11"| 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).
 +
|-
 +
|colspan="2"| Chunk Z
 +
|colspan="2"| VarInt
 +
| Chunk coordinate (block coordinate divided by 16, rounded down).
 +
|-
 +
|colspan="2"| Trust Edges
 +
|colspan="2"| Boolean
 +
| If edges should be trusted for light updates.
 +
|-
 +
|colspan="2"| Sky Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, with the lowest bit corresponding to chunk section -1 (in the void, y=-16 to y=-1) and the highest bit for chunk section 16 (above the world, y=256 to y=271).
 +
|-
 +
|colspan="2"| Block Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, with the same order as sky light.
 +
|-
 +
|colspan="2"| Empty Sky Light Mask
 +
  |colspan="2"| VarInt
 +
  | Mask containing 18 bits, which indicates sections that have 0 for all their sky light values.  If a section is set in both this mask and the main sky light mask, it is ignored for this mask and it is included in the sky light arrays (the notchian server does not create such masks).  If it is only set in this mask, it is not included in the sky light arrays.
 +
|-
 +
|colspan="2"| Empty Block Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, which indicates sections that have 0 for all their block light values.  If a section is set in both this mask and the main block light mask, it is ignored for this mask and it is included in the block light arrays (the notchian server does not create such masks).  If it is only set in this mask, it is not included in the block light arrays.
 +
|-
 +
|rowspan="2"| Sky Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048).
 
  |-
 
  |-
  | Mode
+
  | Sky Light array
  | Byte
+
  | Array of 2048 bytes
  | 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.  
+
  | 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.
 
  |-
 
  |-
  | Objective Value
+
  |rowspan="2"| Block Light arrays
  | Optional String
+
  | Length
  | Only if mode is 0 or 2. The text to be displayed for the score
+
  |rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048).
 
  |-
 
  |-
  | Type
+
  | Block Light array
  | Optional String
+
  | Array of 2048 bytes
  | Only if mode is 0 or 2. “integer” or “hearts”
+
  | 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 ====
+
Individual block or sky light arrays are given for each block with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates. Even-indexed items (those with an even x coordinate, starting at 0) are packed into the low bits, odd-indexed into the high bits.
 +
 
 +
For the arrays: there are 18 of each, 18 block light arrays and 18 sky light arrays. Each array is in the format described, 2048 as a VarInt, followed by 2048 bytes which describe 4096 items. The update masks use their 18 least significant bits to indicate whether or not the packet will include an array at that index. For example: if all bits except for the least significant bit are set to 1, and the least significant bit is set to 0, then all arrays except for array #0 are included (for a total of 17 arrays or 17 * 2048 bytes).
 +
 
 +
==== Join Game ====
  
This is sent to the client when it should update a scoreboard item.  
+
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,830: Line 3,067:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x3C
+
  |rowspan="16"| 0x24
  |rowspan="4"| Play
+
  |rowspan="16"| Play
  |rowspan="4"| Client
+
  |rowspan="16"| Client
  | Score Name
+
  | Entity ID
  | String
+
  | Int
  | The name of the score to be updated or removed
+
  | The player's Entity ID (EID).
 
  |-
 
  |-
  | Action
+
  | Is hardcore
 +
| Boolean
 +
|
 +
|-
 +
| Gamemode
 +
| Unsigned Byte
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
 +
|-
 +
| 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)
 +
|-
 +
| World Count
 +
| VarInt
 +
| Size of the following array.
 +
|-
 +
| World Names
 +
| Array of Identifier
 +
| Identifiers for all worlds on the server.
 +
|-
 +
| Dimension Codec
 +
| [[NBT|NBT Tag Compound]]
 +
| The full extent of these is still unknown, but the tag represents a dimension and biome registry. See below for the vanilla default.
 +
|-
 +
| Dimension
 +
| [[NBT|NBT Tag Compound]]
 +
| Valid dimensions are defined per dimension registry sent before this. The structure of this tag is a dimension type (see below).
 +
|-
 +
| World Name
 +
| Identifier
 +
| Name of the world being spawned into.
 +
|-
 +
| Hashed seed
 +
| Long
 +
| First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
 +
|-
 +
| Max Players
 +
| VarInt
 +
| Was once used by the client to draw the player list, but now is ignored.
 +
|-
 +
| View Distance
 +
| VarInt
 +
| Render distance (2-32).
 +
|-
 +
| 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.
 
  |-
 
  |-
  | Objective Name
+
  | Is Debug
  | String
+
  | Boolean
  | The name of the objective the score belongs to
+
  | True if the world is a {{Minecraft Wiki|debug mode}} world; debug mode worlds cannot be modified and have predefined blocks.
 
  |-
 
  |-
  | Value
+
  | Is Flat
  | Optional VarInt
+
  | Boolean
  | The score to be displayed next to the entry. Only sent when Action does not equal 1.
+
  | 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.
 
  |}
 
  |}
  
==== Display Scoreboard ====
 
  
This is sent to the client when it should display a scoreboard.
+
The '''Dimension Codec''' NBT Tag Compound ([https://gist.githubusercontent.com/aramperes/44e2beefac9fe966177f2f28dd0136ab/raw/fedb31c32e27265fb916a68ad476470fc65631da/1-dimension_codec.snbt Default value in SNBT]) includes two registries: "minecraft:dimension_type" and "minecraft:worldgen/biome".
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  !Name
  ! State
+
  !Type
  ! Bound To
+
  !style="width: 250px;" colspan="2"| Notes
  ! Field Name
+
|-
  ! Field Type
+
  | 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
 
| String
 
| The unique name for the scoreboard to be displayed.
 
 
  |}
 
  |}
  
==== 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
 +
|-
 +
| piglin_safe
 +
| TAG_Byte
 +
|colspan="2"| Whether piglins shake and transform to zombified piglins.
 +
| 1: true, 0: false.
 +
|-
 +
| 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.
 
  |-
 
  |-
  | Team Display Name
+
  | has_skylight
  | Optional String
+
  | TAG_Byte
  | Only if Mode = 0 or 2.
+
  |colspan="2"| Whether the dimension has skylight access or not.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | Team Prefix
+
  | bed_works
  | Optional String
+
  | TAG_Byte
  | Only if Mode = 0 or 2. Displayed before the players' name that are part of this team
+
  |colspan="2"| Whether players can use a bed to sleep.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | Team Suffix
+
  | effects
  | Optional String
+
  | TAG_String
  | Only if Mode = 0 or 2. Displayed after the players' name that are part of this team
+
  |colspan="2"| ?
 +
| "minecraft:overworld", "minecraft:the_nether", "minecraft:the_end" or something else.
 
  |-
 
  |-
  | Friendly Fire
+
  | has_raids
  | Optional Byte
+
  | TAG_Byte
  | Only if Mode = 0 or 2. 0 for off, 1 for on, 3 for seeing friendly invisibles
+
  |colspan="2"| Whether players with the Bad Omen effect can cause a raid.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | 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-256.
 
  |-
 
  |-
  | Color
+
  | coordinate_scale
  | Optional Byte
+
  | TAG_Float
  | Only if Mode = 0 or 2. Same as [[Chat]] colors
+
  |colspan="2"| The multiplier applied to coordinates when traveling to the dimension.
 +
| 1: true, 0: false.
 
  |-
 
  |-
  | 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).
 +
|}
 +
 
 +
Biome registry entry:
  
More documentation on this: [http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/]
+
{| class="wikitable"
 +
!Name
 +
!Type
 +
!style="width: 250px;" colspan="2"| Notes
 +
|-
 +
| name
 +
| 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"
 
{| class="wikitable"
  ! Packet ID
+
  !colspan="2"|Name
  ! State
+
  !colspan="2"|Type
  ! Bound To
+
  !style="width: 250px;" colspan="2"| Meaning
  ! Field Name
+
  !colspan="2"|Values
  ! Field Type
+
|-
  ! Notes
+
|colspan="2"|precipitation
 +
|colspan="2"|TAG_String
 +
|colspan="2"| The type of precipitation in the biome.
 +
|colspan="2"|"rain", "snow", or "none".
 +
|-
 +
|colspan="2"| 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="2"| temperature
 +
|colspan="2"| TAG_Float
 +
|colspan="2"| The temperature factor of the biome.
 +
|colspan="2"| The default values vary between 2.0 and -0.5.
 +
|-
 +
|colspan="2"| scale
 +
|colspan="2"| TAG_Float
 +
|colspan="2"| ?
 +
|colspan="2"| The default values vary between 1.225 and 0.0.
 +
|-
 +
|colspan="2"| downfall
 +
|colspan="2"| TAG_Float
 +
|colspan="2"| ?
 +
|colspan="2"| The default values vary between 1.0 and 0.0.
 +
|-
 +
|colspan="2"| category
 +
|colspan="2"| TAG_String
 +
|colspan="2"| The category of the biome.
 +
|colspan="2"| Known values are "ocean", "plains", "desert", "forest", "extreme_hills", "taiga", "swamp", "river", "nether", "the_end", "icy", "mushroom", "beach", "jungle", "mesa", "savanna", and "none".
 +
|-
 +
|colspan="2"| temperature_modifier
 +
|colspan="2"| Optional TAG_String
 +
|colspan="2"| ?
 +
|colspan="2"| The only known value is "frozen".
 +
|-
 +
|rowspan="11"| effects
 +
| sky_color
 +
|rowspan="11"| TAG_Compound
 +
| TAG_Int
 +
|colspan="2"| The color of the sky.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| water_fog_color
 +
| TAG_Int
 +
|colspan="2"| Possibly the tint color when swimming.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| fog_color
 +
| TAG_Int
 +
|colspan="2"| Possibly the color of the fog effect when looking past the view distance.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| water_color
 +
| TAG_Int
 +
|colspan="2"| The tint color of the water blocks.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| foliage_color
 +
| Optional TAG_Int
 +
|colspan="2"| The tint color of the grass.
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| grass_color
 +
| Optional TAG_Int
 +
| colspan="2"| ?
 +
| Example: 8364543, which is #7FA1FF in RGB.
 +
|-
 +
| grass_color_modifier
 +
| Optional TAG_String
 +
|colspan="2"| Unknown, likely affects foliage color.
 +
| If set, known values are "swamp" and "dark_forest".
 +
|-
 +
| music
 +
| Optional TAG_Compound
 +
|colspan="2"| Music properties for the biome.
 +
| If present, contains the fields: replace_current_music (TAG_Byte), sound (TAG_String), max_delay (TAG_Int), min_delay (TAG_Int).
 +
|-
 +
| ambient_sound
 +
| Optional TAG_String
 +
|colspan="2"| Ambient soundtrack.
 +
| If present, the ID of a soundtrack. Example: "minecraft:ambient.basalt_deltas.loop".
 +
|-
 +
| additions_sound
 +
| Optional TAG_Compound
 +
  |colspan="2"| Additional ambient sound that plays randomly.
 +
  | If present, contains the fields: sound (TAG_String), tick_chance (TAG_Double).
 
  |-
 
  |-
  |rowspan="2"| 0x3F
+
  | mood_sound
  |rowspan="2"| Play
+
  | Optional TAG_Compound
  |rowspan="2"| Client
+
  |colspan="2"| Additional ambient sound that plays at an interval.
| Channel
+
  | If present, contains the fields: sound (TAG_String), tick_delay (TAG_Int), offset (TAG_Double), block_search_extent (TAG_Int).
| String
 
  | Name of the [[plugin channel]] used to send the data
 
 
  |-
 
  |-
  | Data
+
  | particle
  | Byte Array
+
  | Optional TAG_Compound
  | Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].
+
  |colspan="2"| Particles that appear randomly in the biome.
 +
| If present, contains the fields: probability (TAG_Float), options (TAG_Compound). The "options" compound contains the field "type" (TAG_String), which identifies the particle type.
 
  |}
 
  |}
  
==== 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 2,972: Line 3,417:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x40
+
  |rowspan="17"| 0x25
  |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 (1x1 blocks per pixel) to 4 for a fully zoomed-out map (16x16 blocks per pixel).
  | Difficulty
+
  |-
  | Unsigned Byte
+
  |colspan="2"| Tracking Position
| 0: peaceful, 1: easy, 2: normal, 3: hard
+
  |colspan="2"| Boolean
  |}
+
  | Specifies whether player and item frame icons are shown.
 
 
==== 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
+
  |colspan="2"| Icon Count
  | 0: enter combat, 1: end combat, 2: entity dead
+
  |colspan="2"| VarInt
 +
  | Number of elements in the following array.
 
  |-
 
  |-
  | Duration
+
  |rowspan="6"| Icon
  | Optional VarInt
+
| Type
  | Only for end combat
+
|rowspan="6"| Array
 +
  | VarInt enum
 +
  | See below.
 
  |-
 
  |-
  | Player ID
+
  | X
  | Optional VarInt
+
| Byte
  | Only for entity dead
+
| 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)
  |  
+
  |-
  |}
+
  | 1
 
+
  | Green arrow (item frames)
==== World Border ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
  !colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="18"| 0x44
+
  | 2
|rowspan="18"| Play
+
  | Red arrow
|rowspan="18"| Client
 
|colspan="2"| Action
 
| VarInt
 
  | Determines the format of the rest of the packet
 
 
  |-
 
  |-
  ! Action
+
  | 3
  ! Field Name
+
  | Blue arrow
!
 
!
 
 
  |-
 
  |-
  | 0: set size
+
  | 4
  | Radius
+
  | White cross
| Double
 
| meters
 
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
  | 5
| Old Radius
+
  | Red pointer
| Double
 
  | meters
 
 
  |-
 
  |-
  | New Radius
+
  | 6
  | Double
+
  | White circle (off-map players)
| meters
 
 
  |-
 
  |-
  | Speed
+
  | 7
  | VarLong
+
  | Small white circle (far-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
+
  | 8
| X
+
  | Mansion
| Double
 
  |  
 
 
  |-
 
  |-
  | Z
+
  | 9
| Double
+
  | Temple
  |  
 
 
  |-
 
  |-
  |rowspan="8"| 3: initialize
+
  | 10
  | X
+
| White Banner
  | Double
+
|-
  |  
+
| 11
 +
| Orange Banner
 +
|-
 +
| 12
 +
| Magenta Banner
 +
  |-
 +
  | 13
 +
  | Light Blue Banner
 
  |-
 
  |-
  | Z
+
  | 14
| Double
+
  | Yellow Banner
  |  
 
 
  |-
 
  |-
  | Old Radius
+
  | 15
| Double
+
  | Lime Banner
  |  
 
 
  |-
 
  |-
  | New Radius
+
  | 16
| Double
+
  | Pink Banner
  |  
 
 
  |-
 
  |-
  | Speed
+
  | 17
| VarLong
+
  | Gray Banner
  |  
 
 
  |-
 
  |-
  | Portal Teleport Boundary
+
  | 18
  | VarInt
+
  | Light Gray Banner
| Resulting coordinates from a portal teleport are limited to +-value. Usually 29999984.
 
 
  |-
 
  |-
  | Warning Time
+
  | 19
| VarInt
+
  | Cyan Banner
  |  
 
 
  |-
 
  |-
  | Warning Blocks
+
  | 20
| VarInt
+
  | Purple Banner
  |  
 
 
  |-
 
  |-
  |rowspan="1"| 4: set warning time
+
  | 21
| Warning Time
+
  | Blue Banner
| VarInt
 
  | unit?
 
 
  |-
 
  |-
  |rowspan="1"| 5: set warning blocks
+
  | 22
  | Warning Blocks
+
| Brown Banner
  | VarInt
+
|-
  |  
+
| 23
  |}
+
| Green Banner
 
+
|-
==== Title ====  
+
| 24
 
+
| Red Banner
 +
|-
 +
| 25
 +
| Black Banner
 +
  |-
 +
  | 26
 +
  | Treasure marker
 +
  |}
 +
 
 +
==== Trade List ====
 +
 
 +
The list of trades a villager NPC is offering.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
Line 3,156: Line 3,595:
 
  ! Bound To
 
  ! Bound To
 
  !colspan="2"| Field Name
 
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x45
+
  |rowspan="18"| 0x26
  |rowspan="9"| Play
+
  |rowspan="18"| Play
  |rowspan="9"| Client
+
  |rowspan="18"| Client
  |colspan="2"| Action
+
|-
  | VarInt
+
  | colspan="2" | Window ID
  |  
+
  | colspan="2" | VarInt
 +
  | The ID of the window that is open; this is an int rather than a byte.
 
  |-
 
  |-
  ! Action
+
  | colspan="2" | Size
  ! Field Name
+
  | colspan="2" | Byte
  !
+
  | The number of trades in the following array.
!
 
 
  |-
 
  |-
  | 0: set title
+
  | rowspan="11" | Trades
  | Title Text
+
  | Input item 1
  | [[Chat]]
+
| rowspan="11" | Array
  |  
+
  | [[Slot]]
 +
  | The first item the player has to supply for this villager trade. The count of the item stack is the default "price" of this trade.
 
  |-
 
  |-
  | 1: set subtitle
+
  | Output item
| Subtitle Text
+
  | [[Slot]]
  | [[Chat]]
+
  | The item the player will receive from this villager trade.
  |  
 
 
  |-
 
  |-
  |rowspan="3"| 2: set times and display
+
  | Has second item
| Fade In
+
  | Boolean
  | Int
+
  | Whether there is a second item.
  | ticks
 
 
  |-
 
  |-
  | Stay
+
  | Input item 2
  | Int
+
  | Optional [[Slot]]
  | ticks
+
  | The second item the player has to supply for this villager trade; only present if has a second item is true.
 
  |-
 
  |-
  | Fade Out
+
  | Trade disabled
  | Int
+
  | Boolean
  | ticks
+
  | True if the trade is disabled; false if the trade is enabled.
 
  |-
 
  |-
  | 3: hide
+
  | Number of trade uses
  | ''no fields''
+
| Integer
  |  
+
| Number of times the trade has been used so far. If equal to the maximum number of trades, the client will display a red X.
  |  
+
|-
 +
| Maximum number of trade uses
 +
| Integer
 +
| Number of times this trade can be used before it's exhausted.
 +
|-
 +
| XP
 +
| Integer
 +
| Amount of XP both the player and the villager will earn each time the trade is used.
 +
|-
 +
| Special Price
 +
| Integer
 +
| Can be zero or negative. The number is added to the price when an item is discounted due to player reputation or other effects.
 +
|-
 +
| Price Multiplier
 +
| Float
 +
| Can be low (0.05) or high (0.2). Determines how much demand, player reputation, and temporary effects will adjust the price.
 +
|-
 +
| Demand
 +
| Integer
 +
| Can be zero or a positive number. Causes the price to increase when a trade is used repeatedly.
 +
|-
 +
|colspan="2"| Villager level
 +
|colspan="2"| VarInt
 +
| Appears on the trade GUI; meaning comes from the translation key <code>merchant.level.</code> + level.
 +
1: Novice, 2: Apprentice, 3: Journeyman, 4: Expert, 5: Master.
 +
|-
 +
|colspan="2"| Experience
 +
  |colspan="2"| VarInt
 +
| Total experience for this villager (always 0 for the wandering trader).
 +
|-
 +
|colspan="2"| Is regular villager
 +
  |colspan="2"| Boolean
 +
  | True if this is a regular villager; false for the wandering trader.  When false, hides the villager level and some other GUI elements.
 
  |-
 
  |-
  | 4: reset
+
  |colspan="2"| Can restock
  | ''no fields''
+
  |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.
  |  
 
 
  |}
 
  |}
  
“Hide” makes the title disappear, but if you run times again the same title will appear. “Reset” erases the text.
+
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]]
 +
{{-}}
 +
 
 +
==== Entity Position ====
 +
 
 +
This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Entity Teleport|Entity Teleport]] should be sent instead.
  
==== Set Compression ====
+
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,217: Line 3,695:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x46
+
  |rowspan="5"| 0x27
  |rowspan="1"| Play
+
  |rowspan="5"| Play
  |rowspan="1"| Client
+
  |rowspan="5"| Client
  | Threshold
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Packets of this size or higher may be compressed
+
  |  
 +
|-
 +
| 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>.
 +
|-
 +
| On Ground
 +
| Boolean
 +
|
 
  |}
 
  |}
  
==== Player List Header/Footer ====
+
==== 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,235: Line 3,731:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x47
+
  |rowspan="7"| 0x28
  |rowspan="2"| Play
+
  |rowspan="7"| Play
  |rowspan="2"| Client
+
  |rowspan="7"| Client
  | Header
+
  | Entity ID
  | [[Chat]]
+
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Footer
+
  | Delta X
  | [[Chat]]
+
  | 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
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Resource Pack Send ====  
+
==== Entity Rotation ====
 +
 
 +
This packet is sent by the server when an entity rotates.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,257: Line 3,775:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x48
+
  |rowspan="4"| 0x29
  |rowspan="2"| Play
+
  |rowspan="4"| Play
  |rowspan="2"| Client
+
  |rowspan="4"| Client
  | URL
+
  | Entity ID
  | String
+
  | VarInt
  | The URL to the resource pack.
+
  |  
 +
|-
 +
| Yaw
 +
| Angle
 +
| New angle, not a delta.
 
  |-
 
  |-
  | Hash
+
  | Pitch
  | String
+
  | Angle
  | 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
+
  | New angle, not a delta.
 +
|-
 +
| On Ground
 +
| Boolean
 +
|
 
  |}
 
  |}
  
==== Update Entity NBT ====  
+
==== Entity Movement ====
 +
 
 +
This packet may be used to initialize an entity.
 +
 
 +
For player entities, either this packet or any move/look packet is sent every game tick. So the meaning of this packet is basically that the entity did not move/look since the last such packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,279: Line 3,809:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x49
+
  | 0x2A
  |rowspan="2"| Play
+
  | Play
  |rowspan="2"| Client
+
  | Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
|
 
|-
 
| Tag
 
| [[NBT|NBT Tag]]
 
 
  |  
 
  |  
 
  |}
 
  |}
  
=== Serverbound ===
+
==== Vehicle Move (clientbound) ====
  
==== Keep Alive ====
+
Note that all fields use absolute positioning and do not allow for relative positioning.
 
 
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,305: Line 3,829:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x00
+
  |rowspan="5"| 0x2B
  |rowspan="1"| Play
+
  |rowspan="5"| Play
  |rowspan="1"| Server
+
  |rowspan="5"| Client
  | Keep Alive ID
+
  | X
  | VarInt
+
  | Double
  |  
+
  | Absolute position (X coordinate).
 +
|-
 +
| Y
 +
| Double
 +
| Absolute position (Y coordinate).
 +
|-
 +
| Z
 +
| Double
 +
| Absolute position (Z coordinate).
 +
|-
 +
| Yaw
 +
| Float
 +
| Absolute rotation on the vertical axis, in degrees.
 +
|-
 +
| Pitch
 +
| Float
 +
| Absolute rotation on the horizontal axis, in degrees.
 
  |}
 
  |}
  
==== Chat Message ====
+
==== Open Book ====
  
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.
+
Sent when a player right clicks with a signed book. This tells the client to open the book GUI.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,325: Line 3,865:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x01
+
  | 0x2C
  |rowspan="1"| Play
+
  | Play
  |rowspan="1"| Server
+
  | Client
  | Message
+
  | Hand
  | String
+
  | VarInt enum
  | The client sends the raw input, not [[Chat]]
+
  | 0: Main hand, 1: Off hand .
 
  |}
 
  |}
  
==== Use Entity ====
+
==== Open Window ====
  
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
+
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.  For horses, use [[#Open Horse Window|Open Horse Window]].
 
 
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,349: Line 3,885:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x02
+
  |rowspan="3"| 0x2D
  |rowspan="5"| Play
+
  |rowspan="3"| Play
  |rowspan="5"| Server
+
  |rowspan="3"| Client
  | Target
+
  | Window ID
 
  | VarInt
 
  | VarInt
  |  
+
  | A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
  |-
 
  |-
  | Type
+
  | Window Type
 
  | VarInt
 
  | VarInt
  | 0: interact, 1: attack, 2: interact at
+
  | The window type to use for display. Contained in the <code>minecraft:menu</code> registry; see [[Inventory]] for the different values.
 
  |-
 
  |-
  | Target X
+
  | Window Title
  | Optional Float
+
  | [[Chat]]
  | Only if Type is interact at
+
  | The title of the window.
|-
 
| Target Y
 
| Optional Float
 
| Only if Type is interact at
 
|-
 
| Target Z
 
| Optional Float
 
| Only if Type is interact at
 
 
  |}
 
  |}
  
==== Player ====
+
==== Open Sign Editor ====
 
 
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
 
  
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.
+
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]]. There must already be a sign at the given location (which the client does not do automatically) - send a [[#Block Change|Block Change]] first.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,387: Line 3,913:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x03
+
  | 0x2E
  |rowspan="1"| Play
+
  | Play
  |rowspan="1"| Server
+
  | Client
  | On Ground
+
  | Location
  | Boolean
+
  | Position
  | True if the client is on the ground, false otherwise
+
  |  
 
  |}
 
  |}
  
==== Player Position ====
+
==== Craft Recipe Response ====
 
 
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?)”
 
  
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”.
+
Response to the serverbound packet ([[#Craft Recipe Request|Craft Recipe Request]]), with the same recipe ID. Appears to be used to notify the UI.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,411: Line 3,933:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x04
+
  |rowspan="2"| 0x2F
  |rowspan="4"| Play
+
  |rowspan="2"| Play
  |rowspan="4"| Server
+
  |rowspan="2"| Client
  | X
+
  | Window ID
  | Double
+
  | Byte
  | Absolute position
+
  |
 
  |-
 
  |-
  | Feet Y
+
  | Recipe
  | Double
+
  | Identifier
  | Absolute position, normally Head Y - 1.62
+
  | A recipe ID.
|-
+
  |}
| Z
 
| Double
 
| Absolute position
 
|-
 
| On Ground
 
| Boolean
 
| True if the client is on the ground, false otherwise
 
  |}
 
 
 
==== Player Look ====
 
[[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]]
 
[[File:Yaw.png|thumb|The unit circle of yaw, redrawn]]
 
 
 
Updates the direction the player is looking in.
 
 
 
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.
+
==== Player Abilities (clientbound) ====
  
The yaw of player (in degrees), standing at point (x0, z0) and looking towards point (x, z) one can be calculated with:
+
The latter 2 floats are used to indicate the field of view and flying speed respectively, while the first byte is used to determine the value of 4 booleans.
 
 
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 3,467: Line 3,957:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x05
+
  |rowspan="3"| 0x30
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
  |rowspan="3"| Server
+
  |rowspan="3"| Client
  | Yaw
+
  | Flags
 +
| Byte
 +
| Bit field, see below.
 +
|-
 +
| Flying Speed
 
  | Float
 
  | Float
  | Absolute rotation on the X Axis, in degrees
+
  | 0.05 by default.
 
  |-
 
  |-
  | Pitch
+
  | Field of View Modifier
 
  | Float
 
  | Float
  | Absolute rotation on the Y Axis, in degrees
+
  | Modifies the field of view, like a speed potion. A Notchian server will use the same value as the movement speed sent in the [[#Entity_Properties|Entity Properties]] packet, which defaults to 0.1 for players.
|-
 
| On Ground
 
| Boolean
 
| True if the client is on the ground, False otherwise
 
 
  |}
 
  |}
  
==== Player Position And Look ====
+
About the flags:
 
 
A combination of [[#Player Look|Player Look]] and [[#Player Position|Player Position]].
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x06
+
  ! Field
  |rowspan="6"| Play
+
  ! Bit
|rowspan="6"| Server
 
| X
 
| Double
 
| Absolute position
 
 
  |-
 
  |-
  | Feet Y
+
  | Invulnerable
  | Double
+
  | 0x01
| Absolute feet position, normally Head Y - 1.62
 
 
  |-
 
  |-
  | Z
+
  | Flying
  | Double
+
  | 0x02
| Absolute position
 
 
  |-
 
  |-
  | Yaw
+
  | Allow Flying