Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
m (Had a bit of fun with brewing, figured I'd share something I learned. Please, feel free to change the format if I got it wrong.)
(Fixed a link)
 
(517 intermediate revisions by 82 users not shown)
Line 1: Line 1:
This page presents a dissection of the current stable [http://minecraft.net/game/ Minecraft] protocol. The current pre-release protocol is documented [[Pre-release_protocol|elsewhere]]. The protocol for Pocket Minecraft is substantially different, and is documented at [[Pocket Minecraft 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.15.2, protocol 578]]). For the Java Edition pre-releases, see [[Pre-release protocol]]. For the incomplete Bedrock Edition docs, see [[Bedrock Protocol]]. For the old Pocket Edition, see [[Pocket Edition Protocol Documentation]].
 +
}}
  
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]).
+
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 [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.
  
{{Warning|As of 1.7 strings are now UTF-8 (prefixed with a VarInt giving the string's length in bytes) instead of UTF-16.}}
+
The changes between versions may be viewed at [[Protocol History]].
  
{{Warning|As of 1.7.6 all UUIDs used in the protocol now contain '-'. The session server still returns them without}}
+
== Definitions ==
  
The changes between versions may be viewed at [[Protocol History]]
+
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]].
  
== Definitions ==
+
=== Data types ===
 +
 
 +
{{:Data types}} <!-- Transcluded contents of Data types article in here — go to that page if you want to edit it -->
 +
 
 +
=== Other definitions ===
  
=== Data types ===
+
{| class="wikitable"
 +
|-
 +
! Term
 +
! Definition
 +
|-
 +
| Player
 +
| When used in the singular, Player always refers to the client connected to the server.
 +
|-
 +
| Entity
 +
| Entity refers to any item, player, mob, minecart or boat etc. See {{Minecraft Wiki|Entity|the Minecraft Wiki article}} for a full list.
 +
|-
 +
| EID
 +
| An EID — or Entity ID — is a 4-byte sequence used to identify a specific entity. An entity's EID is unique on the entire server.
 +
|-
 +
| 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.
 +
|-
 +
| 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.15.2.html burger].
  
<!-- Transcluded contents of data types page in here - go to that page if you want to edit it -->
+
Alternatively, the vanilla server now includes an option to export the current block state ID mapping, by running <code>java -cp minecraft_server.jar net.minecraft.data.Main --reports</code>.  See [[Data Generators]] for more information.
 +
|-
 +
| Notchian
 +
| The official implementation of vanilla Minecraft as developed and released by Mojang.
 +
|}
  
{{:Data Types}}
+
== Packet format ==
  
=== Other definitions ===
+
=== Without compression ===
  
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Field Name
! Term
+
! Field Type
! Definition
+
! Notes
|-
+
|-
| Player
+
| Length
| When used in the singular, Player always refers to the client connected to the server
+
| VarInt
|-
+
| Length of Packet ID + Data
| Entity
+
|-
| Entity refers to any item, player, mob, minecart or boat in the world. This definition is subject to change as Notch extends the protocol
+
| Packet ID
|-
+
| VarInt
| EID
+
|  
| An EID - or Entity ID - is a unique 4-byte integer used to identify a specific entity
+
|-
|-
+
| Data
| XYZ
+
| Byte Array
| In this document, the axis names are the same as those used by Notch. Y points upwards, X points South, and Z points West.
+
| Depends on the connection state and packet ID, see the sections below
|-
+
|}
!colspan="2"|See also: [[Units of Measurement]]
 
|}
 
  
== Packets ==
+
=== With compression ===
  
=== Protocol Version ===
+
Once a [[#Set Compression|Set Compression]] packet (with a non-negative threshold) is sent, [[wikipedia:Zlib|zlib]] compression is enabled for all following packets. The format of a packet changes slighty to include the size of the uncompressed packet.
1.7.2 - 4
 
  
1.7.6 - 5
+
{| class=wikitable
 +
! Compressed?
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| No
 +
| Packet Length
 +
| VarInt
 +
| Length of Data Length + compressed length of (Packet ID + Data)
 +
|-
 +
| No
 +
| Data Length
 +
| VarInt
 +
| Length of uncompressed (Packet ID + Data) or 0
 +
|-
 +
|rowspan="2"| Yes
 +
| Packet ID
 +
| VarInt
 +
| zlib compressed packet ID (see the sections below)
 +
|-
 +
| Data
 +
| Byte Array
 +
| zlib compressed packet data (see the sections below)
 +
|}
  
== Packet format ==
+
The length given by the Packet Length field is the number of bytes that remain in that packet, including the Data Length field.
 +
 
 +
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
 +
 
 +
If compressed, the uncompressed length of (Packet ID + Data) must be equal to or over the threshold set in the packet [[#Set Compression|Set Compression]], otherwise the receiving party will disconnect.
  
{| class="wikitable"
+
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.
! Field Name !! Field Type !! Notes
 
|-
 
| Length || VarInt || Length of packet data + length of the packet ID
 
|-
 
| Packet ID || VarInt ||
 
|-
 
| Data || ||
 
|}
 
  
 
== 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 ===
  
 
==== Handshake ====
 
==== Handshake ====
 +
 
This causes the server to switch into the target state.
 
This causes the server to switch into the target state.
 +
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=4 | 0x00 || rowspan=4 | Handshake || rowspan=4 | Server
+
! Bound To
| Protocol Version || VarInt || (4 as of 1.7.2)
+
! Field Name
|-
+
! Field Type
| Server Address (hostname or IP) || String || localhost
+
! Notes
|-  
+
|-
| Server Port || Unsigned Short|| 25565
+
|rowspan="4"| 0x00
|-
+
|rowspan="4"| Handshaking
| Next state || VarInt || 1 for status, 2 for login
+
|rowspan="4"| Server
|}
+
| Protocol Version
 +
| VarInt
 +
| See [[protocol version numbers]] (currently 578 in Minecraft 1.15.2)
 +
|-
 +
| Server Address
 +
| String (255)
 +
| Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. The Notchian server does not use this information. 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
 +
| Unsigned Short
 +
| Default is 25565.  The Notchian server does not use this information.
 +
|-
 +
| Next State
 +
| VarInt Enum
 +
| 1 for [[#Status|status]], 2 for [[#Login|login]]
 +
|}
  
== Play ==
+
==== Legacy Server List Ping ====
 +
 
 +
{{Warning|This packet uses a nonstandard format. It is never length-prefixed, and the packet ID is an Unsigned Byte instead of a VarInt.}}
 +
 
 +
While not technically part of the current protocol, legacy clients may send this packet to initiate [[Server List Ping]], and modern servers should handle it correctly.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| 0xFE
 +
| Handshaking
 +
| Server
 +
| Payload
 +
| Unsigned Byte
 +
| always 1 (<code>0x01</code>)
 +
|}
 +
 
 +
See [[Server List Ping#1.6]] for the details of the protocol that follows this packet.
 +
 
 +
== Status ==
 +
{{Main|Server List Ping}}
  
 
=== Clientbound ===
 
=== Clientbound ===
  
==== Keep Alive ====
+
==== Response ====
  
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x00
 +
|rowspan="2"| Status
 +
|rowspan="2"| Client
 +
|-
 +
| JSON Response
 +
| String (32767)
 +
| See [[Server List Ping#Response]]; as with all strings this is prefixed by its length as a VarInt
 +
|}
 +
 
 +
==== Pong ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Client
+
! Bound To
| Keep Alive ID || Int ||
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x01
 +
|rowspan="1"| Status
 +
|rowspan="1"| Client
 +
| Payload
 +
| Long
 +
| Should be the same as sent by the client
 +
|}
  
==== Join Game ====
+
=== Serverbound ===
See [[Protocol Encryption]] for information on logging in.
+
 
 +
==== Request ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=6 | 0x01 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| Entity ID || Int || The player's Entity ID
+
! Field Name
|-
+
! Field Type
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. Bit 3 (0x8) is the hardcore flag
+
! Notes
|-
+
|-
| Dimension || Byte || -1: nether, 0: overworld, 1: end
+
|rowspan="1"| 0x00
|-
+
| Status
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard
+
| Server
|-
+
|colspan="3"| ''no fields''
| Max Players || Unsigned Byte || Used by the client to draw the player list
+
|}
|-
+
 
| Level Type || String || default, flat, largeBiomes, amplified, default_1_1
+
==== Ping ====
|}
 
{{Warning|If the Dimension isn't valid then the client will crash}}
 
  
==== Chat Message ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x02 || rowspan=1 | Play || rowspan=1 | Client
+
! Bound To
| JSON Data || String || [[Chat]], Limited to 32767 bytes
+
! Field Name
|}
+
! Field Type
{{Warning|Malformed JSON will disconnect the client}}
+
! Notes
 +
|-
 +
|rowspan="1"| 0x01
 +
|rowspan="1"| Status
 +
|rowspan="1"| Server
 +
| Payload
 +
| Long
 +
| May be any number. Notchian clients use a system-dependent time value which is counted in milliseconds.
 +
|}
 +
 
 +
== 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]].
  
==== Time Update ====
+
See [[Protocol Encryption]] for details.
 +
 
 +
=== Clientbound ===
  
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.
+
==== Disconnect (login) ====
  
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x00
 +
|rowspan="1"| Login
 +
|rowspan="1"| Client
 +
| Reason
 +
| [[Chat]]
 +
|
 +
|}
  
The default SMP server increments the time by <code>20</code> every second.
+
==== Encryption Request ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x03 || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Age of the world || Long || In ticks; not changed by server commands
+
! Field Name
|-
+
! Field Type
| 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
+
! Notes
|}
+
|-
 +
|rowspan="5"| 0x01
 +
|rowspan="5"| Login
 +
|rowspan="5"| Client
 +
| Server ID
 +
| String (20)
 +
| Appears to be empty
 +
|-
 +
| Public Key Length
 +
| VarInt
 +
| Length of Public Key
 +
|-
 +
| Public Key
 +
| Byte Array
 +
|  
 +
|-
 +
| 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
 +
|}
 +
 
 +
See [[Protocol Encryption]] for details.
 +
 
 +
==== Login Success ====
  
==== Entity Equipment ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x04 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| EntityID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| Slot || Short || Equipment slot: 0=held, 1-4=armor slot (1 - boots, 2 - leggings, 3 - chestplate, 4 - helmet)
+
! Notes
|-
+
|-
| Item || [[Slot_Data|Slot]] || Item in slot format
+
|rowspan="2"| 0x02
|}
+
|rowspan="2"| Login
 +
|rowspan="2"| Client
 +
| UUID
 +
| String (36)
 +
| Unlike in other packets, this field contains the UUID as a string with hyphens.
 +
|-
 +
| Username
 +
| String (16)
 +
|  
 +
|}
 +
 
 +
This packet switches the connection state to [[#Play|play]].
 +
 
 +
{{Warning2|The (notchian) server might take a bit to fully transition to the Play state, so it's recommended to wait before sendings Play packets, either by setting a timeout, or waiting for Play packets from the server (usually [[#Player Info|Player Info]]).
  
==== Spawn Position ====
+
The notchian client doesn't send any (non-[[#Keep Alive|keep alive]]) packets until the next tick/[[#Time Update|time update]] packet.
 +
}}
 +
 
 +
==== Set Compression ====
  
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.
+
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"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x05 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| X || Int || Spawn X in block coordinates
+
! Field Name
|-
+
! Field Type
| Y || Int || Spawn Y in block coordinates
+
! Notes
|-
+
|-
| Z || Int || Spawn Z in block coordinates
+
|rowspan="1"| 0x03
|}
+
|rowspan="1"| Login
 +
|rowspan="1"| Client
 +
| Threshold
 +
| VarInt
 +
| Maximum size of a packet before it is compressed
 +
|}
  
==== Update Health ====
+
==== Login Plugin Request ====
  
Sent by the server to update/set the health of the player it is sent to.
+
Used to implement a custom handshaking flow together with [[#Login_Plugin_Response | Login Plugin Response]].
  
Food 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.
+
Unlike plugin messages in "play" mode, these messages follow a lock-step request/response scheme, where the client is expected to respond to a request indicating whether it understood. The notchian client always responds that it hasn't understood, and sends an empty payload.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x06 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Health || Float || 0 or less = dead, 20 = full HP
+
! Field Name
|-
+
! Field Type
| Food || Short || 0 - 20
+
! Notes
|-
+
|-
| Food Saturation || Float || Seems to vary from 0.0 to 5.0 in integer increments
+
|rowspan="3"| 0x04
|}
+
|rowspan="3"| Login
 +
|rowspan="3"| Client
 +
| Message ID
 +
| VarInt
 +
| Generated by the server - should be unique to the connection.
 +
|-
 +
| Channel
 +
| Identifier
 +
| Name of the [[plugin channel]] used to send the data
 +
|-
 +
| Data
 +
| Byte Array
 +
| Any data, depending on the channel. The length of this array must be inferred from the packet length.
 +
|}
 +
 
 +
=== Serverbound ===
 +
 
 +
==== Login Start  ====
  
==== Respawn ====
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x00
 +
|rowspan="1"| Login
 +
|rowspan="1"| Server
 +
| Name
 +
| String (16)
 +
| Player's Username
 +
|}
  
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.
+
==== Encryption Response ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=4 | 0x07 || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| Dimension || Int || -1: The Nether, 0: The Overworld, 1: The End
+
! Field Name
|-
+
! Field Type
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard.
+
! Notes
|-
+
|-
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
+
|rowspan="4"| 0x01
|-
+
|rowspan="4"| Login
| Level Type || String || Same as [[Protocol#Join_Game|Join Game]]
+
|rowspan="4"| Server
|}
+
| Shared Secret Length
{{Warning|If the Dimension isn't valid then the client will crash}}
+
| VarInt
 +
| Length of Shared Secret
 +
|-
 +
| Shared Secret
 +
| Byte Array
 +
|  
 +
|-
 +
| Verify Token Length
 +
| VarInt
 +
| Length of Verify Token
 +
|-
 +
| Verify Token
 +
| Byte Array
 +
|  
 +
|}
  
{{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)}}
+
See [[Protocol Encryption]] for details.
  
==== Player Position And Look ====
+
==== Login Plugin Response ====
  
Updates the players position on the server.  
+
{| class="wikitable"
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?)"
+
! Packet ID
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"
+
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="3"| 0x02
 +
|rowspan="3"| Login
 +
|rowspan="3"| Server
 +
| Message ID
 +
| VarInt
 +
| 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.
 +
|-
 +
| Data
 +
| Optional Byte Array
 +
| Any data, depending on the channel. The length of this array must be inferred from the packet length.
 +
|}
  
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.
+
== Play ==
  
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
+
=== Clientbound ===
  
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
+
==== Spawn Entity ====
  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:
+
Sent by the server when a vehicle or other non-living entity is created.
  x = -cos(pitch) * sin(yaw)
 
  y = -sin(pitch)
 
  z =  cos(pitch) * cos(yaw)
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=6| 0x08 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| X || Double || Absolute position
+
! Field Name
|-
+
! Field Type
| Y || Double || Absolute position (eyes pos)
+
! Notes
|-
+
|-
| Z || Double || Absolute position
+
|rowspan="12"| 0x00
|-
+
|rowspan="12"| Play
| Yaw || Float || Absolute rotation on the X Axis, in degrees
+
|rowspan="12"| Client
|-
+
| Entity ID
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
+
| VarInt
|-
+
| EID of the entity
| On Ground || Bool || True if the client is on the ground, False otherwise
+
|-
|}
+
| Object UUID
 +
| UUID
 +
|  
 +
|-
 +
| Type
 +
| VarInt
 +
| The type of entity (same as in [[#Spawn Living Entity|Spawn Living Entity]])
 +
|-
 +
| X
 +
| Double
 +
|  
 +
|-
 +
| Y
 +
| Double
 +
|  
 +
|-
 +
| Z
 +
| Double
 +
|  
 +
|-
 +
| Pitch
 +
| Angle
 +
|
 +
|-
 +
| Yaw
 +
| Angle
 +
|  
 +
|-
 +
| Data
 +
| Int
 +
| Meaning dependent on the value of the Type field, see [[Object Data]] for details.
 +
|-
 +
| Velocity X
 +
| Short
 +
|rowspan="3"| Same units as [[#Entity Velocity|Entity Velocity]].  Always sent, but only used when Data is greater than 0 (except for some entities which always ignore it; see [[Object Data]] for details).
 +
|-
 +
| Velocity Y
 +
| Short
 +
|-
 +
| Velocity Z
 +
| Short
 +
|}
  
==== Held Item Change ====
+
==== Spawn Experience Orb ====
  
Sent to change the player's slot selection
+
Spawns one or more experience orbs.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x09 || rowspan=1 | Play || rowspan=1 | Client
+
! Bound To
| Slot || Byte || The slot which the player has selected (0-8)
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="5"| 0x01
 +
|rowspan="5"| Play
 +
|rowspan="5"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|  
 +
|-
 +
| Count
 +
| Short
 +
| The amount of experience this orb will reward once collected
 +
|}
  
==== Use Bed ====
+
==== Spawn Weather Entity ====
  
This packet tells that a player goes to bed.
+
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.
  
The client with the matching Entity ID will go into bed mode.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="5"| 0x02
 +
|rowspan="5"| Play
 +
|rowspan="5"| Client
 +
| Entity ID
 +
| VarInt
 +
| The EID of the thunderbolt
 +
|-
 +
  | Type
 +
| Byte Enum
 +
| The global entity type, currently always 1 for thunderbolt
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|}
  
This Packet is sent to all nearby players including the one sent to bed.
+
==== Spawn Living Entity ====
 +
 
 +
Sent by the server when a living entity is spawned.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=4 | 0x0A || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| Entity ID || Int || Player ID
+
! Field Name
|-
+
! Field Type
| X || Int || Bed headboard X as block coordinate
+
! Notes
|-
+
|-
| Y || Unsigned Byte || Bed headboard Y as block coordinate
+
|rowspan="12"| 0x03
|-
+
|rowspan="12"| Play
| Z || Int || Bed headboard Z as block coordinate
+
|rowspan="12"| Client
|}
+
| Entity ID
 +
| VarInt
 +
|  
 +
|-
 +
| Entity UUID
 +
| UUID
 +
|  
 +
|-
 +
| Type
 +
| VarInt
 +
| The type of mob. See [[Entities#Mobs]]
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Yaw
 +
| Angle
 +
|
 +
|-
 +
| Pitch
 +
| Angle
 +
|  
 +
|-
 +
| Head Pitch
 +
| Angle
 +
|
 +
|-
 +
| Velocity X
 +
| Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 +
|-
 +
| Velocity Y
 +
| Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 +
|-
 +
| Velocity Z
 +
| Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 +
|}
  
==== Animation ====
+
==== Spawn Painting ====
  
Sent whenever an entity should change animation.
+
This packet shows location, name, and type of painting.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x0B || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Entity ID || VarInt || Player ID
+
! Field Name
|-
+
! Field Type
| Animation || Unsigned Byte || Animation ID
+
! Notes
|}
+
|-
 +
|rowspan="5"| 0x04
 +
|rowspan="5"| Play
 +
|rowspan="5"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| Entity UUID
 +
| UUID
 +
|
 +
|-
 +
| Motive
 +
| VarInt
 +
| Panting's ID, see below
 +
|-
 +
| Location
 +
| Position
 +
| Center coordinates (see below)
 +
|-
 +
| Direction
 +
| Byte Enum
 +
| Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
 +
|}
  
Animation can be one of the following values:
+
Calculating the center of an image: given a (width × height) grid of cells, with <code>(0, 0)</code> being the top left corner, the center is <code>(max(0, width / 2 - 1), height / 2)</code>. E.g. <code>(1, 0)</code> for a 2×1 painting, or <code>(1, 2)</code> for a 4×4 painting.
 +
 
 +
List of paintings by coordinates in <code>paintings_kristoffer_zetterstrand.png</code> (where x and y are in pixels from the top left and width and height are in pixels or 16ths of a block):
  
 
{| class="wikitable"
 
{| class="wikitable"
! ID !! Animation
+
! Name
|-
+
! ID
| 0 || Swing arm
+
! x
|-
+
! y
| 1 || Damage animation
+
! width
|-
+
! height
| 2 || Leave bed
+
|-
|-
+
| <code>minecraft:kebab</code>
| 3 || Eat food
+
| 0
|-
+
| 0
| 4 || Critical effect
+
| 0
|-
+
| 16
| 5 || Magic critical effect
+
| 16
|-
+
|-
| 102 || (unknown)
+
| <code>minecraft:aztec</code>
|-
+
| 1
| 104 || Crouch
+
| 16
|-
+
| 0
| 105 || Uncrouch
+
| 16
|}
+
| 16
 +
|-
 +
| <code>minecraft:alban</code>
 +
| 2
 +
| 32
 +
| 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:aztec2</code>
 +
| 3
 +
| 48
 +
| 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:bomb</code>
 +
| 4
 +
| 64
 +
| 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:plant</code>
 +
| 5
 +
| 80
 +
| 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:wasteland</code>
 +
| 6
 +
| 96
 +
| 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:pool</code>
 +
| 7
 +
| 0
 +
| 32
 +
| 32
 +
| 16
 +
|-
 +
| <code>minecraft:courbet</code>
 +
| 8
 +
| 32
 +
| 32
 +
| 32
 +
| 16
 +
|-
 +
| <code>minecraft:sea</code>
 +
| 9
 +
| 64
 +
| 32
 +
| 32
 +
| 16
 +
|-
 +
| <code>minecraft:sunset</code>
 +
| 10
 +
| 96
 +
| 32
 +
| 32
 +
| 16
 +
|-
 +
| <code>minecraft:creebet</code>
 +
| 11
 +
| 128
 +
| 32
 +
| 32
 +
| 16
 +
|-
 +
| <code>minecraft:wanderer</code>
 +
| 12
 +
| 0
 +
| 64
 +
| 16
 +
| 32
 +
|-
 +
| <code>minecraft:graham</code>
 +
| 13
 +
| 16
 +
| 64
 +
| 16
 +
| 32
 +
|-
 +
| <code>minecraft:match</code>
 +
| 14
 +
| 0
 +
| 128
 +
| 32
 +
| 32
 +
|-
 +
| <code>minecraft:bust</code>
 +
| 15
 +
| 32
 +
| 128
 +
| 32
 +
| 32
 +
|-
 +
| <code>minecraft:stage</code>
 +
| 16
 +
| 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
 +
|}
 +
 
 +
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
  
 
==== Spawn Player ====
 
==== Spawn Player ====
  
This packet is sent by the server when a player comes into visible range, '''not''' when a player joins.
+
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
 +
 
 +
This packet must be sent after the [[#Player Info|Player Info]] packet that adds the player data for the client to use when spawning a player. If the Player Info for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player Info packet includes skin/cape data.
  
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
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.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="7"| 0x05
 +
|rowspan="7"| Play
 +
|rowspan="7"| Client
 +
| Entity ID
 +
| VarInt
 +
| Player's EID
 +
|-
 +
| Player UUID
 +
| UUID
 +
| See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Yaw
 +
| Angle
 +
|
 +
|-
 +
| Pitch
 +
| Angle
 +
|
 +
|}
 +
 
 +
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs.
 +
 
 +
In offline mode, [[Wikipedia:Universally unique identifier#Versions 3 and 5 (namespace name-based)|UUID v3]] is used with the String <code>OfflinePlayer:&lt;player name&gt;</code>, encoded in UTF-8 (and case-sensitive).
  
 
For NPCs UUID v2 should be used. Note:
 
For NPCs UUID v2 should be used. Note:
  <+Grum> i will never confirm this as a feature you know that :)
+
 
 +
<+Grum> i will never confirm this as a feature you know that :)
 +
 
 +
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 +
 
 +
==== Entity Animation (clientbound) ====
 +
 
 +
Sent whenever an entity should change animation.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x06
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| VarInt
 +
| Player ID
 +
|-
 +
| Animation
 +
| Unsigned Byte
 +
| Animation ID (see below)
 +
|}
 +
 
 +
Animation can be one of the following values:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Animation
 +
|-
 +
| 0
 +
| Swing main arm
 +
|-
 +
| 1
 +
| Take damage
 +
|-
 +
| 2
 +
| Leave bed
 +
|-
 +
| 3
 +
| Swing offhand
 +
|-
 +
| 4
 +
| Critical effect
 +
|-
 +
| 5
 +
| Magic critical effect
 +
|}
 +
 
 +
==== Statistics ====
 +
 
 +
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1).
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 +
|-
 +
|rowspan="4"| 0x07
 +
|rowspan="4"| Play
 +
|rowspan="4"| Client
 +
|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
 +
| The amount to set it to
 +
|}
 +
 
 +
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! ID
 +
! Registry
 +
|-
 +
| <code>minecraft.mined</code>
 +
| 0
 +
| Blocks
 +
|-
 +
| <code>minecraft.crafted</code>
 +
| 1
 +
| Items
 +
|-
 +
| <code>minecraft.used</code>
 +
| 2
 +
| Items
 +
|-
 +
| <code>minecraft.broken</code>
 +
| 3
 +
| Items
 +
|-
 +
| <code>minecraft.picked_up</code>
 +
| 4
 +
| Items
 +
|-
 +
| <code>minecraft.dropped</code>
 +
| 5
 +
| Items
 +
|-
 +
| <code>minecraft.killed</code>
 +
| 6
 +
| Entities
 +
|-
 +
| <code>minecraft.killed_by</code>
 +
| 7
 +
| Entities
 +
|-
 +
| <code>minecraft.custom</code>
 +
| 8
 +
| Custom
 +
|}
 +
 
 +
Blocks, Items, and Entities use block (not block state), item, and entity ids.
 +
 
 +
Custom has the following (unit only matters for clients):
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
+
! Name
|-
+
! ID
| rowspan=14 | 0x0C || rowspan=14 | Play || rowspan=14 | Client
+
! Unit
| colspan=2 | Entity ID || VarInt || Player's Entity ID
+
|-
|-
+
| <code>minecraft.leave_game</code>
| colspan=2 | Player UUID || String || Player's UUID
+
| 0
|-
+
| None
| colspan=2 | Player Name || String || Player's Name
+
|-
|-
+
| <code>minecraft.play_one_minute</code>
| colspan=2 | Data count || VarInt ||  
+
| 1
|-
+
| Time
| rowspan=3 | Data
+
|-
| Name || String || Name of the property as return by the session server's /hasJoined. E.g: textures
+
| <code>minecraft.time_since_death</code>
|-
+
| 2
| Value || String || Value of the property (base64) as return by the session server's /hasJoined
+
| Time
|-
+
|-
| Signature || String || Signature of the property (base64) as return by the session server's /hasJoined.  
+
| <code>minecraft.sneak_Time</code>
|-
+
| 3
| colspan=2 | X || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Time
|-
+
|-
| colspan=2 | Y || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| <code>minecraft.walk_one_cm</code>
|-
+
| 4
| colspan=2 | Z || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Distance
|-
+
|-
| colspan=2 | Yaw || Byte || Player rotation as a packed byte
+
| <code>minecraft.crouch_one_cm</code>
|-
+
| 5
| colspan=2 | Pitch || Byte || Player rotation as a packet byte
+
| Distance
|-
+
|-
| colspan=2 | Current Item || Short || The item the player is currently holding. Note that this should be 0 for "no item", unlike -1 used in other packets. A negative value crashes clients.
+
| <code>minecraft.sprint_one_cm</code>
|-
+
| 6
| colspan=2 | Metadata || [[Entities#Entity_Metadata_Format|Metadata]] || The client will crash if no metadata is sent
+
| Distance
|}
+
|-
{{Warning|The client will crash if no metadata is sent}}
+
| <code>minecraft.swim_one_cm</code>
{{Warning|The client will disconnect if both UUID and Name are empty}}
+
| 7
 +
| Distance
 +
|-
 +
| <code>minecraft.fall_one_cm</code>
 +
| 8
 +
| Distance
 +
|-
 +
| <code>minecraft.climb_one_cm</code>
 +
| 9
 +
| Distance
 +
|-
 +
| <code>minecraft.fly_one_cm</code>
 +
| 10
 +
| Distance
 +
|-
 +
| <code>minecraft.dive_one_cm</code>
 +
| 11
 +
| Distance
 +
|-
 +
| <code>minecraft.minecart_one_cm</code>
 +
| 12
 +
| Distance
 +
|-
 +
| <code>minecraft.boat_one_cm</code>
 +
| 13
 +
| Distance
 +
|-
 +
| <code>minecraft.pig_one_cm</code>
 +
| 14
 +
| Distance
 +
|-
 +
| <code>minecraft.horse_one_cm</code>
 +
| 15
 +
| Distance
 +
|-
 +
| <code>minecraft.aviate_one_cm</code>
 +
| 16
 +
| Distance
 +
|-
 +
| <code>minecraft.jump</code>
 +
| 17
 +
| None
 +
|-
 +
| <code>minecraft.drop</code>
 +
| 18
 +
| None
 +
|-
 +
| <code>minecraft.damage_dealt</code>
 +
| 19
 +
| Damage
 +
|-
 +
| <code>minecraft.damage_taken</code>
 +
| 20
 +
| Damage
 +
|-
 +
| <code>minecraft.deaths</code>
 +
| 21
 +
| None
 +
|-
 +
| <code>minecraft.mob_kills</code>
 +
| 22
 +
| None
 +
|-
 +
| <code>minecraft.animals_bred</code>
 +
| 23
 +
| None
 +
|-
 +
| <code>minecraft.player_kills</code>
 +
| 24
 +
| None
 +
|-
 +
| <code>minecraft.fish_caught</code>
 +
| 25
 +
| None
 +
|-
 +
| <code>minecraft.talked_to_villager</code>
 +
| 26
 +
| None
 +
|-
 +
| <code>minecraft.traded_with_villager</code>
 +
| 27
 +
| None
 +
|-
 +
| <code>minecraft.eat_cake_slice</code>
 +
| 28
 +
| None
 +
|-
 +
| <code>minecraft.fill_cauldron</code>
 +
| 29
 +
| None
 +
|-
 +
| <code>minecraft.use_cauldron</code>
 +
| 30
 +
| None
 +
|-
 +
| <code>minecraft.clean_armor</code>
 +
| 31
 +
| None
 +
|-
 +
| <code>minecraft.clean_banner</code>
 +
| 32
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_brewingstand</code>
 +
| 33
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_beacon</code>
 +
| 34
 +
| None
 +
|-
 +
| <code>minecraft.inspect_dropper</code>
 +
| 35
 +
| None
 +
|-
 +
| <code>minecraft.inspect_hopper</code>
 +
| 36
 +
| None
 +
|-
 +
| <code>minecraft.inspect_dispenser</code>
 +
| 37
 +
| None
 +
|-
 +
| <code>minecraft.play_noteblock</code>
 +
| 38
 +
| None
 +
|-
 +
| <code>minecraft.tune_noteblock</code>
 +
| 39
 +
| None
 +
|-
 +
| <code>minecraft.pot_flower</code>
 +
| 40
 +
| None
 +
|-
 +
| <code>minecraft.trigger_trapped_chest</code>
 +
| 41
 +
| None
 +
|-
 +
| <code>minecraft.open_enderchest</code>
 +
| 42
 +
| None
 +
|-
 +
| <code>minecraft.enchant_item</code>
 +
| 43
 +
| None
 +
|-
 +
| <code>minecraft.play_record</code>
 +
| 44
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_furnace</code>
 +
| 45
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_crafting_table</code>
 +
| 46
 +
| None
 +
|-
 +
| <code>minecraft.open_chest</code>
 +
| 47
 +
| None
 +
|-
 +
| <code>minecraft.sleep_in_bed</code>
 +
| 48
 +
| None
 +
|-
 +
| <code>minecraft.open_shulker_box</code>
 +
| 49
 +
| None
 +
|}
  
==== Collect Item ====
+
Units:
 +
 
 +
* None: just a normal number (formatted with 0 decimal places)
 +
* Damage: value is 10 times the normal amount
 +
* Distance: a distance in centimeters (hundredths of blocks)
 +
* Time: a time span in ticks
 +
 
 +
==== Acknowledge Player Digging ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="4"| 0x08
 +
|rowspan="4"| Play
 +
|rowspan="4"| Client
 +
| Location
 +
| Position
 +
| Position where the digging was happening
 +
|-
 +
| Block
 +
| VarInt
 +
| Block state ID of the block that should be at that position now.
 +
|-
 +
| Status
 +
| VarInt enum
 +
| Same as Player Digging.  Only Started digging (0), Cancelled digging (1), and Finished digging (2) are used.
 +
|-
 +
| Successful
 +
| Boolean
 +
| True if the digging succeeded; false if the client should undo any changes it made locally.  (How does this work?)
 +
|}
 +
 
 +
==== 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)
  
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 and [Player Position & Look packet sent by the client.
+
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"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x0D || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Collected Entity ID || Int ||
+
! Field Name
|-
+
! Field Type
| Collector Entity ID || Int ||
+
! Notes
|}
+
|-
 +
|rowspan="3"| 0x09
 +
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Entity ID
 +
| VarInt
 +
| Entity ID of the entity breaking the block
 +
|-
 +
| Location
 +
| Position
 +
| Block Position
 +
|-
 +
| Destroy Stage
 +
| Byte
 +
| 0–9 to set it, any other value to remove it
 +
|}
  
==== Spawn Object ====
+
==== Block Entity Data ====
  
Sent by the server when an Object/Vehicle is created.
+
Sets the block entity associated with the block at the given location.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=8| 0x0E || rowspan=8 | Play || rowspan=8 | Client
+
! Bound To
| Entity ID || VarInt || Entity ID of the object
+
! Field Name
|-
+
! Field Type
| Type || Byte || The type of object (See [[Entities#Objects|Objects]])
+
! Notes
|-
+
|-
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="3"| 0x0A
|-
+
|rowspan="3"| Play
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]  
+
|rowspan="3"| Client
|-
+
| Location
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Position
|-
+
|  
| Pitch || Byte || The pitch in steps of 2p/256
+
|-
|-
+
| Action
| Yaw || Byte || The yaw in steps of 2p/256
+
| Unsigned Byte
|-
+
| The type of update to perform, see below
| Data || [[Object_Data|Object Data]] ||
+
|-
|}
+
| NBT Data
 +
| [[NBT|NBT Tag]]
 +
| Data to set.  May be a TAG_END (0), in which case the block entity at the given location is removed (though this is not required since the client will remove the block entity automatically on chunk unload or block removal)
 +
|}
  
==== Spawn Mob ====
+
''Action'' field:
  
Sent by the server when a Mob Entity is Spawned
+
* '''1''': Set data of a mob spawner (everything except for SpawnPotentials: current delay, min/max delay, mob to be spawned, spawn count, spawn range, etc.)
 +
* '''2''': Set command block text (command and last execution status)
 +
* '''3''': Set the level, primary, and secondary powers of a beacon
 +
* '''4''': Set rotation and skin of mob head
 +
* '''5''': Declare a conduit
 +
* '''6''': Set base color and patterns on a banner
 +
* '''7''': Set the data for a Structure tile entity
 +
* '''8''': Set the destination for a end gateway
 +
* '''9''': Set the text on a sign
 +
* '''10''': Unused
 +
* '''11''': Declare a bed
 +
* '''12''': Set data of a jigsaw block
 +
* '''13''': Set items in a campfire
 +
* '''14''': Behive information
 +
 
 +
==== Block Action ====
 +
 
 +
This packet is used for a number of actions and animations performed by blocks, usually non-persistent.
 +
 
 +
See [[Block Actions]] for a list of values.
 +
 
 +
{{Warning2|This packet uses a block ID, not a block state.  Unfortunately, block IDs are not directly included in the output from [[Data Generators]], but can manually be calculated.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=12 | 0x0F || rowspan=12 | Play || rowspan=12 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| Type || Unsigned Byte || The type of mob. See [[Entities#Mobs|Mobs]]
+
! Notes
|-
+
|-
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]  
+
|rowspan="4"| 0x0B
|-
+
|rowspan="4"| Play
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="4"| Client
|-
+
| Location
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]  
+
| Position
|-
+
| Block coordinates
| Yaw || Byte || The yaw in steps of 2p/256
+
|-
|-
+
| Action ID (Byte 1)
| Pitch || Byte || The pitch in steps of 2p/256
+
| Unsigned Byte
|-
+
| Varies depending on block — see [[Block Actions]]
| Head Pitch || Byte || The pitch in steps of 2p/256
+
|-
|-
+
| Action Param (Byte 2)
| Velocity X || Short ||
+
| Unsigned Byte
|-
+
| Varies depending on block — see [[Block Actions]]
| Velocity Y || Short ||
+
|-
|-
+
| Block Type
| Velocity Z || Short ||
+
| VarInt
|-
+
| The block type ID for the block.  This must match the block at the given coordinates.
| Metadata || [[Entities#Entity_Metadata_Format|Metadata]] ||
+
|}
|}
 
  
==== Spawn Painting ====
+
==== Block Change ====
 +
 
 +
Fired whenever a block is changed within the render distance.
 +
 
 +
{{Warning2|Changing a block in a chunk that is not loaded is not a stable action.  The Notchian client currently uses a ''shared'' empty chunk which is modified for all block changes in unloaded chunks; while in 1.9 this chunk never renders in older versions the changed block will appear in all copies of the empty chunk.  Servers should avoid sending block changes in unloaded chunks and clients should ignore such packets.}}
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x0C
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Location
 +
| Position
 +
| Block Coordinates
 +
|-
 +
| Block ID
 +
| VarInt
 +
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
 +
|}
 +
 
 +
==== Boss Bar ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="14"| 0x0D
 +
|rowspan="14"| Play
 +
|rowspan="14"| Client
 +
|colspan="2"| UUID
 +
| UUID
 +
| Unique ID for this bar
 +
|-
 +
|colspan="2"| Action
 +
| VarInt Enum
 +
| Determines the layout of the remaining packet
 +
|-
 +
! Action
 +
! Field Name
 +
!
 +
!
 +
|-
 +
|rowspan="5"| 0: add
 +
| Title
 +
| [[Chat]]
 +
|
 +
|-
 +
| Health
 +
| Float
 +
| From 0 to 1. Values greater than 1 do not crash a Notchian client, and start [https://i.johni0702.de/nA.png rendering part of a second health bar] at around 1.5.
 +
|-
 +
| Color
 +
| VarInt Enum
 +
| Color ID (see below)
 +
|-
 +
| Division
 +
| VarInt Enum
 +
| Type of division (see below)
 +
|-
 +
| Flags
 +
| Unsigned Byte
 +
| Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02)
 +
|-
 +
| 1: remove
 +
| ''no fields''
 +
| ''no fields''
 +
| Removes this boss bar
 +
|-
 +
| 2: update health
 +
| Health
 +
| Float
 +
| as above
 +
|-
 +
| 3: update title
 +
| Title
 +
| [[Chat]]
 +
|
 +
|-
 +
|rowspan="2"| 4: update style
 +
| Color
 +
| VarInt Enum
 +
| Color ID (see below)
 +
|-
 +
| Dividers
 +
| VarInt Enum
 +
| as above
 +
|-
 +
| 5: update flags
 +
| Flags
 +
| Unsigned Byte
 +
| as above
 +
|-
 +
|}
  
This packet shows location, name, and type of painting.
+
{| class="wikitable"
 +
! ID
 +
! Color
 +
|-
 +
| 0
 +
| Pink
 +
|-
 +
| 1
 +
| Blue
 +
|-
 +
| 2
 +
| Red
 +
|-
 +
| 3
 +
| Green
 +
|-
 +
| 4
 +
| Yellow
 +
|-
 +
| 5
 +
| Purple
 +
|-
 +
| 6
 +
| White
 +
|}
  
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.
+
{| class="wikitable"
 +
! ID
 +
! Type of division
 +
|-
 +
| 0
 +
| No division
 +
|-
 +
| 1
 +
| 6 notches
 +
|-
 +
| 2
 +
| 10 notches
 +
|-
 +
| 3
 +
| 12 notches
 +
|-
 +
| 4
 +
| 20 notches
 +
|}
  
2x1 (1, 0)
+
==== Server Difficulty ====
4x4 (1, 2)
 
  
 +
Changes the difficulty setting in the client's option menu
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=6 | 0x10 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| Title || String || Name of the painting. Max length 13
+
! Notes
|-
+
|-
| X || Int || Center X coordinate
+
|rowspan="2"| 0x0E
|-
+
|rowspan="2"| Play
| Y || Int || Center Y coordinate
+
|rowspan="2"| Client
|-
+
| Difficulty
| Z || Int || Center Z coordinate
+
| Unsigned Byte
|-
+
| 0: peaceful, 1: easy, 2: normal, 3: hard
| Direction || Int || Direction the painting faces (0 -z, 1 -x, 2 +z, 3 +x)
+
|-
|}
+
| Difficulty locked?
 +
| Boolean
 +
|
 +
|}
  
==== Spawn Experience Orb ====
+
==== 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.
  
Spawns one or more experience orbs.
+
{{warning2|Game info accepts json formatting but does not display it, although the deprecated §-based formatting works.  This is not an issue when using the [[#Title|Title]] packet, so prefer that packet for displaying information in that slot.  See [https://bugs.mojang.com/browse/MC-119145 MC-119145] for more information.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=5 | 0x11 || rowspan=5 | Play || rowspan=5 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]  
+
! Notes
|-
+
|-
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="2"| 0x0F
|-
+
|rowspan="2"| Play
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="2"| Client
|-
+
| JSON Data
| Count || Short || The amount of experience this orb will reward once collected
+
| [[Chat]]
|}
+
| Limited to 32767 bytes
 +
|-
 +
| Position
 +
| Byte
 +
| 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
 +
|}
 +
 
 +
==== Multi Block Change ====
  
==== Entity Velocity ====
+
Fired whenever 2 or more blocks are changed within the same chunk on the same tick.
  
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms);
+
{{Warning|Changing blocks in chunks not loaded by the client is unsafe (see note on [[#Block Change|Block Change]]).}}
for example, -1343 would move (-1343 / 8000) = -0.167875 blocks per tick (or -3,3575 blocks per second).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=4 | 0x12 || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
!colspan="2"| Field Name
|-
+
!colspan="2"| Field Type
| Velocity X || Short || Velocity on the X axis
+
! Notes
|-
+
|-
| Velocity Y || Short || Velocity on the Y axis
+
|rowspan="6"| 0x10
|-
+
|rowspan="6"| Play
| Velocity Z || Short || Velocity on the Z axis
+
|rowspan="6"| Client
|}
+
|colspan="2"| Chunk X
 +
|colspan="2"| Int
 +
| Chunk X coordinate
 +
|-
 +
|colspan="2"| Chunk Z
 +
|colspan="2"| Int
 +
| Chunk Z coordinate
 +
|-
 +
|colspan="2"| Record Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array, i.e. the number of blocks affected
 +
|-
 +
|rowspan="3"| Record
 +
| Horizontal Position
 +
|rowspan="3"| Array
 +
| Unsigned Byte
 +
| The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
 +
|-
 +
| Y Coordinate
 +
| Unsigned Byte
 +
| Y coordinate of the block
 +
|-
 +
| Block ID
 +
| VarInt
 +
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
 +
|}
 +
 
 +
To decode the position into a world position:
  
==== Destroy Entities ====
+
<syntaxhighlight lang="java">
 +
worldX = (horizPos >> 4 & 15) + (chunkX * 16);
 +
worldY = vertPos;
 +
worldZ = (horizPos & 15) + (chunkZ * 16);
 +
</syntaxhighlight>
 +
 
 +
==== Tab-Complete (clientbound) ====
  
Sent by the server when an list of Entities is to be destroyed on the client.
+
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"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x13 || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Count || Byte || Length of following array
+
!colspan="2"| Field Name
|-
+
!colspan="2"| Field Type
| Entity IDs || Array of Int || The list of entities of destroy
+
! Notes
|}
+
|-
 +
|rowspan="8"| 0x11
 +
|rowspan="8"| Play
 +
|rowspan="8"| Client
 +
|-
 +
|colspan="2"| ID
 +
|colspan="2"| VarInt
 +
| 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"| Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array
 +
|-
 +
|rowspan="3"| Matches
 +
| Match
 +
|rowspan="3"| Array
 +
| String (32767)
 +
| One eligible value to insert, note that each command is sent separately instead of in a single string, hence the need for Count.  Note that for instance this doesn't include a leading <code>/</code> on commands.
 +
|-
 +
| Has tooltip
 +
| Boolean
 +
| True if the following is present
 +
|-
 +
| Tooltip
 +
| Optional [[Chat]]
 +
| Tooltip to display; only present if previous boolean is true
 +
|}
  
==== Entity ====
+
==== Declare Commands ====
  
Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.
+
Lists all of the commands on the server, and how they are parsed.
  
For player entities, either this packet or any move/look packet is sent every game tick.
+
This is a directed graph, with one root node.  Each redirect or child node must refer only to nodes that have already been declared.
So the meaning of this packet is basically that the entity did not move/look since the last such packet.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x14 || rowspan=1 | Play || rowspan=1 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="3"| 0x12
 +
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Count
 +
| VarInt
 +
| Number of elements in the following array
 +
|-
 +
| Nodes
 +
| Array of [[Command Data|Node]]
 +
| An array of nodes
 +
|-
 +
| Root index
 +
| VarInt
 +
| Index of the <code>root</code> node in the previous array
 +
|}
  
==== Entity Relative Move ====
+
For more information on this packet, see the [[Command Data]] article.
  
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 should be sent instead.
+
==== Window Confirmation (clientbound) ====
  
This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.
+
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag).  If the packet was not accepted, the client must respond with a [[#Window Confirmation (serverbound)|serverbound window confirmation]] packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=4| 0x15 || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
! Notes
|-
+
|-
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="3"| 0x13
|-
+
|rowspan="3"| Play
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="3"| Client
|}
+
| Window ID
 +
| Byte
 +
| The ID of the window that the action occurred in
 +
|-
 +
| Action Number
 +
| Short
 +
| 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.
 +
|-
 +
| Accepted
 +
| Boolean
 +
| Whether the action was accepted
 +
|}
  
==== Entity Look ====
+
==== Close Window (clientbound) ====
  
This packet is sent by the server when an entity rotates.  Example: "Yaw" field 64 means a 90 degree turn.
+
This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x16 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| Yaw || Byte || The X Axis rotation as a fraction of 360
+
! Notes
|-
+
|-
| Pitch || Byte || The Y Axis rotation as a fraction of 360
+
| 0x14
|}
+
| Play
 +
| Client
 +
| Window ID
 +
| Unsigned Byte
 +
| This is the ID of the window that was closed. 0 for inventory.
 +
|}
  
==== Entity Look and Relative Move ====
+
==== Window Items ====
 +
[[File:Inventory-slots.png|thumb|The inventory slots]]
  
This packet is sent by the server when an entity rotates and moves.
+
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.
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"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=6 | 0x17 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
! Notes
|-
+
|-
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="3"| 0x15
|-
+
|rowspan="3"| Play
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="3"| Client
|-
+
| Window ID
| Yaw || Byte || The X Axis rotation as a fraction of 360
+
| Unsigned Byte
|-
+
| The ID of window which items are being sent for. 0 for player inventory.
| Pitch || Byte || The Y Axis rotation as a fraction of 360
+
|-
|}
+
| Count
 +
| Short
 +
| Number of elements in the following array
 +
|-
 +
| Slot Data
 +
| Array of [[Slot Data|Slot]]
 +
|  
 +
|}
 +
 
 +
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
  
==== Entity Teleport ====
+
==== Window Property ====
  
This packet is sent by the server when an entity moves more than 4 blocks.
+
This packet is used to inform the client that part of a GUI window should be updated.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=6 | 0x18 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
! Notes
|-
+
|-
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="3"| 0x16
|-
+
|rowspan="3"| Play
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="3"| Client
|-
+
| Window ID
| Yaw || Byte || The X Axis rotation as a fraction of 360
+
| Unsigned Byte
|-
+
|  
| Pitch || Byte || The Y Axis rotation as a fraction of 360
+
|-
|}
+
| Property
 +
| Short
 +
| The property to be updated, see below
 +
|-
 +
| Value
 +
| Short
 +
| The new value for the property, see below
 +
|}
  
==== Entity Head Look ====
+
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Window type
 +
! Property
 +
! Value
 +
|-
 +
|rowspan="4"| Furnace
 +
| 0: Fire icon (fuel left)
 +
| counting from fuel burn time down to 0 (in-game ticks)
 +
|-
 +
| 1: Maximum fuel burn time
 +
| fuel burn time or 0 (in-game ticks)
 +
|-
 +
| 2: Progress arrow
 +
| counting from 0 to maximum progress (in-game ticks)
 +
|-
 +
| 3: Maximum progress
 +
| always 200 on the notchian server
 +
|-
 +
|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
 +
|-
 +
| 1: Fuel time
 +
| 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
 +
|-
 +
| Stonecutter
 +
| 0: Selected recipe
 +
| The index of the selected recipe. -1 means none is selected.
 +
|-
 +
| Loom
 +
| 0: Selected pattern
 +
| The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern.
 +
|}
  
Changes the direction an entity's head is facing.
+
For an enchanting table, the following numerical IDs are used:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Numerical ID
|-
+
! Enchantment ID
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Client
+
! Enchantment Name
| Entity ID || Int || Entity's ID
+
|-
|-
+
| 0
| Head Yaw || Byte || Head yaw in steps of 2p/256
+
| minecraft:protection
|}
+
| Protection
 +
|-
 +
| 1
 +
| minecraft:fire_protection
 +
| Fire Protection
 +
|-
 +
| 2
 +
| minecraft:feather_falling
 +
| Feather Falling
 +
|-
 +
| 3
 +
| minecraft:blast_protection
 +
| Blast Protection
 +
|-
 +
| 4
 +
| minecraft:projectile_protection
 +
| Projectile Protection
 +
|-
 +
| 5
 +
| minecraft:respiration
 +
| Respiration
 +
|-
 +
| 6
 +
| minecraft:aqua_affinity
 +
| Aqua Affinity
 +
|-
 +
| 7
 +
| minecraft:thorns
 +
| Thorns
 +
|-
 +
| 8
 +
| minecraft:depth_strider
 +
| Depth Strider
 +
|-
 +
| 9
 +
| minecraft:frost_walker
 +
| Frost Walker
 +
|-
 +
| 10
 +
| minecraft:binding_curse
 +
| Curse of Binding
 +
|-
 +
| 11
 +
| minecraft:sharpness
 +
| Sharpness
 +
|-
 +
| 12
 +
| minecraft:smite
 +
| Smite
 +
|-
 +
| 13
 +
| minecraft:bane_of_arthropods
 +
| Bane of Arthropods
 +
|-
 +
| 14
 +
| minecraft:knockback
 +
| Knockback
 +
|-
 +
| 15
 +
| minecraft:fire_aspect
 +
| Fire Aspect
 +
|-
 +
| 16
 +
| minecraft:looting
 +
| Looting
 +
|-
 +
| 17
 +
| minecraft:sweeping
 +
| Sweeping Edge
 +
|-
 +
| 18
 +
| minecraft:efficiency
 +
| Efficiency
 +
|-
 +
| 19
 +
| minecraft:silk_touch
 +
| Silk Touch
 +
|-
 +
| 20
 +
| minecraft:unbreaking
 +
| Unbreaking
 +
|-
 +
| 21
 +
| minecraft:fortune
 +
| Fortune
 +
|-
 +
| 22
 +
| minecraft:power
 +
| Power
 +
|-
 +
| 23
 +
| minecraft:punch
 +
| Punch
 +
|-
 +
| 24
 +
| minecraft:flame
 +
| Flame
 +
|-
 +
| 25
 +
| minecraft:infinity
 +
| Infinity
 +
|-
 +
| 26
 +
| minecraft:luck_of_the_sea
 +
| Luck of the Sea
 +
|-
 +
| 27
 +
| minecraft:lure
 +
| Lure
 +
|-
 +
| 28
 +
| minecraft:loyalty
 +
| Loyalty
 +
|-
 +
| 29
 +
| minecraft:impaling
 +
| Impaling
 +
|-
 +
| 30
 +
| minecraft:riptide
 +
| Riptide
 +
|-
 +
| 31
 +
| minecraft:channeling
 +
| Channeling
 +
|-
 +
| 32
 +
| minecraft:mending
 +
| Mending
 +
|-
 +
| 33
 +
| minecraft:vanishing_curse
 +
| Curse of Vanishing
 +
|}
 +
 
 +
==== Set Slot ====
 +
 
 +
Sent by the server when an item in a slot (in a window) is added/removed.
  
==== Entity Status ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x1A || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| Entity Status || Byte || See below
+
! Notes
|}
+
|-
 +
|rowspan="3"| 0x17
 +
|rowspan="3"| Play
 +
|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
 +
| Short
 +
| The slot that should be updated
 +
|-
 +
| Slot Data
 +
| [[Slot Data|Slot]]
 +
|  
 +
|}
 +
 
 +
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
 +
 
 +
This packet can only be used to edit the hotbar of the player's inventory if window ID is set to 0 (slots 36 through 44).  If the window ID is set to -2, then any slot in the inventory can be used but no add item animation will be played.
 +
 
 +
==== Set Cooldown ====
 +
 
 +
Applies a cooldown period to all items with the given type.  Used by the Notchian server with enderpearls.  This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing).
  
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Packet ID
! Entity Status !! Meaning
+
! State
|-
+
! Bound To
| 0 || Something related to living entities?
+
! Field Name
|-
+
! Field Type
| 1 || Something related to the player entity?
+
! Notes
|-
+
|-
| 2 || Living Entity hurt
+
|rowspan="2"| 0x18
|-
+
|rowspan="2"| Play
| 3 || Living Entity dead
+
|rowspan="2"| Client
|-
+
| Item ID
| 4 || Iron Golem throwing up arms
+
| VarInt
|-
+
| Numeric ID of the item to apply a cooldown to.
| 6 || Wolf/Ocelot/Horse taming - Spawn "heart" particles
+
|-
|-
+
| Cooldown Ticks
| 7 || Wolf/Ocelot/Horse tamed - Spawn "smoke" particles
+
| VarInt
|-
+
| Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
| 8 || Wolf shaking water - Trigger the shaking animation
+
|}
|-
 
| 9 || (of self) Eating accepted by server
 
|-
 
| 10 || Sheep eating grass
 
|-
 
| 11 || Iron Golem handing over a rose
 
|-
 
| 12 || Villager mating - Spawn "heart" particles
 
|-
 
| 13 || Spawn particles indicating that a villager is angry and seeking revenge
 
|-
 
| 14 || Spawn happy particles near a villager
 
|-
 
| 15 || Witch animation - Spawn "magic" particles
 
|-
 
| 16 || Zombie converting into a villager by shaking violently
 
|-
 
| 17 || Firework exploding
 
|-
 
| 18 || Animal in love (ready to mate) - Spawn "heart" particles
 
|}
 
  
==== Attach Entity ====
+
==== Plugin Message (clientbound) ====
 +
 
 +
{{Main|Plugin channels}}
 +
 
 +
Mods and plugins can use this to send their data. Minecraft itself uses several [[plugin channel]]s. These internal channels are in the <code>minecraft</code> namespace.
 +
 
 +
More documentation on this: [http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/]
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x19
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Channel
 +
| Identifier
 +
| Name of the [[plugin channel]] used to send the data
 +
|-
 +
| Data
 +
| Byte Array
 +
| Any data, depending on the channel. <code>minecraft:</code> channels are documented [[plugin channel|here]].  The length of this array must be inferred from the packet length.
 +
|}
 +
 
 +
==== Named Sound Effect ====
 +
{{See also|#Sound Effect}}
  
This packet is sent when a player has been attached to an entity (e.g. Minecart)
+
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x1B || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| Vehicle ID || Int || Vechicle's Entity ID
+
! Notes
|-
+
|-
| Leash || Bool || If true leashes the entity to the vehicle
+
|rowspan="7"| 0x1A
|}
+
|rowspan="7"| Play
 +
|rowspan="7"| Client
 +
| Sound Name
 +
| Identifier
 +
| All sound effect names as of 1.15.2 can be seen [https://pokechu22.github.io/Burger/1.15.2.html#sounds here].
 +
|-
 +
| Sound Category
 +
| VarInt Enum
 +
| The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 +
|-
 +
| Effect Position X
 +
| Int
 +
| Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 +
|-
 +
| Effect Position Y
 +
| Int
 +
| Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 +
|-
 +
| Effect Position Z
 +
| Int
 +
| Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 +
|-
 +
| Volume
 +
| Float
 +
| 1 is 100%, can be more
 +
|-
 +
| Pitch
 +
| Float
 +
| Float between 0.5 and 2.0 by Notchian clients
 +
|}
 +
 
 +
==== Disconnect (play) ====
 +
 
 +
Sent by the server before it disconnects a client. The client assumes that the server has already closed the connection by the time the packet arrives.
  
==== Entity Metadata ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x1C || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| Metadata || [[Entities#Entity_Metadata_Format|Metadata]] ||
+
! Notes
|}
+
|-
 +
| 0x1B
 +
| Play
 +
| Client
 +
| Reason
 +
| [[Chat]]
 +
| Displayed to the client when the connection terminates.
 +
|}
 +
 
 +
==== Entity Status ====
 +
 
 +
Entity statuses generally trigger an animation for an entity.  The available statuses vary by the entity's type (and are available to subclasses of that type as well).
  
==== Entity Effect ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=4 | 0x1D || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| Effect ID || Byte || See [[http://www.minecraftwiki.net/wiki/Potion_effect#Parameters]]
+
! Notes
|-
+
|-
| Amplifier || Byte ||
+
|rowspan="2"| 0x1C
|-
+
|rowspan="2"| Play
| Duration || Short ||
+
|rowspan="2"| Client
|}
+
| Entity ID
 +
| Int
 +
|  
 +
|-
 +
| Entity Status
 +
| Byte Enum
 +
| See below
 +
|}
 +
 
 +
See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
 +
 
 +
==== Explosion ====
 +
 
 +
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
 +
 
 +
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
  
==== Remove Entity Effect ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x1E || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| Effect ID || Byte ||
+
! Notes
|}
+
|-
 +
|rowspan="9"| 0x1D
 +
|rowspan="9"| Play
 +
|rowspan="9"| Client
 +
| X
 +
| Float
 +
|
 +
|-
 +
| Y
 +
| Float
 +
|
 +
|-
 +
| Z
 +
| Float
 +
|
 +
|-
 +
| Strength
 +
| Float
 +
| A strength greater than or equal to 2.0 spawns a <code>minecraft:explosion_emitter</code> particle, while a lesser strength spawns a <code>minecraft:explosion</code> particle.
 +
|-
 +
| Record Count
 +
| Int
 +
| Number of elements in the following array
 +
|-
 +
| Records
 +
| Array of (Byte, Byte, Byte)
 +
| Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
 +
|-
 +
| Player Motion X
 +
| Float
 +
| X velocity of the player being pushed by the explosion
 +
|-
 +
| Player Motion Y
 +
| Float
 +
| Y velocity of the player being pushed by the explosion
 +
|-
 +
| Player Motion Z
 +
| Float
 +
| Z velocity of the player being pushed by the explosion
 +
|}
  
==== Set Experience ====
+
==== Unload Chunk ====
  
Sent by the server when the client should change experience levels.
+
Tells the client to unload a chunk column.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x1F || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Experience bar || Float || Between 0 and 1
+
! Field Name
|-
+
! Field Type
| Level || Short ||
+
! Notes
|-
+
|-
| Total Experience || Short ||
+
|rowspan="2"| 0x1E
|}
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Chunk X
 +
| Int
 +
| Block coordinate divided by 16, rounded down
 +
|-
 +
| Chunk Z
 +
| Int
 +
| Block coordinate divided by 16, rounded down
 +
|}
 +
 
 +
It is legal to send this packet even if the given chunk is not currently loaded.
 +
 
 +
==== Change Game State ====
 +
 
 +
Used for a wide variety of game state things, from whether to bed use to gamemode to demo messages.
  
==== Entity Properties ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x20 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Entity ID || Int || Entity's ID
+
! Field Name
|-
+
! Field Type
| Count || Int || Length of following array
+
! Notes
|-
+
|-
| Properties || Array of Property Data ||
+
|rowspan="2"| 0x1F
|}
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Reason
 +
| Unsigned Byte
 +
| See below
 +
|-
 +
| Value
 +
| Float
 +
| Depends on Reason
 +
|}
 +
 
 +
''Reason codes'':
  
'''Property Data''' structure:
 
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Reason
! Field Name !! Field Type !! Notes
+
! Effect
|-
+
! Value
| Key || String ||  
+
|-
|-
+
| 0
| Value || Double ||  
+
| 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.
| List Length || Short || Number of list elements that follow.
+
|-
|-
+
| 1
| Modifiers || Array of Modifier Data || http://www.minecraftwiki.net/wiki/Attribute#Modifiers
+
| End raining
|}
+
|
 +
|-
 +
| 2
 +
| Begin raining
 +
|
 +
|-
 +
| 3
 +
| Change gamemode
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 +
|-
 +
| 4
 +
| Win game
 +
| 0: Just respawn player. <br>1: Roll the credits and respawn player. <br> Note that 1 is only sent by notchian server when player has not yet achieved advancement "The end?", else 0 is sent.
 +
|-
 +
| 5
 +
| Demo event
 +
| 0: Show welcome to demo screen<br> 101: Tell movement controls<br> 102: Tell jump control<br> 103: Tell inventory control<br> 104: Tell that the demo is over and print a message about how to take a screenshot
 +
|-
 +
| 6
 +
| Arrow hit player
 +
| Note: Sent when any player is struck by an arrow.  
 +
|-
 +
| 7
 +
| Rain level change
 +
| Note: Seems to change both skycolor and lightning. <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.
 +
|-
 +
| 8
 +
| Thunder level change
 +
| Note: Seems to change both skycolor and lightning (same as Rain level change, but doesn't start rain). It also requires rain to render by notchian client. ()<br>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.
 +
|-
 +
| 9
 +
| Play pufferfish sting sound
 +
|-
 +
| 10
 +
| Play elder guardian mob appearance (effect and sound)
 +
|
 +
|-
 +
| 11
 +
| Enable respawn screen
 +
|  0: Enable respawn screen, 1: Immediately respawn (sent when the doImmediateRespawn gamerule changes)
 +
|}
 +
 
 +
==== Open Horse Window ====
 +
 
 +
This packet is used exclusively for opening the horse GUI.  [[#Open Window|Open Window]] is used for all other GUIs.
  
Known key values:
 
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Packet ID
! Key !! Default !! Min !! Max !! Label
+
! State
|-
+
! Bound To
| generic.maxHealth || 20.0 || 0.0 || Double.MaxValue || Max Health
+
! Field Name
|-
+
! Field Type
| generic.followRange || 32.0 || 0.0 || 2048.0 || Follow Range
+
! Notes
|-
+
|-
| generic.knockbackResistance || 0.0 || 0.0 || 1.0 || Knockback Resistance
+
|rowspan="3"| 0x20
|-
+
|rowspan="3"| Play
| generic.movementSpeed || 0.699999988079071 || 0.0 || Double.MaxValue || Movement Speed
+
|rowspan="3"| Client
|-
+
| Window ID?
| generic.attackDamage || 2.0 || 0.0 || Double.MaxValue ||
+
| Byte
|-
+
|
| horse.jumpStrength || 0.7 || 0.0 || 2.0 || Jump Strength
+
|-
|-
+
| Number of slots?
| zombie.spawnReinforcements || 0.0 || 0.0 || 1.0 || Spawn Reinforcements Chance
+
| VarInt
|}
+
|
 +
|-
 +
| Entity ID?
 +
| Integer
 +
|
 +
|}
 +
 
 +
==== Keep Alive (clientbound) ====
 +
 
 +
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
 +
 
 +
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
  
'''Modifier Data''' structure:
 
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Packet ID
! Field Name !! Field Type !! Notes
+
! State
|-
+
! Bound To
| UUID || 128-bit integer ||
+
! Field Name
|-
+
! Field Type
| Amount || Double ||
+
! Notes
|-
+
|-
| Operation || Byte ||
+
|rowspan="1"| 0x21
|}
+
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Keep Alive ID
 +
| Long
 +
|  
 +
|}
  
 
==== Chunk Data ====
 
==== Chunk Data ====
 +
{{Main|Chunk Format}}
 +
{{See also|#Unload Chunk}}
  
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.
+
{{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)}}
  
See also: [[SMP Map Format]]
+
The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which dimenison the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent.  This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with [[#Update Block Entity|Update Block Entity]] later).
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=7 | 0x21 || rowspan=7 | Play || rowspan=7 | Client
+
! Bound To
| Chunk X || Int || Chunk X coordinate
+
! Field Name
|-
+
! Field Type
| Chunk Z || Int || Chunk Z coordinate
+
! Notes
|-
+
|-
| Ground-Up continuous || Boolean || This is True if the packet represents all sections in this vertical column, where the primary bit map specifies exactly which sections are included, and which are air
+
|rowspan="10"| 0x22
|-
+
|rowspan="10"| Play
| Primary bit map || Unsigned Short || Bitmask with 1 for every 16x16x16 section which data follows in the compressed data.
+
|rowspan="10"| Client
|-
+
| Chunk X
| Add bit map || Unsigned Short || Same as above, but this is used exclusively for the 'add' portion of the payload
+
| Int
|-  
+
| Chunk coordinate (block coordinate divided by 16, rounded down)
| Compressed size || Int || Size of compressed chunk data
+
|-
|-
+
| Chunk Z
| Compressed data || Byte array || The chunk data is compressed using Zlib Deflate
+
| Int
|}
+
| Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
| Full chunk
 +
| Boolean
 +
| See [[Chunk Format#Full chunk|Chunk Format]]
 +
|-
 +
| Primary Bit Mask
 +
| VarInt
 +
| Bitmask with bits set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
 +
|-
 +
| Heightmaps
 +
| [[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
 +
| Optional array of Integer
 +
| 1024 biome IDs, ordered by x then z then y, in 4&times;4&times;4 blocks.  Not present if full chunk is false.
 +
|-
 +
| Size
 +
| VarInt
 +
| Size of Data in bytes
 +
|-
 +
| Data
 +
| Byte array
 +
| See [[Chunk Format#Data structure|data structure]] in Chunk Format
 +
|-
 +
| Number of block entities
 +
| VarInt
 +
| Number of elements in the following array
 +
|-
 +
| Block entities
 +
| Array of [[NBT|NBT Tag]]
 +
| All block entities in the chunk.  Use the x, y, and z tags in the NBT to determine their positions.
 +
|}
 +
 
 +
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.
 +
 
 +
==== Effect ====
 +
Sent when a client is to play a sound or particle effect.
 +
 
 +
By default, the Minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1023 (wither spawn), effect 1028 (enderdragon death), and effect 1038 (end portal opening); it is ignored on other effects.
  
==== Multi Block Change ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=5 | 0x22 || rowspan=5 | Play || rowspan=5 | Client
+
! Bound To
| Chunk X || Int || Chunk X coordinate
+
! Field Name
|-
+
! Field Type
| Chunk Z || Int || Chunk Z Coordinate
+
! Notes
|-
+
|-
| Record count || Short || The number of blocks affected
+
|rowspan="4"| 0x23
|-
+
|rowspan="4"| Play
| Data size || Int ||  The total size of the data, in bytes. Should always be 4*record count
+
|rowspan="4"| Client
|-
+
| Effect ID
| Records || Array of Records ||  
+
| Int
|}
+
| The ID of the effect, see below
 +
|-
 +
| Location
 +
| Position
 +
| The location of the effect
 +
|-
 +
| Data
 +
| Int
 +
| Extra data for certain effects, see below
 +
|-
 +
| Disable Relative Volume
 +
| Boolean
 +
| See above
 +
|}
 +
 
 +
Effect IDs:
  
'''Record'''
 
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! ID
! Bit mask !! Width !! Meaning
+
! Name
|-
+
! Data
| 00 00 00 0F || 4 bits || Block metadata
+
|-
|-
+
!colspan="3"| Sound
| 00 00 FF F0 || 12 bits || Block ID
+
|-
|-
+
| 1000
| 00 FF 00 00 || 8 bits || Y co-ordinate
+
| Dispenser dispenses
|-
+
|  
| 0F 00 00 00 || 4 bits || Z co-ordinate, relative to chunk
+
|-
|-
+
| 1001
| F0 00 00 00 || 4 bits || X co-ordinate, relative to chunk
+
| Dispenser fails to dispense
|}
+
|  
 +
|-
 +
| 1002
 +
| Dispenser shoots
 +
|  
 +
|-
 +
| 1003
 +
| Ender eye launched
 +
|  
 +
|-
 +
| 1004
 +
| Firework shot
 +
|  
 +
|-
 +
| 1005
 +
| Iron door opened
 +
|
 +
|-
 +
| 1006
 +
| Wooden door opened
 +
|
 +
|-
 +
| 1007
 +
| Wooden trapdoor opened
 +
|
 +
|-
 +
| 1008
 +
| Fence gate opened
 +
|  
 +
|-
 +
| 1009
 +
| Fire extinguished
 +
|
 +
|-
 +
| 1010
 +
| Play record
 +
| Special case, see below for more info
 +
|-
 +
| 1011
 +
| Iron door closed
 +
|
 +
|-
 +
| 1012
 +
| Wooden door closed
 +
|
 +
|-
 +
| 1013
 +
| Wooden trapdoor closed
 +
|
 +
|-
 +
| 1014
 +
| Fence gate closed
 +
|
 +
|-
 +
| 1015
 +
| Ghast warns
 +
|
 +
|-
 +
| 1016
 +
| Ghast shoots
 +
|
 +
|-
 +
| 1017
 +
| Enderdragon shoots
 +
|
 +
|-
 +
| 1018
 +
| Blaze shoots
 +
|
 +
|-
 +
| 1019
 +
| Zombie attacks wood door
 +
|
 +
|-
 +
| 1020
 +
| Zombie attacks iron door
 +
|
 +
|-
 +
| 1021
 +
| Zombie breaks wood door
 +
|
 +
|-
 +
| 1022
 +
| Wither breaks block
 +
|
 +
|-
 +
| 1023
 +
| Wither spawned
 +
|
 +
|-
 +
| 1024
 +
| Wither shoots
 +
|
 +
|-
 +
| 1025
 +
| Bat takes off
 +
|
 +
|-
 +
| 1026
 +
| Zombie infects
 +
|
 +
|-
 +
| 1027
 +
| Zombie villager converted
 +
|
 +
|-
 +
| 1028
 +
| Ender dragon death
 +
|
 +
|-
 +
| 1029
 +
| Anvil destroyed
 +
|
 +
|-
 +
| 1030
 +
| Anvil used
 +
|
 +
|-
 +
| 1031
 +
| Anvil landed
 +
|
 +
|-
 +
| 1032
 +
| Portal travel
 +
|
 +
|-
 +
| 1033
 +
| Chorus flower grown
 +
|
 +
|-
 +
| 1034
 +
| Chorus flower died
 +
|
 +
|-
 +
| 1035
 +
| Brewing stand brewed
 +
|
 +
|-
 +
| 1036
 +
| Iron trapdoor opened
 +
|
 +
|-
 +
| 1037
 +
| Iron trapdoor closed
 +
|
 +
|-
 +
| 1038
 +
| End portal created in overworld
 +
|
 +
|-
 +
| 1039
 +
| Phantom bites
 +
|
 +
|-
 +
| 1040
 +
| Zombie converts to drowned
 +
|
 +
|-
 +
| 1041
 +
| Husk converts to zombie by drowning
 +
|
 +
|-
 +
| 1042
 +
| Grindstone used
 +
|
 +
|-
 +
| 1043
 +
| Book page turned
 +
|
 +
|-
 +
|-
 +
!colspan="3"| Particle
 +
|-
 +
| 1500
 +
| Composter composts
 +
|
 +
|-
 +
| 1501
 +
| Lava converts block (either water to stone, or removes existing blocks such as torches)
 +
|
 +
|-
 +
| 1502
 +
| Redstone torch burns out
 +
|
 +
|-
 +
| 1503
 +
| Ender eye placed
 +
|
 +
|-
 +
| 2000
 +
| Spawns 10 smoke particles, e.g. from a fire
 +
| Direction, see below
 +
|-
 +
| 2001
 +
| Block break + block break sound
 +
| Block state, as an index into the global palette
 +
|-
 +
| 2002
 +
| Splash potion. Particle effect + glass break sound.
 +
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 +
|-
 +
| 2003
 +
| Eye of Ender entity break animation — particles and sound
 +
|
 +
|-
 +
| 2004
 +
| Mob spawn particle effect: smoke + flames
 +
|
 +
|-
 +
| 2005
 +
| Bonemeal particles
 +
| How many particles to spawn (if set to 0, 15 are spawned)
 +
|-
 +
| 2006
 +
| Dragon breath
 +
|
 +
|-
 +
| 2007
 +
| Instant splash potion
 +
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 +
|-
 +
| 2008
 +
| Ender dragon destroys block
 +
|
 +
|-
 +
| 2009
 +
| Wet sponge vaporizes in nether
 +
|
 +
|-
 +
| 3000
 +
| End gateway spawn
 +
|
 +
|-
 +
| 3001
 +
| Enderdragon growl
 +
|
 +
|}
 +
 
 +
Smoke directions:
  
==== Block Change ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! ID
|-
+
! Direction
| rowspan=5 | 0x23 || rowspan=5 | Play || rowspan=5 | Client
+
|-
| X || Int || Block X Coordinate
+
| 0
|-
+
| South-East
| Y || Unsigned Byte || Block Y Coordinate
+
|-
|-
+
| 1
| Z || Int || Block Z Coordinate
+
| South
|-
+
|-
| Block ID || VarInt || The new block ID for the block
+
| 2
|-
+
| South-West
| Block Metadata || Unsigned Byte || The new metadata for the block
+
|-
|}
+
| 3
 +
| East
 +
|-
 +
| 4
 +
| (Up or middle ?)
 +
|-
 +
| 5
 +
| West
 +
|-
 +
| 6
 +
| North-East
 +
|-
 +
| 7
 +
| North
 +
|-
 +
| 8
 +
| North-West
 +
|}
  
==== Block Action ====
+
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.
  
This packet is used for a number of things:
+
==== Particle ====
* <div class="li">Chests opening and closing
 
* Pistons pushing and pulling
 
* Note blocks playing
 
  
See Also: [[Block Actions]]
+
Displays the named particle
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=6 | 0x24 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| X || Int || Block X Coordinate
+
! Field Name
|-
+
! Field Type
| Y || Short || Block Y Coordinate
+
! Notes
|-
+
|-
| Z || Int || Block Z Coordinate
+
|rowspan="11"| 0x24
|-
+
|rowspan="11"| Play
| Byte 1 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
+
|rowspan="11"| Client
|-
+
| Particle ID
| Byte 2 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
+
| Int
|-
+
| The particle ID listed in [[#Particle|the particle data type]].
| Block Type || VarInt || The block type for the block
+
|-
|}
+
| Long Distance
 +
| Boolean
 +
| If true, particle distance increases from 256 to 65536
 +
|-
 +
| X
 +
| Double
 +
| X position of the particle
 +
|-
 +
| Y
 +
| Double
 +
| Y position of the particle
 +
|-
 +
| Z
 +
| Double
 +
| Z position of the particle
 +
|-
 +
| Offset X
 +
| Float
 +
| This is added to the X position after being multiplied by random.nextGaussian()
 +
|-
 +
| Offset Y
 +
| Float
 +
| This is added to the Y position after being multiplied by random.nextGaussian()
 +
|-
 +
| Offset Z
 +
| Float
 +
| This is added to the Z position after being multiplied by random.nextGaussian()
 +
|-
 +
| Particle Data
 +
| Float
 +
| The data of each particle
 +
|-
 +
| Particle Count
 +
| Int
 +
| The number of particles to create
 +
|-
 +
| Data
 +
| Varies
 +
| The variable data listed in [[#Particle|the particle data type]].
 +
|}
  
==== Block Break Animation ====
+
==== Update Light ====
  
0-9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
+
Updates light levels for a chunk.
  
You can also set an animation to air! The animation will still be visible.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 +
|-
 +
|rowspan="10"| 0x25
 +
|rowspan="10"| Play
 +
|rowspan="10"| Client
 +
|colspan="2"| Chunk X
 +
|colspan="2"| VarInt
 +
| Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
|colspan="2"| Chunk Z
 +
|colspan="2"| VarInt
 +
| Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
|colspan="2"| Sky Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, with the lowest bit corresponding to chunk section -1 (in the void, y=-16 to y=-1) and the highest bit for chunk section 16 (above the world, y=256 to y=271)
 +
|-
 +
|colspan="2"| Block Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, with the same order as sky light
 +
|-
 +
|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)
 +
|-
 +
| Sky Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the sky light mask, starting with the lowest value.  Half a byte per light value.
 +
|-
 +
|rowspan="2"| Block Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Block Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the block light mask, starting with the lowest value.  Half a byte per light value.
 +
|}
  
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
+
Individual block or sky light arrays are is given for each block with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates. Even-indexed items (those with an even x coordinate, starting at 0) are packed into the low bits, odd-indexed into the high bits.
  
Also if you set the coordinates to a special block like water, it won't show the actual break animation, but some other interesting effects. (Water will lose its transparency)
+
==== Join Game ====
 +
 
 +
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=5 | 0x25 || rowspan=5 | Play || rowspan=5 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| X || Int || rowspan=3 | Block Position
+
! Notes
|-
+
|-
| Y || Int
+
|rowspan="9"| 0x26
|-
+
|rowspan="9"| Play
| Z || Int
+
|rowspan="9"| Client
|-
+
| Entity ID
| Destroy Stage || Byte || 0 - 9
+
| Int
|}
+
| The player's Entity ID (EID)
 +
|-
 +
| Gamemode
 +
| Unsigned Byte
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
 +
|-
 +
| Dimension
 +
| Int Enum
 +
| -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
 +
|-
 +
| Hashed seed
 +
| Long
 +
| First 8 bytes of the SHA-256 hash of the world's seed.
 +
|-
 +
| Max Players
 +
| Unsigned Byte
 +
| Was once used by the client to draw the player list, but now is ignored
 +
|-
 +
| Level Type
 +
| String Enum (16)
 +
| default, flat, largeBiomes, amplified, customized, buffet, default_1_1
 +
|-
 +
| View Distance
 +
| VarInt
 +
| Render distance (2-32)
 +
|-
 +
| 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
 +
|}
 +
 
 +
==== Map Data ====
 +
 
 +
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
  
==== Map Chunk Bulk ====
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 +
|-
 +
|rowspan="17"| 0x27
 +
|rowspan="17"| Play
 +
|rowspan="17"| Client
 +
|colspan="2"| Map ID
 +
|colspan="2"| VarInt
 +
| Map ID of the map being modified
 +
|-
 +
|colspan="2"| Scale
 +
|colspan="2"| Byte
 +
| From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
 +
|-
 +
|colspan="2"| Tracking Position
 +
|colspan="2"| Boolean
 +
| Specifies whether player and item frame icons are shown
 +
|-
 +
|colspan="2"| Locked
 +
|colspan="2"| Boolean
 +
| True if the map has been locked in a cartography table
 +
|-
 +
|colspan="2"| Icon Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array
 +
|-
 +
|rowspan="6"| Icon
 +
| Type
 +
|rowspan="6"| Array
 +
| VarInt enum
 +
| See below
 +
|-
 +
| X
 +
| Byte
 +
| Map coordinates: -128 for furthest left, +127 for furthest right
 +
|-
 +
| Z
 +
| 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 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
 +
|-
 +
|colspan="2"| Length
 +
|colspan="2"| Optional VarInt
 +
| Only if Columns is more than 0; length of the following array
 +
|-
 +
|colspan="2"| Data
 +
|colspan="2"| Optional Array of Unsigned Byte
 +
| Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 +
|}
  
See also: [[SMP Map Format]]
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
  
To reduce the number of bytes this packet is used to send chunks together for better compression results.
+
Types are based off of rows and columns in <code>map_icons.png</code>:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|-
|-
+
! Icon type
| rowspan=5 | 0x26 || rowspan=5 | Play || rowspan=5 | Client
+
! Result
| Chunk column count || Short || The number of chunk in this packet
+
|-
|-
+
| 0
| Data length || Int || The size of the data field
+
| White arrow (players)
|-
+
|-
| Sky light sent || Bool || Whether or not the chunk data contains a light nibble array. This is true in the main world, false in the end + nether
+
| 1
|-
+
| Green arrow (item frames)
| Data || Byte Array || Compressed chunk data
+
|-
|-
+
| 2
| Meta information || Meta || See below
+
| Red arrow
|}
+
|-
 +
| 3
 +
| Blue arrow
 +
|-
 +
| 4
 +
| White cross
 +
|-
 +
| 5
 +
| Red pointer
 +
|-
 +
| 6
 +
| White circle (off-map players)
 +
|-
 +
| 7
 +
| Small white circle (far-off-map players)
 +
|-
 +
| 8
 +
| Mansion
 +
|-
 +
| 9
 +
| Temple
 +
|-
 +
| 10
 +
| White Banner
 +
|-
 +
| 11
 +
| Orange Banner
 +
|-
 +
| 12
 +
| Magenta Banner
 +
|-
 +
| 13
 +
| Light Blue Banner
 +
|-
 +
| 14
 +
| Yellow Banner
 +
|-
 +
| 15
 +
| Lime Banner
 +
|-
 +
| 16
 +
| Pink Banner
 +
|-
 +
| 17
 +
| Gray Banner
 +
|-
 +
| 18
 +
| Light Gray Banner
 +
|-
 +
| 19
 +
| Cyan Banner
 +
|-
 +
| 20
 +
| Purple Banner
 +
|-
 +
| 21
 +
| Blue Banner
 +
|-
 +
| 22
 +
| Brown Banner
 +
|-
 +
| 23
 +
| Green Banner
 +
|-
 +
| 24
 +
| Red Banner
 +
|-
 +
| 25
 +
| Black Banner
 +
|-
 +
| 26
 +
| Treasure marker
 +
|}
 +
 
 +
==== Trade List ====
 +
 
 +
The list of trades a villager NPC is offering.
  
'''Meta'''
 
 
{| class="wikitable"
 
{| class="wikitable"
! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
|Chunk X || Int || The X Coordinate of the chunk
+
! Bound To
|-
+
!colspan="2"| Field Name
|Chunk Z || Int || The Z Coordinate of the chunk
+
!colspan="2"| Field Type
|-
+
! Notes
|Primary bitmap || Unsigned Short || A bitmap which specifies which sections are not empty in this chunk
+
|-
|-
+
|rowspan="18"| 0x28
|Add bitmap || Unsigned Short || A bitmap which specifies which sections need add information because of very high block ids. not yet used
+
|rowspan="18"| Play
|}
+
|rowspan="18"| Client
 +
|-
 +
| colspan="2" | Window ID
 +
| colspan="2" | VarInt
 +
| The ID of the window that is open; this is an int rather than a byte.
 +
|-
 +
| colspan="2" | Size
 +
| colspan="2" | Byte
 +
| The number of trades in the following array
 +
|-
 +
| rowspan="11" | Trades
 +
| Input item 1
 +
| rowspan="11" | Array
 +
| [[Slot]]
 +
| The first item the villager is buying
 +
|-
 +
| Output item
 +
| [[Slot]]
 +
| The item the villager is selling
 +
|-
 +
| Has second item
 +
| Boolean
 +
| Whether there is a second item
 +
|-
 +
| Input item 2
 +
| Optional [[Slot]]
 +
| The second item the villager is buying; only present if they have a second item.
 +
|-
 +
| Trade disabled
 +
| Boolean
 +
| True if the trade is disabled; false if the trade is enabled.
 +
|-
 +
| Number of trade uses
 +
| Integer
 +
| Number of times the trade has been used so far
 +
|-
 +
| Maximum number of trade uses
 +
| Integer
 +
| Number of times this trade can be used
 +
|-
 +
| XP
 +
| Integer
 +
|
 +
|-
 +
| Special Price
 +
| Integer
 +
|
 +
|-
 +
| Price Multiplier
 +
| Float
 +
|
 +
|-
 +
| Demand
 +
| Integer
 +
|
 +
|-
 +
|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.
 +
|-
 +
|colspan="2"| Can restock
 +
|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.
 +
|}
  
==== Explosion ====
+
[[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.
 +
 
 +
This packet allows at most 8 blocks movement in any direction, because short range is from -32768 to 32767. And <code>32768 / (128 * 32)</code> = 8.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="5"| 0x29
 +
|rowspan="5"| Play
 +
|rowspan="5"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| 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
 +
|
 +
|}
 +
 
 +
==== 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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="7"| 0x2A
 +
|rowspan="7"| Play
 +
|rowspan="7"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| 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>
 +
|-
 +
| Yaw
 +
| Angle
 +
| New angle, not a delta
 +
|-
 +
| Pitch
 +
| Angle
 +
| New angle, not a delta
 +
|-
 +
| On Ground
 +
| Boolean
 +
|
 +
|}
  
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
+
==== Entity Rotation ====
  
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
+
This packet is sent by the server when an entity rotates.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="9" | 0x27 || rowspan=9 | Play || rowspan=9 | Client
+
! Bound To
| X || Float ||
+
! Field Name
|-
+
! Field Type
| Y || Float ||
+
! Notes
|-
+
|-
| Z || Float ||
+
|rowspan="4"| 0x2B
|-
+
|rowspan="4"| Play
| Radius || Float || Currently unused in the client
+
|rowspan="4"| Client
|-
+
| Entity ID
| Record count || Int || This is the count, not the size. The size is 3 times this value.
+
| VarInt
|-
+
|  
| Records || (Byte, Byte, Byte) × count || Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
+
|-
|-
+
| Yaw
| Player Motion X || Float || X velocity of the player being pushed by the explosion
+
| Angle
|-
+
| New angle, not a delta
| Player Motion Y || Float || Y velocity of the player being pushed by the explosion
+
|-
|-
+
| Pitch
| Player Motion Z || Float || Z velocity of the player being pushed by the explosion
+
| Angle
|}
+
| New angle, not a delta
 +
|-
 +
| On Ground
 +
| Boolean
 +
|  
 +
|}
 +
 
 +
==== 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.
  
==== Effect ====
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x2C
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 +
|}
  
Sent when a client is to play a sound or particle effect.
+
==== Vehicle Move (clientbound) ====
  
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 effects 1013 and 1018 (mob.wither.spawn and mob.enderdragon.end, respectively), and is ignored for any other value by the client.
+
Note that all fields use absolute positioning and do not allow for relative positioning.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="6" | 0x28 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| Effect ID || Int || The ID of the effect, see below.
+
! Field Name
|-
+
! Field Type
| X || Int || The X location of the effect
+
! Notes
|-
+
|-
| Y || Byte || The Y location of the effect
+
|rowspan="5"| 0x2D
|-
+
|rowspan="5"| Play
| Z || Int || The Z location of the effect
+
|rowspan="5"| Client
|-
+
| X
| Data || Int || Extra data for certain effects, see below.
+
| Double
|-
+
| Absolute position (X coordinate)
| Disable relative volume || Bool || See above
+
|-
|}
+
| 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
 +
|}
  
===== Effects =====
+
==== Open Book ====
 +
 
 +
Sent when a player right clicks with a signed book. This tells the client to open the book GUI.
  
 
{| class="wikitable"
 
{| class="wikitable"
! ID !! Name
+
! Packet ID
|-
+
! State
| colspan=2 | '''Sound'''
+
! Bound To
|-
+
! Field Name
| 1000|| <code>random.click</code>
+
! Field Type
|-
+
! Notes
| 1001|| <code>random.click</code>
+
|-
|-
+
|rowspan="1"| 0x2E
| 1002|| <code>random.bow</code>
+
|rowspan="1"| Play
|-
+
|rowspan="1"| Client
| 1003|| <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
+
| Hand
|-
+
| VarInt enum
| 1004|| <code>random.fizz</code>
+
| 0: Main hand, 1: Off hand
|-
+
|}
| 1005|| Play a music disc. '''Data''' [http://www.minecraftwiki.net/wiki/Music_Discs Record ID]
 
|-
 
| ''(1006 not assigned)'' ||
 
|-
 
| 1007|| <code>mob.ghast.charge</code>
 
|-
 
| 1008|| <code>mob.ghast.fireball</code>
 
|-
 
| 1009|| <code>mob.ghast.fireball</code>, but with a lower volume.
 
|-
 
| 1010|| <code>mob.zombie.wood</code>
 
|-
 
| 1011|| <code>mob.zombie.metal</code>
 
|-
 
| 1012|| <code>mob.zombie.woodbreak</code>
 
|-
 
| 1013|| <code>mob.wither.spawn</code>
 
|-
 
| 1014|| <code>mob.wither.shoot</code>
 
|-
 
| 1015|| <code>mob.bat.takeoff</code>
 
|-
 
| 1016|| <code>mob.zombie.infect</code>
 
|-
 
| 1017|| <code>mob.zombie.unfect</code>
 
|-
 
| 1018|| <code>mob.enderdragon.end</code>
 
|-
 
| 1020|| <code>random.anvil_break</code>
 
|-
 
| 1021|| <code>random.anvil_use</code>
 
|-
 
| 1022|| <code>random.anvil_land</code>
 
|-
 
| colspan=2 | '''Particle'''
 
|-
 
| 2000|| Spawns 10 smoke particles, e.g. from a fire. '''Data''' direction, see below
 
|-
 
| 2001|| Block break. '''Data''' [http://www.minecraftwiki.net/wiki/Data_values Block ID]
 
|-
 
| 2002|| Splash potion. Particle effect + glass break sound. '''Data''' [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
 
|-
 
| 2003|| Eye of ender entity break animation - particles and sound
 
|-
 
| 2004|| Mob spawn particle effect: smoke + flames
 
|-
 
| 2005|| Spawn "happy villager" effect (green crosses), used for bonemealing vegetation.
 
|-
 
| 2006|| Spawn fall particles (when player hits ground). '''Data''' fall damage taken for particle speed
 
|}
 
  
Smoke directions:
+
==== Open Window ====
 +
 
 +
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.  For horses, use [[#Open Horse Window|Open Horse Window]].
  
 
{| class="wikitable"
 
{| class="wikitable"
! ID !! Direction
+
! Packet ID
|-
+
! State
| 0 || South - East
+
! Bound To
|-
+
! Field Name
| 1 || South
+
! Field Type
|-
+
! Notes
| 2 || South - West
+
|-
|-
+
|rowspan="3"| 0x2F
| 3 || East
+
|rowspan="3"| Play
|-
+
|rowspan="3"| Client
| 4 || (Up or middle ?)
+
| Window ID
|-
+
| VarInt
| 5 || West
+
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
|-
+
|-
| 6 || North - East
+
| Window Type
|-
+
| VarInt
| 7 || North
+
| The window type to use for display. Contained in the <code>minecraft:menu</code> regisry; see [[Inventory]] for the different values.
|-
+
|-
| 8 || North - West
+
| Window Title
|}
+
| [[Chat]]
 +
| The title of the window
 +
|}
 +
 
 +
==== Open Sign Editor ====
  
==== Sound Effect ====
+
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.
  
Used to play a sound effect on the client.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x30
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Location
 +
| Position
 +
|
 +
|}
  
All known sound effect names can be seen [https://github.com/SirCmpwn/Craft.Net/blob/master/source/Craft.Net.Common/SoundEffect.cs here].
+
==== Craft Recipe Response ====
  
Custom sounds may be added by resource packs
+
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"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="6" | 0x29 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| Sound name || String ||
+
! Field Name
|-
+
! Field Type
| Effect position X || Int || Effect X multiplied by 8
+
! Notes
|-
+
|-
| Effect position Y || Int || Effect Y multiplied by 8
+
|rowspan="2"| 0x31
|-
+
|rowspan="2"| Play
| Effect position Z || Int || Effect Z multiplied by 8
+
|rowspan="2"| Client
|-
+
| Window ID
| Volume || Float || 1 is 100%, can be more
+
| Byte
|-
+
|
| Pitch || Unsigned Byte || 63 is 100%, can be more
+
|-
|}
+
| Recipe
 +
| Identifier
 +
| A recipe ID
 +
|}
  
==== Particle ====
+
==== Player Abilities (clientbound) ====
  
Displays the named particle
+
The latter 2 floats are used to indicate the field of view and flying speed respectively, while the first byte is used to determine the value of 4 booleans.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="9" | 0x2A || rowspan=9 | Play || rowspan=9 | Client
+
! Bound To
| Particle name || String || The name of the particle to create. A list can be found [https://gist.github.com/thinkofdeath/5110835 here]
+
! Field Name
|-
+
! Field Type
| X || Float || X position of the particle
+
! Notes
|-
+
|-
| Y || Float || Y position of the particle
+
|rowspan="3"| 0x32
|-
+
|rowspan="3"| Play
| Z || Float || Z position of the particle
+
|rowspan="3"| Client
|-
+
| Flags
| Offset X || Float || This is added to the X position after being multiplied by random.nextGaussian()
+
| Byte
|-
+
| Bit field, see below
| Offset Y || Float || This is added to the Y position after being multiplied by random.nextGaussian()
+
|-
|-
+
| Flying Speed
| Offset Z || Float || This is added to the Z position after being multiplied by random.nextGaussian()
+
| Float
|-
+
| 0.05 by default
| Particle data || Float || The data of each particle
+
|-
|-
+
| Field of View Modifier
| Number of particles || Int || The number of particles to create
+
| Float
|}
+
| 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.
 +
|}
  
==== Change Game State ====
+
About the flags:
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Field
 +
! Bit
 +
|-
 +
| Invulnerable
 +
| 0x01
 +
|-
 +
| Flying
 +
| 0x02
 +
|-
 +
| Allow Flying
 +
| 0x04
 +
|-
 +
| Creative Mode (Instant Break)
 +
| 0x08
 +
|}
  
It appears when a bed can't be used as a spawn point and when the rain state changes.
+
==== Combat Event ====
  
The class has an array of strings linked to reason codes 0, 1, 2, and 3 but only the codes for 1 and 2 are null.
+
Originally used for metadata for twitch streaming circa 1.8.  Now only used to display the game over screen (with enter combat and end combat completely ignored by the Notchain client)
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="2" | 0x2B || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Reason || Unsigned Byte ||
+
!colspan="2"| Field Name
|-
+
! Field Type
| Value || Float || Depends on reason
+
! Notes
|}
+
|-
 +
|rowspan="8"| 0x33
 +
|rowspan="8"| Play
 +
|rowspan="8"| Client
 +
|colspan="2"| Event
 +
| VarInt Enum
 +
| Determines the layout of the remaining packet
 +
|-
 +
! Event
 +
! Field Name
 +
!
 +
!
 +
|-
 +
| 0: enter combat
 +
| ''no fields''
 +
| ''no fields''
 +
|
 +
|-
 +
|rowspan="2"| 1: end combat
 +
| Duration
 +
| VarInt
 +
| Length of the combat in ticks.
 +
|-
 +
| Entity ID
 +
| Int
 +
| ID of the primary opponent of the ended combat, or -1 if there is no obvious primary opponent.
 +
|-
 +
|rowspan="3"| 2: entity dead
 +
| Player ID
 +
| VarInt
 +
| Entity ID of the player that died (should match the client's entity ID).
 +
|-
 +
| Entity ID
 +
| Int
 +
| The killing entity's ID, or -1 if there is no obvious killer.
 +
|-
 +
| Message
 +
| [[Chat]]
 +
| The death message
 +
|}
 +
 
 +
==== Player Info ====
  
'''Reason codes'''
+
Sent by the server to update the user list (<tab> in the client).
  
 
{| class="wikitable"
 
{| class="wikitable"
! Code !! Effect !! Notes
+
! Packet ID
|-
+
! State
| 0 || Invalid Bed || "tile.bed.notValid"
+
! Bound To
|-
+
!colspan="4"| Field Name
| 1 || End raining ||  
+
!colspan="3"| Field Type
|-
+
! Notes
| 2 || Begin raining ||  
+
|-
|-
+
|rowspan="19"| 0x34
| 3 || Change game mode || "gameMode.changed" 0 - Survival, 1 - Creative, 2 - Adventure
+
|rowspan="19"| Play
|-
+
|rowspan="19"| Client
| 4 || Enter credits ||
+
|colspan="4"| Action
|-
+
|colspan="3"| VarInt
| 5 || Demo messages || 0 - Show welcome to demo screen, 101 - Tell movement controls, 102 - Tell jump control, 103 - Tell inventory control
+
| Determines the rest of the Player format after the UUID
|-  
+
|-
| 6 || Arrow hitting player || Appears to be played when an arrow strikes another player in Multiplayer
+
|colspan="4"| Number Of Players
|-
+
|colspan="3"| VarInt
| 7 || Fade value || The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
+
| Number of elements in the following array
|-
+
|-
| 8 || Fade time || Time in ticks for the sky to fade
+
|rowspan="17"| Player
|}
+
|colspan="3"| UUID
 +
|rowspan="17"| Array
 +
|colspan="2"| UUID
 +
|  
 +
|-
 +
! Action
 +
!colspan="2"| Field Name
 +
!colspan="2"|
 +
!
 +
|-
 +
|rowspan="10"| 0: add player
 +
|colspan="2"| Name
 +
|colspan="2"| String (16)
 +
|
 +
|-
 +
|colspan="2"| Number Of Properties
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array
 +
|-
 +
|rowspan="4"| Property
 +
| Name
 +
|rowspan="4"| Array
 +
| String (32767)
 +
|
 +
|-
 +
| Value
 +
| String (32767)
 +
|  
 +
|-
 +
| Is Signed
 +
| Boolean
 +
|  
 +
|-
 +
| Signature
 +
| Optional String (32767)
 +
| Only if Is Signed is true
 +
|-
 +
|colspan="2"| Gamemode
 +
|colspan="2"| VarInt
 +
|
 +
|-
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
| Measured in milliseconds
 +
|-
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
|colspan="2"| Optional [[Chat]]
 +
| Only if Has Display Name is true
 +
|-
 +
| 1: update gamemode
 +
|colspan="2"| Gamemode
 +
|colspan="2"| VarInt
 +
|
 +
|-  
 +
| 2: update latency
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
| Measured in milliseconds
 +
|-
 +
|rowspan="2"| 3: update display name
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
|colspan="2"| Optional [[Chat]]
 +
| Only send if Has Display Name is true
 +
|-
 +
| 4: remove player
 +
|colspan="2"| ''no fields''
 +
|colspan="2"| ''no fields''
 +
|  
 +
|}
 +
 
 +
The Property field looks as in the response of [[Mojang API#UUID -> Profile + Skin/Cape]], except of course using the protocol format instead of JSON. That is, each player will usually have one property with Name “textures” and Value being a base64-encoded JSON string as documented at [[Mojang API#UUID -> Profile + Skin/Cape]]. An empty properties array is also acceptable, and will cause clients to display the player with one of the two default skins depending on UUID.
  
==== Spawn Global Entity ====
+
Ping values correspond with icons in the following way:
 +
* A ping that negative (i.e. not known to the server yet) will result in the no connection icon.
 +
* A ping under 150 milliseconds will result in 5 bars
 +
* A ping under 300 milliseconds will result in 4 bars
 +
* A ping under 600 milliseconds will result in 3 bars
 +
* A ping under 1000 milliseconds (1 second) will result in 2 bars
 +
* A ping greater than or equal to 1 second will result in 1 bar.
  
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.
+
==== Face Player ====
 +
 
 +
Used to rotate the client player to face the given location or entity (for <code>/teleport [<targets>] <x> <y> <z> facing</code>).
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="5" | 0x2C || rowspan=5 | Play || rowspan=5 | Client
+
! Bound To
| Entity ID || VarInt || The entity ID of the thunderbolt
+
! Field Name
|-
+
! Field Type
| Type || Byte || The global entity type, currently always 1 for thunderbolt.
+
! Notes
|-
+
|-
| X || Int || Thunderbolt X a [[Data_Types#Fixed-point_numbers|fixed-point number]]
+
|rowspan="8"| 0x35
|-
+
|rowspan="8"| Play
| Y || Int || Thunderbolt Y a [[Data_Types#Fixed-point_numbers|fixed-point number]]
+
|rowspan="8"| Client
|-
+
|-
| Z || Int || Thunderbolt Z a [[Data_Types#Fixed-point_numbers|fixed-point number]]
+
| Feet/eyes
|}
+
| VarInt enum
 +
| Values are feet=0, eyes=1.  If set to eyes, aims using the head position; otherwise aims using the feet position.
 +
|-
 +
| Target x
 +
| Double
 +
| x coordinate of the point to face towards
 +
|-
 +
| Target y
 +
| Double
 +
| y coordinate of the point to face towards
 +
|-
 +
| Target z
 +
| Double
 +
| z coordinate of the point to face towards
 +
|-
 +
| Is entity
 +
| Boolean
 +
| If true, additional information about an entity is provided.
 +
|-
 +
| Entity ID
 +
| Optional VarInt
 +
| Only if is entity is true &mdash; the entity to face towards
 +
|-
 +
| Entity feet/eyes
 +
| Optional VarInt enum
 +
| Whether to look at the entity's eyes or feet.  Same values and meanings as before, just for the entity's head/feet.
 +
|}
  
==== Open Window ====
+
If the entity given by entity ID cannot be found, this packet should be treated as if is entity was false.
 +
 
 +
==== Player Position And Look (clientbound) ====  
 +
 
 +
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
 +
 
 +
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
 +
 
 +
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”.
 +
 
 +
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
  
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.
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="6" | 0x2D || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| Window id || Unsigned Byte || A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
+
! Field Name
|-
+
! Field Type
| Inventory Type || Unsigned Byte || The window type to use for display. Check below
+
! Notes
|-
+
|-
| Window title || String || The title of the window.
+
|rowspan="7"| 0x36
|-
+
|rowspan="7"| Play
| Number of Slots || Unsigned Byte || Number of slots in the window (excluding the number of slots in the player inventory).
+
|rowspan="7"| Client
|-
+
| X
| Use provided window title || Bool || If false, the client will look up a string like "window.minecart". If true, the client uses what the server provides.
+
| Double
|-
+
| Absolute or relative position, depending on Flags
| Entity ID || Int || EntityHorse's entityId. Only sent when window type is equal to 11 (AnimalChest).
+
|-
|}
+
| Y
 +
| Double
 +
  | Absolute or relative position, depending on Flags
 +
|-
 +
| Z
 +
| Double
 +
| Absolute or relative position, depending on Flags
 +
  |-
 +
| 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
 +
|-
 +
| Teleport ID
 +
| VarInt
 +
| Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
 +
|}
  
See [[Inventory#Windows|inventory windows]] for further information.
+
About the Flags field:
  
==== Close Window ====
+
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
  
This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open.
+
{| class="wikitable"
 +
|-
 +
! Field
 +
! Bit
 +
|-
 +
| X
 +
| 0x01
 +
|-
 +
| Y
 +
| 0x02
 +
|-
 +
| Z
 +
| 0x04
 +
|-
 +
| Y_ROT
 +
| 0x08
 +
|-
 +
| X_ROT
 +
| 0x10
 +
|}
  
Note, notchian clients send a close window message with window id 0 to close their inventory even though there is never an Open Window message for inventory.
+
==== Unlock Recipes ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| 0x2E || rowspan=1 | Play || rowspan=1 | Client
+
! Bound To
| Window ID || Unsigned Byte || This is the id of the window that was closed. 0 for inventory.
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="10"| 0x37
 +
|rowspan="10"| Play
 +
|rowspan="10"| Client
 +
|-
 +
| Action
 +
| VarInt
 +
| 0: init, 1: add, 2: remove
 +
|-
 +
| Crafting Recipe Book Open
 +
| Boolean
 +
| If true, then the crafting recipe book will be open when the player opens its inventory.
 +
|-
 +
| Crafting Recipe Book Filter Active
 +
| Boolean
 +
| If true, then the filtering option is active when the players opens its inventory.
 +
|-
 +
| Smelting Recipe Book Open
 +
| Boolean
 +
| If true, then the smelting recipe book will be open when the player opens its inventory.
 +
|-
 +
| Smelting Recipe Book Filter Active
 +
| Boolean
 +
| If true, then the filtering option is active when the players opens its inventory.
 +
|-
 +
| Array size 1
 +
| VarInt
 +
| Number of elements in the following array
 +
|-
 +
| Recipe IDs
 +
| Array of Identifier
 +
|
 +
|-
 +
| Array size 2
 +
| Optional VarInt
 +
| Number of elements in the following array, only present if mode is 0 (init)
 +
|-
 +
| Recipe IDs
 +
| Optional Array of Identifier, only present if mode is 0 (init)
 +
|
 +
|}
 +
Action:
 +
* 0 (init) = All the recipes in the list 2 will added to the recipe book. All the recipes in list 1 will be tagged as displayed, recipes that aren't tagged will be shown in the notification.
 +
* 1 (add) = All the recipes in the list are added and their icon will be shown in the notification.
 +
* 2 (remove) = Remove all the recipes in the list. This allows them to re-displayed when they are readded.
  
==== Set Slot ====
+
==== Destroy Entities ====
  
Sent by the server when an item in a slot (in a window) is added/removed.
+
Sent by the server when a list of entities is to be destroyed on the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="3" | 0x2F || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Window ID || Byte
+
! Field Name
| 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).
+
! Field Type
|-
+
! Notes
| Slot || Short || The slot that should be updated
+
|-
|-
+
|rowspan="2"| 0x38
| Slot data || [[Slot_Data|Slot]] ||
+
|rowspan="2"| Play
|}
+
|rowspan="2"| Client
 +
| Count
 +
| VarInt
 +
| Number of elements in the following array
 +
|-
 +
| Entity IDs
 +
| Array of VarInt
 +
| The list of entities of destroy
 +
|}
  
==== Window Items ====
+
==== Remove Entity Effect ====
  
[[File:Inventory-slots.png|thumb|The inventory slots]]
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x39
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| Effect ID
 +
| Byte
 +
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 +
|}
  
Sent by the server when an item in a slot (in a window) is added/removed. This includes the main inventory, equipped armour and crafting slots.
+
==== Resource Pack Send ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="3" | 0x30 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Window ID || Unsigned Byte || The id of window which items are being sent for. 0 for player inventory.
+
! Field Name
|-
+
! Field Type
| Count || Short || The number of slots (see below)
+
! Notes
|-
+
|-
| Slot data || Array of [[Slot_Data|Slot]]s ||
+
|rowspan="2"| 0x3A
|}
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| URL
 +
| String (32767)
 +
| The URL to the resource pack.
 +
|-
 +
| Hash
 +
| String (40)
 +
| A 40 character hexadecimal and lowercase [[wikipedia:SHA-1|SHA-1]] hash of the resource pack file. (must be lower case in order to work)<br />If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth — but it will still treat it as a unique id
 +
|}
 +
 
 +
==== Respawn ====
  
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
+
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.
  
==== Window Property ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="3" | 0x31 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Window ID || Unsigned Byte || The id of the window.
+
! Field Name
|-
+
! Field Type
| Property || Short || Which property should be updated.
+
! Notes
|-
+
|-
| Value || Short || The new value for the property.
+
|rowspan="4"| 0x3B
|}
+
|rowspan="4"| Play
 +
|rowspan="4"| Client
 +
| Dimension
 +
| Int Enum
 +
| -1: The Nether, 0: The Overworld, 1: The End
 +
|-
 +
| Hashed seed
 +
| Long
 +
| First 8 bytes of the SHA-256 hash of the world's seed.
 +
|-
 +
| Gamemode
 +
| Unsigned Byte
 +
| 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
 +
|-
 +
| Level Type
 +
| String (16)
 +
| Same as [[#Join Game|Join Game]]
 +
|}
  
'''Furnace'''
+
{{Warning2|Avoid changing player's dimension to same dimension they were already in unless they are dead. If you change the dimension to one they are already in, weird bugs can occur, such as the player being unable to attack other players in new world (until they die and respawn).
 +
 
 +
If you must respawn a player in the same dimension without killing them, send two respawn packets, one to a different world and then another to the world you want. You do not need to complete the first respawn; it only matters that you send two packets.}}
 +
 
 +
==== Entity Head Look ====
 +
 
 +
Changes the direction an entity's head is facing.
  
Properties:
+
While sending the Entity Look packet changes the vertical rotation of the head, sending this packet appears to be necessary to rotate the head horizontally.
  
* 0: Progress arrow
+
{| class="wikitable"
* 1: Fire icon (fuel)
+
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x3C
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| Head Yaw
 +
| Angle
 +
| New angle, not a delta
 +
|}
  
Values:
+
==== Select Advancement Tab ====
  
* 0-200 for progress arrow
+
Sent by the server to indicate that the client should switch advancement tab. Sent either when the client switches tab in the GUI or when an advancement in another tab is made.
* 0-200 for fuel indicator
 
  
Ranges are presumably in in-game ticks
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x3D
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Has id
 +
| Boolean
 +
| Indicates if the next field is present
 +
|-
 +
| Optional Identifier
 +
| String (32767)
 +
| See below
 +
|}
  
'''Enchantment Table'''
+
The Identifier can be one of the following:
  
Properties: 0, 1 or 2 depending on the "enchantment slot" being given.
+
{| class="wikitable"
 +
! Optional Identifier
 +
|-
 +
| minecraft:story/root
 +
|-
 +
| minecraft:nether/root
 +
|-
 +
| minecraft:end/root
 +
|-
 +
| minecraft:adventure/root
 +
|-
 +
| minecraft:husbandry/root
 +
|}
  
Values: The enchantment's level.
+
If no or an invalid identifier is sent, the client will switch to the first tab in the GUI.
  
'''Beacon'''
+
==== World Border ====
  
* 0: Power level
+
{| class="wikitable"
* 1: Potion effect one
+
! Packet ID
* 2: Potion effect two
+
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="18"| 0x3E
 +
|rowspan="18"| Play
 +
|rowspan="18"| Client
 +
|colspan="2"| Action
 +
| VarInt Enum
 +
| Determines the format of the rest of the packet
 +
|-
 +
! Action
 +
! Field Name
 +
!
 +
!
 +
|-
 +
| 0: set size
 +
| Diameter
 +
| Double
 +
| Length of a single side of the world border, in meters
 +
|-
 +
|rowspan="3"| 1: lerp size
 +
| Old Diameter
 +
| Double
 +
| Current length of a single side of the world border, in meters
 +
|-
 +
| New Diameter
 +
| Double
 +
| Target length of a single side of the world border, in meters
 +
|-
 +
| Speed
 +
| VarLong
 +
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 +
|-
 +
|rowspan="2"| 2: set center
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
|rowspan="8"| 3: initialize
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Old Diameter
 +
| Double
 +
| Current length of a single side of the world border, in meters
 +
|-
 +
| New Diameter
 +
| Double
 +
| Target length of a single side of the world border, in meters
 +
|-
 +
| Speed
 +
| VarLong
 +
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 +
|-
 +
| Portal Teleport Boundary
 +
| VarInt
 +
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 +
|-
 +
| Warning Time
 +
| VarInt
 +
| In seconds as set by <code>/worldborder warning time</code>
 +
|-
 +
| Warning Blocks
 +
| VarInt
 +
| In meters
 +
|-
 +
|rowspan="1"| 4: set warning time
 +
| Warning Time
 +
| VarInt
 +
| In seconds as set by <code>/worldborder warning time</code>
 +
|-
 +
|rowspan="1"| 5: set warning blocks
 +
| Warning Blocks
 +
| VarInt
 +
| In meters
 +
|}
  
'''Anvil'''
+
The Notchian client determines how solid to display the warning by comparing to whichever is higher, the warning distance or whichever is lower, the distance from the current diameter to the target diameter or the place the border will be after warningTime seconds. In pseudocode:
  
* 0: Maximum cost
+
<syntaxhighlight lang="java">
 +
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 +
if (playerDistance < distance) {
 +
    warning = 1.0 - playerDistance / distance;
 +
} else {
 +
    warning = 0.0;
 +
}
 +
</syntaxhighlight>
  
'''Brewing Stand'''
+
==== Camera ====
  
* 0: Brew time
+
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
  
Brew time is a value between 0 and 400, with 400 making the arrow empty, and 0 making the arrow full.
+
The player's camera will move with the entity and look where it is looking. The entity is often another player, but can be any type of entity.  The player is unable to move this entity (move packets will act as if they are coming from the other entity).
  
==== Confirm Transaction ====
+
If the given entity is not loaded by the player, this packet is ignored.  To return control to the player, send this packet with their entity ID.
  
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.
+
The Notchian server resets this (sends it back to the default entity) whenever the spectated entity is killed or the player sneaks, but only if they were spectating an entity. It also sends this packet whenever the player switches out of spectator mode (even if they weren't spectating an entity).
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="3" | 0x32 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Window ID || Unsigned Byte || The id of the window that the action occurred in.
+
! Field Name
|-
+
! Field Type
| Action number || Short || Every action that is to be accepted has a unique number. This field corresponds to that number.
+
! Notes
|-
+
|-
| Accepted || Bool || Whether the action was accepted.
+
|rowspan="1"| 0x3F
|}
+
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Camera ID
 +
| VarInt
 +
| ID of the entity to set the client's camera to
 +
|}
  
==== Update Sign ====
+
The notchian also loads certain shaders for given entities:
 +
 
 +
* Creeper &rarr; <code>shaders/post/creeper.json</code>
 +
* Spider (and cave spider) &rarr; <code>shaders/post/spider.json</code>
 +
* Enderman &rarr; <code>shaders/post/invert.json</code>
 +
* Anything else &rarr; the current shader is unloaded
 +
 
 +
==== Held Item Change (clientbound) ====
  
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.
+
Sent to change the player's slot selection.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="7" | 0x33 || rowspan=7 | Play || rowspan=7 | Client
+
! Bound To
| X || Int || Block X Coordinate
+
! Field Name
|-
+
! Field Type
| Y || Short || Block Y Coordinate
+
! Notes
|-
+
|-
| Z || Int || Block Z Coordinate
+
|rowspan="1"| 0x40
|-
+
|rowspan="1"| Play
| Line 1 || String || First line of text in the sign
+
|rowspan="1"| Client
|-
+
| Slot
| Line 2 || String || Second line of text in the sign
+
| Byte
|-
+
| The slot which the player has selected (0–8)
| Line 3 || String || Third line of text in the sign
+
|}
|-
 
| Line 4 || String || Fourth line of text in the sign
 
|}
 
  
==== Maps ====
+
==== Update View Position ====
  
If the first byte of the array is 0, the next two bytes are X start and Y start and the rest of the bytes are the colors in that column.
+
{{Need Info|Why is this even needed?  Is there a better name for it?  My guess is that it's something to do with logical behavior with latency, but it still seems weird.}}
  
If the first byte of the array is 1, the rest of the bytes are in groups of three: (data, x, y). The lower half of the data is the type (always 0 under vanilla) and the upper half is the direction.
+
Updates the client's location. This is used to determine what chunks should remain loaded and if a chunk load should be ignored; chunks outside of the view distance may be unloaded.
  
If the first byte of the array is 2, the second byte is the map scale.
+
Sent whenever the player moves across a chunk border horizontally, and also (according to testing) for any integer change in the vertical axis, even if it doesn't go across a chunk section border.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="3" | 0x34 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Item Damage || VarInt || The damage value of the map being modified
+
! Field Name
|-
+
! Field Type
| Length || Short || Length of following byte array
+
! Notes
|-
+
|-
| Data || Byte Array || Array data
+
|rowspan="2"| 0x41
|}
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Chunk X
 +
| VarInt
 +
| Chunk X coordinate of the player's position
 +
|-
 +
| Chunk Z
 +
| VarInt
 +
| Chunk Z coordinate of the player's position
 +
|}
  
==== Update Block Entity ====
+
==== Update View Distance ====
  
Essentially a block update on a block entity.
+
Sent by the integrated singleplayer server when changing render distance.  Does not appear to be used by the dedicated server, as <code>view-distance</code> in server.properties cannot be changed at runtime.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="6" | 0x35 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| X || Int ||
+
! Field Name
|-
+
! Field Type
| Y || Short ||
+
! Notes
|-
+
|-
| Z || Int ||
+
|rowspan="1"| 0x42
|-
+
|rowspan="1"| Play
| Action || Unsigned Byte || The type of update to perform
+
|rowspan="1"| Client
|-
+
| View Distance
| Data length || Short || Varies
+
| VarInt
|-
+
| Render distance (2-32)
| NBT Data || Byte Array || Present if data length > 0. Compressed with [[wikipedia:Gzip|gzip]]. Varies, but based on the NBT chunk storage format as can be found in the Minecraft Wiki (http://www.minecraftwiki.net/Chunk_Format)
+
|}
|}
+
 
 +
==== Display Scoreboard ====
  
'''Actions'''
+
This is sent to the client when it should display a scoreboard.
  
* '''1''': Set mob displayed inside a mob spawner
+
{| class="wikitable"
* '''2''': Set command block text (command and last execution status)
+
! Packet ID
* '''3''': Set rotation and skin of mob head
+
! State
* '''4''': Set type of flower in flower pot
+
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x43
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Position
 +
| Byte
 +
| The position of the scoreboard. 0: list, 1: sidebar, 2: below name, 3 - 18: team specific sidebar, indexed as 3 + team color.
 +
|-
 +
| Score Name
 +
| String (16)
 +
| The unique name for the scoreboard to be displayed.
 +
|}
  
==== Sign Editor Open ====
+
==== Entity Metadata ====
  
Sent on placement of sign.
+
Updates one or more [[Entities#Entity Metadata Format|metadata]] properties for an existing entity. Any properties not included in the Metadata field are left unchanged.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="3" | 0x36 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| X || Int || X in block coordinates
+
! Field Name
|-
+
! Field Type
| Y || Int || Y in block coordinates
+
! Notes
|-
+
|-
| Z || Int || Z in block coordinates
+
|rowspan="2"| 0x44
|}
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| VarInt
 +
|  
 +
|-
 +
| Metadata
 +
| [[Entities#Entity Metadata Format|Entity Metadata]]
 +
|  
 +
|}
 +
 
 +
==== Attach Entity ====
 +
 
 +
This packet is sent when an entity has been {{Minecraft Wiki|Lead|leashed}} to another entity.
  
==== Statistics ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To  
+
! Packet ID
! colspan="2" | Field Name
+
!