Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
m (→‎Spawn Painting: Note regular wiki's article)
(Fixed a link)
 
(213 intermediate revisions by 40 users not shown)
Line 5: Line 5:
 
   |ICON =  
 
   |ICON =  
 
   |HEADING = Heads up!
 
   |HEADING = Heads up!
   |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''computer edition'''. For the computer edition pre-releases, see [[Pre-release protocol]]. For Pocket Edition, see [[Pocket Edition Protocol Documentation]].
+
   |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''Java Edition''' ([[Protocol version numbers|1.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]].
 
}}
 
}}
  
 
This page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''.
 
This page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''.
  
If you're having trouble, check out the [[Protocol FAQ|FAQ]] or ask for help in the IRC channel ([irc://irc.freenode.net/mcdevs #mcdevs on chat.freenode.net]).
+
If you're having trouble, check out the [[Protocol FAQ|FAQ]] or ask for help in the IRC channel [ircs://chat.freenode.net:6697/mcdevs #mcdevs on chat.freenode.net] ([http://wiki.vg/MCDevs More Information]).
  
 
'''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, etc… you still need to provide attribution to #mcdevs if you copy any of the contents of this page for publication elsewhere.
 
'''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, etc… you still need to provide attribution to #mcdevs if you copy any of the contents of this page for publication elsewhere.
Line 18: Line 18:
 
== Definitions ==
 
== Definitions ==
  
The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] ([[#Handshaking|Handshaking]], 0x00, serverbound) and [[#Login Success|Login Success]] ([[#Login|Login]], 0x02, clientbound).
+
The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] and [[#Login Success|Login Success]].
  
 
=== Data types ===
 
=== Data types ===
Line 47: Line 47:
 
  |-
 
  |-
 
  | Global palette
 
  | Global palette
  | A table/dictionary/palette mapping nonnegative integers to block states. The block state IDs can be constructed from {{Minecraft Wiki|Data values|this table}} by multiplying what the Minecraft Wiki calls “block IDs” by 16 and adding the metadata/damage value (or in most programming languages <code>block_id &lt;&lt; 4 <nowiki>|</nowiki> metadata</code>).
+
  | A table/dictionary/palette mapping nonnegative integers to block states. Block state IDs are created in a linear fashion based off of order of assignment.  One block state ID allocated for each unique block state for a block; if a block has multiple properties then the number of allocated states is the product of the number of values for each property.  A current list of properties and state ID ranges is found on [https://pokechu22.github.io/Burger/1.15.2.html burger].
 +
 
 +
Alternatively, the vanilla server now includes an option to export the current block state ID mapping, by running <code>java -cp minecraft_server.jar net.minecraft.data.Main --reports</code>.  See [[Data Generators]] for more information.
 
  |-
 
  |-
 
  | Notchian
 
  | Notchian
Line 64: Line 66:
 
  | Length
 
  | Length
 
  | VarInt
 
  | VarInt
  | Length of packet data + length of the packet ID
+
  | Length of Packet ID + Data
 
  |-
 
  |-
 
  | Packet ID
 
  | Packet ID
Line 77: Line 79:
 
=== With compression ===
 
=== With compression ===
  
Once a [[#Set Compression|Set Compression]] packet is sent, [[wikipedia:Zlib|zlib]] compression is enabled for all following packets. The format of a packet changes slighty to include the size of the uncompressed packet.
+
Once a [[#Set Compression|Set Compression]] packet (with a non-negative threshold) is sent, [[wikipedia:Zlib|zlib]] compression is enabled for all following packets. The format of a packet changes slighty to include the size of the uncompressed packet.
  
 
{| class=wikitable
 
{| class=wikitable
Line 97: Line 99:
 
  |rowspan="2"| Yes
 
  |rowspan="2"| Yes
 
  | Packet ID
 
  | Packet ID
  | Varint
+
  | VarInt
 
  | zlib compressed packet ID (see the sections below)
 
  | zlib compressed packet ID (see the sections below)
 
  |-
 
  |-
Line 109: Line 111:
 
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
 
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
  
If compressed, the uncompressed length of (Packet ID + Data) must be equal to or over the threshold set in the packet [[#Set Compression 2|Set Compression]] ([[#Login|Login]], 0x03, clientbound), otherwise the receiving party will disconnect.
+
If compressed, the uncompressed length of (Packet ID + Data) must be equal to or over the threshold set in the packet [[#Set Compression|Set Compression]], otherwise the receiving party will disconnect.
  
Compression can be disabled by sending the packet [[#Set Compression 2|Set Compression]] ([[#Login|Login]], 0x03, clientbound) with a Threshold of -1.
+
Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all.
  
 
== Handshaking ==
 
== Handshaking ==
Line 138: Line 140:
 
  | Protocol Version
 
  | Protocol Version
 
  | VarInt
 
  | VarInt
  | See [[protocol version numbers]] (currently 210 in Minecraft 1.10.2)
+
  | See [[protocol version numbers]] (currently 578 in Minecraft 1.15.2)
 
  |-
 
  |-
 
  | Server Address
 
  | Server Address
  | String
+
  | String (255)
  | Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. The Notchian server does not use this information.
+
  | Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. The Notchian server does not use this information. Note that SRV records are a complete redirect, e.g. if _minecraft._tcp.example.com points to mc.example.org, users connecting to example.com will provide mc.example.org as server address in addition to connecting to it.
 
  |-  
 
  |-  
 
  | Server Port
 
  | Server Port
Line 177: Line 179:
 
See [[Server List Ping#1.6]] for the details of the protocol that follows this packet.
 
See [[Server List Ping#1.6]] for the details of the protocol that follows this packet.
  
== Play ==
+
== Status ==
 +
{{Main|Server List Ping}}
  
 
=== Clientbound ===
 
=== Clientbound ===
  
==== Spawn Object ====
+
==== Response ====
 
 
Sent by the server when a vehicle or other object is created.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 193: Line 194:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="12"| 0x00
+
  |rowspan="2"| 0x00
  |rowspan="12"| Play
+
  |rowspan="2"| Status
  |rowspan="12"| Client
+
  |rowspan="2"| Client
| Entity ID
 
| VarInt
 
| EID of the object
 
 
  |-
 
  |-
  | Object UUID
+
  | JSON Response
  | UUID
+
  | String (32767)
  |  
+
  | See [[Server List Ping#Response]]; as with all strings this is prefixed by its length as a VarInt
 +
|}
 +
 
 +
==== Pong ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Type
+
  |rowspan="1"| 0x01
  | Byte
+
  |rowspan="1"| Status
  | The type of object (see [[Entities#Objects]])
+
  |rowspan="1"| Client
  |-
+
  | Payload
  | X
+
  | Long
  | Double
+
  | Should be the same as sent by the client
  |  
+
  |}
  |-
+
 
  | Y
+
=== Serverbound ===
  | Double
+
 
  |
+
==== Request ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Z
+
  |rowspan="1"| 0x00
| Double
+
  | Status
|
+
  | Server
|-
+
  |colspan="3"| ''no fields''
| Pitch
 
| Angle
 
|
 
|-
 
| Yaw
 
| Angle
 
|
 
|-
 
| Data
 
| Int
 
| Meaning dependent on the value of the Type field, see [[Object Data]] for details.
 
|-
 
| Velocity X
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]].
 
|-
 
| Velocity Y
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]].
 
|-
 
  | Velocity Z
 
  | Short
 
  | Same units as [[#Entity Velocity|Entity Velocity]].
 
 
  |}
 
  |}
  
==== Spawn Experience Orb ====
+
==== Ping ====
 
 
Spawns one or more experience orbs.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 257: Line 249:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x01
+
  |rowspan="1"| 0x01
  |rowspan="5"| Play
+
  |rowspan="1"| Status
  |rowspan="5"| Client
+
  |rowspan="1"| Server
  | Entity ID
+
  | Payload
| VarInt
+
  | Long
|
+
  | May be any number. Notchian clients use a system-dependent time value which is counted in milliseconds.
|-
 
| X
 
| Double
 
  |  
 
  |-
 
| Y
 
| Double
 
|
 
|-
 
| Z
 
| Double
 
|
 
|-
 
| Count
 
| Short
 
| The amount of experience this orb will reward once collected
 
 
  |}
 
  |}
  
==== Spawn Global Entity ====
+
== Login ==
 +
 
 +
The login process is as follows:
 +
 
 +
# C→S: [[#Handshake|Handshake]] with Next State set to 2 (login)
 +
# C→S: [[#Login Start|Login Start]]
 +
# S→C: [[#Encryption Request|Encryption Request]]
 +
# Client auth
 +
# C→S: [[#Encryption Response|Encryption Response]]
 +
# Server auth, both enable encryption
 +
# S→C: [[#Set Compression|Set Compression]] (optional)
 +
# S→C: [[#Login Success|Login Success]]
 +
 
 +
Set Compression, if present, must be sent before Login Success. Note that anything sent after Set Compression must use the [[#With_compression|Post Compression packet format]].
 +
 
 +
For unauthenticated ("cracked"/offline-mode) and 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]].
 +
 
 +
See [[Protocol Encryption]] for details.
 +
 
 +
=== Clientbound ===
  
With this packet, the server notifies the client of thunderbolts striking within a 512 block radius around the player. The coordinates specify where exactly the thunderbolt strikes.
+
==== Disconnect (login) ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 293: Line 288:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x02
+
  |rowspan="1"| 0x00
  |rowspan="5"| Play
+
  |rowspan="1"| Login
  |rowspan="5"| Client
+
  |rowspan="1"| Client
  | Entity ID
+
  | Reason
| VarInt
+
  | [[Chat]]
| The EID of the thunderbolt
 
|-
 
| Type
 
| Byte Enum
 
| The global entity type, currently always 1 for thunderbolt
 
|-
 
| X
 
| Double
 
|
 
|-
 
| Y
 
| Double
 
|
 
|-
 
| Z
 
  | Double
 
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Spawn Mob ====
+
==== Encryption Request ====
 
 
Sent by the server when a mob entity is spawned.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 329: Line 306:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="13"| 0x03
+
  |rowspan="5"| 0x01
  |rowspan="13"| Play
+
  |rowspan="5"| Login
  |rowspan="13"| Client
+
  |rowspan="5"| Client
  | Entity ID
+
  | Server ID
 +
| String (20)
 +
| Appears to be empty
 +
|-
 +
| Public Key Length
 
  | VarInt
 
  | VarInt
  |  
+
  | Length of Public Key
 
  |-
 
  |-
  | Entity UUID
+
  | Public Key
  | UUID
+
  | Byte Array
 
  |  
 
  |  
 
  |-
 
  |-
  | Type
+
  | Verify Token Length
  | Unsigned Byte
+
  | VarInt
  | The type of mob. See [[Entities#Mobs]]
+
  | Length of Verify Token. Always 4 for Notchian servers.
 
  |-
 
  |-
  | X
+
  | Verify Token
  | Double
+
  | Byte Array
  |  
+
  | A sequence of random bytes generated by the server
  |-
+
  |}
| Y
+
 
| Double
+
See [[Protocol Encryption]] for details.
|
 
|-
 
| Z
 
| Double
 
|
 
|-
 
| Yaw
 
| Angle
 
|
 
|-
 
| Pitch
 
| Angle
 
|
 
|-
 
| Head Pitch
 
| Angle
 
|
 
|-
 
| Velocity X
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]]
 
|-
 
| Velocity Y
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]]
 
|-
 
| Velocity Z
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]]
 
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Entity Metadata]]
 
|
 
|}
 
  
==== Spawn Painting ====
+
==== Login Success ====
 
 
This packet shows location, name, and type of painting.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 397: Line 342:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x04
+
  |rowspan="2"| 0x02
  |rowspan="5"| Play
+
  |rowspan="2"| Login
  |rowspan="5"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | UUID
  | VarInt
+
  | String (36)
  |  
+
  | Unlike in other packets, this field contains the UUID as a string with hyphens.
 
  |-
 
  |-
  | Entity UUID
+
  | Username
  | UUID
+
  | String (16)
 
  |  
 
  |  
|-
 
| Title
 
| String
 
| Name of the painting. Max length 13
 
|-
 
| Location
 
| Position
 
| Center coordinates (see below)
 
|-
 
| Direction
 
| Byte Enum
 
| Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
 
 
  |}
 
  |}
  
Calculating the center of an image: given a (width × height) grid of cells, with <code>(0, 0)</code> being the top left corner, the center is <code>(max(0, width / 2 - 1), height / 2)</code>. E.g. <code>(1, 0)</code> for a 2×1 painting, or <code>(1, 2)</code> for a 4×4 painting.
+
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]]).
 +
 
 +
The notchian client doesn't send any (non-[[#Keep Alive|keep alive]]) packets until the next tick/[[#Time Update|time update]] packet.
 +
}}
 +
 
 +
==== Set Compression ====
  
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):
+
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"
  ! Name
+
  ! Packet ID
  ! x
+
! State
  ! y
+
  ! Bound To
  ! width
+
  ! Field Name
  ! height
+
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>Kebab</code>
+
  |rowspan="1"| 0x03
  | 0
+
|rowspan="1"| Login
  | 0
+
|rowspan="1"| Client
  | 16
+
  | Threshold
  | 16
+
  | VarInt
 +
  | Maximum size of a packet before it is compressed
 +
  |}
 +
 
 +
==== Login Plugin Request ====
 +
 
 +
Used to implement a custom handshaking flow together with [[#Login_Plugin_Response | Login Plugin Response]].
 +
 
 +
Unlike plugin messages in "play" mode, these messages follow a lock-step request/response scheme, where the client is expected to respond to a request indicating whether it understood. The notchian client always responds that it hasn't understood, and sends an empty payload.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>Aztec</code>
+
  |rowspan="3"| 0x04
  | 16
+
|rowspan="3"| Login
  | 0
+
  |rowspan="3"| Client
  | 16
+
  | Message ID
  | 16
+
  | VarInt
 +
  | Generated by the server - should be unique to the connection.
 
  |-
 
  |-
  | <code>Alban</code>
+
  | Channel
  | 32
+
  | Identifier
  | 0
+
  | Name of the [[plugin channel]] used to send the data
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Aztec2</code>
+
  | Data
  | 48
+
  | Byte Array
  | 0
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
  | 16
+
  |}
  | 16
+
 
 +
=== Serverbound ===
 +
 
 +
==== Login Start ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>Bomb</code>
+
  |rowspan="1"| 0x00
  | 64
+
  |rowspan="1"| Login
  | 0
+
  |rowspan="1"| Server
  | 16
+
  | Name
  | 16
+
| String (16)
 +
| Player's Username
 +
  |}
 +
 
 +
==== Encryption Response ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>Plant</code>
+
  |rowspan="4"| 0x01
  | 80
+
|rowspan="4"| Login
  | 0
+
  |rowspan="4"| Server
  | 16
+
  | Shared Secret Length
  | 16
+
  | VarInt
 +
  | Length of Shared Secret
 
  |-
 
  |-
  | <code>Wasteland</code>
+
  | Shared Secret
  | 96
+
  | Byte Array
  | 0
+
  |  
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Pool</code>
+
  | Verify Token Length
  | 0
+
  | VarInt
  | 32
+
  | Length of Verify Token
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Courbet</code>
+
  | Verify Token
  | 32
+
  | Byte Array
  | 32
+
  |  
  | 32
+
  |}
| 16
+
 
  |-
+
See [[Protocol Encryption]] for details.
  | <code>Sea</code>
+
 
  | 64
+
==== Login Plugin Response ====
  | 32
+
 
  | 32
+
{| class="wikitable"
  | 16
+
  ! Packet ID
 +
  ! State
 +
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>Sunset</code>
+
  |rowspan="3"| 0x02
  | 96
+
|rowspan="3"| Login
  | 32
+
  |rowspan="3"| Server
  | 32
+
  | Message ID
  | 16
+
  | VarInt
 +
  | Should match ID from server.
 
  |-
 
  |-
  | <code>Creebet</code>
+
  | Successful
| 128
+
| Boolean
| 32
+
| <code>true</code> if the client understands the request, <code>false</code> otherwise. When <code>false</code>, no payload follows.
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Wanderer</code>
+
  | Data
  | 0
+
  | Optional Byte Array
  | 64
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
  | 16
+
  |}
  | 32
+
 
 +
== Play ==
 +
 
 +
=== Clientbound ===
 +
 
 +
==== Spawn Entity ====
 +
 
 +
Sent by the server when a vehicle or other non-living entity is created.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>Graham</code>
+
  |rowspan="12"| 0x00
  | 16
+
|rowspan="12"| Play
  | 64
+
  |rowspan="12"| Client
  | 16
+
  | Entity ID
  | 32
+
  | VarInt
 +
  | EID of the entity
 
  |-
 
  |-
  | <code>Match</code>
+
  | Object UUID
  | 0
+
  | UUID
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Bust</code>
+
  | Type
  | 32
+
  | VarInt
  | 128
+
  | The type of entity (same as in [[#Spawn Living Entity|Spawn Living Entity]])
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Stage</code>
+
  | X
  | 64
+
  | Double
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Void</code>
+
  | Y
  | 96
+
  | Double
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>SkullAndRoses</code>
+
  | Z
  | 128
+
  | Double
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Wither</code>
+
  | Pitch
  | 160
+
  | Angle
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Fighters</code>
+
  | Yaw
  | 0
+
  | Angle
  | 96
+
  |  
| 64
 
| 32
 
 
  |-
 
  |-
  | <code>Pointer</code>
+
  | Data
  | 0
+
  | Int
  | 192
+
  | Meaning dependent on the value of the Type field, see [[Object Data]] for details.
| 64
 
| 64
 
 
  |-
 
  |-
  | <code>Pigscene</code>
+
  | Velocity X
  | 64
+
  | Short
  | 192
+
  |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).
| 64
 
  | 64
 
 
  |-
 
  |-
  | <code>BurningSkull</code>
+
  | Velocity Y
  | 128
+
  | Short
| 192
 
| 64
 
| 64
 
 
  |-
 
  |-
  | <code>Skeleton</code>
+
  | Velocity Z
  | 192
+
  | Short
| 64
 
| 64
 
| 48
 
|-
 
| <code>DonkeyKong</code>
 
| 192
 
| 112
 
| 64
 
| 48
 
 
  |}
 
  |}
  
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
+
==== Spawn Experience Orb ====
  
==== Spawn Player ====
+
Spawns one or more experience orbs.
 
 
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
 
 
 
This packet must be sent after the [[#Player List Item|Player List Item]] ([[#Play|Play]], 0x38, clientbound) packet that adds the player data for the client to use when spawning a player. If the Player List Item for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player List Item packet includes skin/cape data.
 
 
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 607: Line 567:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x05
+
  |rowspan="5"| 0x01
  |rowspan="8"| Play
+
  |rowspan="5"| Play
  |rowspan="8"| Client
+
  |rowspan="5"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player's EID
+
  |  
|-
 
| Player UUID
 
| UUID
 
| See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
 
 
  |-
 
  |-
 
  | X
 
  | X
Line 630: Line 586:
 
  |  
 
  |  
 
  |-
 
  |-
  | Yaw
+
  | Count
  | Angle
+
  | Short
|
+
  | The amount of experience this orb will reward once collected
|-
 
| Pitch
 
| Angle
 
|
 
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Entity Metadata]]
 
  |  
 
 
  |}
 
  |}
  
When in {{Minecraft Wiki|Serve.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs. In offline mode, UUID v3 is used.
+
==== Spawn Weather Entity ====
  
For NPCs UUID v2 should be used. Note:
+
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.
 
 
<+Grum> i will never confirm this as a feature you know that :)
 
 
 
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 
 
 
==== Animation (clientbound) ====
 
 
 
Sent whenever an entity should change animation.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 663: Line 603:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x06
+
  |rowspan="5"| 0x02
  |rowspan="2"| Play
+
  |rowspan="5"| Play
  |rowspan="2"| Client
+
  |rowspan="5"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player ID
+
  | The EID of the thunderbolt
 +
|-
 +
| Type
 +
| Byte Enum
 +
| The global entity type, currently always 1 for thunderbolt
 
  |-
 
  |-
  | Animation
+
  | X
  | Unsigned Byte
+
  | Double
  | Animation ID (see below)
+
  |  
|}
 
 
 
Animation can be one of the following values:
 
 
 
{| class="wikitable"
 
! ID
 
! Animation
 
 
  |-
 
  |-
  | 0
+
  | Y
  | Swing main arm
+
| Double
 +
  |  
 
  |-
 
  |-
  | 1
+
  | Z
  | Take damage
+
  | Double
  |-
+
  |  
| 2
 
| Leave bed
 
|-
 
| 3
 
| Swing offhand
 
|-
 
| 4
 
| Critical effect
 
|-
 
| 5
 
| Magic critical effect
 
 
  |}
 
  |}
  
==== Statistics ====
+
==== Spawn Living Entity ====
 +
 
 +
Sent by the server when a living entity is spawned.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
  ! Bound To  
+
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x07
+
  |rowspan="12"| 0x03
  |rowspan="3"| Play
+
  |rowspan="12"| Play
  |rowspan="3"| Client
+
  |rowspan="12"| Client
  |colspan="2"| Count
+
  | Entity ID
  |colspan="2"| VarInt
+
  | VarInt
  | Number of elements in the following array
+
  |  
 
  |-
 
  |-
  |rowspan="2"| Statistic
+
  | Entity UUID
| Name
+
  | UUID
|rowspan="2"| Array
+
  |  
  | String
 
  | [https://gist.github.com/thinkofname/a1842c21a0cf2e1fb5e0 https://gist.github.com/thinkofname/a1842c21a0cf2e1fb5e0]
 
 
  |-
 
  |-
  | Value
+
  | Type
 
  | VarInt
 
  | VarInt
  | The amount to set it to
+
  | The type of mob. See [[Entities#Mobs]]
|}
 
 
 
==== Block Break Animation ====
 
 
 
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 
 
 
Block break animations can still be applied on air; the animation will remain visible although there is no block being broken.  However, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency.  (An effect similar to this can be seen in normal gameplay when breaking ice blocks)
 
 
 
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x08
+
  | X
|rowspan="3"| Play
+
  | Double
|rowspan="3"| Client
+
  |  
| Entity ID
 
  | VarInt
 
  | Entity ID of the entity breaking the block
 
 
  |-
 
  |-
  | Location
+
  | Y
  | Position
+
  | Double
  | Block Position
+
  |  
 
  |-
 
  |-
  | Destroy Stage
+
  | Z
  | Byte
+
  | Double
  | 0–9 to set it, any other value to remove it
+
  |  
 +
|-
 +
| 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]]
 
  |}
 
  |}
  
==== Update Block Entity ====
+
==== Spawn Painting ====
  
Sets tile entity associated with the block at the given location.
+
This packet shows location, name, and type of painting.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 772: Line 703:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x09
+
  |rowspan="5"| 0x04
  |rowspan="3"| Play
+
  |rowspan="5"| Play
  |rowspan="3"| Client
+
  |rowspan="5"| Client
  | Location
+
  | Entity ID
  | Position
+
  | VarInt
 +
|
 +
|-
 +
| Entity UUID
 +
| UUID
 
  |  
 
  |  
 
  |-
 
  |-
  | Action
+
  | Motive
  | Unsigned Byte
+
  | VarInt
  | The type of update to perform, see below
+
  | Panting's ID, see below
 
  |-
 
  |-
  | NBT Data
+
  | Location
  | [[NBT|NBT Tag]]
+
  | Position
  | 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)
+
| Center coordinates (see below)
 +
  |-
 +
  | Direction
 +
| Byte Enum
 +
| Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
 
  |}
 
  |}
  
''Action'' field:
+
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.
  
* '''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.)
+
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):
* '''2''': Set command block text (command and last execution status)
 
* '''3''': Set the level, primary, and secondary powers of a beacon
 
* '''4''': Set rotation and skin of mob head
 
* '''5''': Set type of flower in flower pot
 
* '''6''': Set base color and patterns on a banner
 
* '''7''': Set the data for a Structure tile entity
 
* '''8''': Set the destination for a end gateway
 
* '''9''': Set the text on a sign
 
 
 
==== Block Action ====
 
 
 
This packet is used for a number of actions and animations performed by blocks, usually non-persistent.
 
 
 
See [[Block Actions]] for a list of values.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
  ! ID
  ! Bound To
+
  ! x
  ! Field Name
+
  ! y
  ! Field Type
+
  ! width
  ! Notes
+
  ! height
 
  |-
 
  |-
  |rowspan="4"| 0x0A
+
  | <code>minecraft:kebab</code>
  |rowspan="4"| Play
+
  | 0
  |rowspan="4"| Client
+
  | 0
  | Location
+
  | 0
  | Position
+
  | 16
  | Block coordinates
+
  | 16
 
  |-
 
  |-
  | Action ID (Byte 1)
+
  | <code>minecraft:aztec</code>
  | Unsigned Byte
+
| 1
  | Varies depending on block — see [[Block Actions]]
+
  | 16
 +
| 0
 +
| 16
 +
  | 16
 
  |-
 
  |-
  | Action Param (Byte 2)
+
  | <code>minecraft:alban</code>
  | Unsigned Byte
+
| 2
  | Varies depending on block — see [[Block Actions]]
+
  | 32
 +
| 0
 +
| 16
 +
  | 16
 
  |-
 
  |-
  | Block Type
+
  | <code>minecraft:aztec2</code>
  | VarInt
+
  | 3
  | The block type ID for the block, not including metadata/damage value.  This must match the block at the given coordinates.
+
  | 48
  |}
+
  | 0
 
+
  | 16
==== Block Change ====
+
  | 16
 
 
Fired whenever a block is changed within the render distance.
 
 
 
{{Warning2|Changing a block in a chunk that is not loaded is not a stable action.  The Notchian client currently uses a ''shared'' empty chunk which is modified for all block changes in unloaded chunks; while in 1.9 this chunk never renders in older versions the changed block will appear in all copies of the empty chunk. Servers should avoid sending block changes in unloaded chunks and clients should ignore such packets.}}
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x0B
+
  | <code>minecraft:bomb</code>
  |rowspan="2"| Play
+
  | 4
  |rowspan="2"| Client
+
  | 64
  | Location
+
  | 0
  | Position
+
  | 16
  | Block Coordinates
+
  | 16
 
  |-
 
  |-
  | Block ID
+
  | <code>minecraft:plant</code>
| VarInt
+
  | 5
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (When reading data: <code>type = id &gt;&gt; 4</code>, <code>meta = id & 15</code>, when writing data: <code>id = type &lt;&lt; 4 &#124; (meta &amp; 15)</code>)
+
| 80
  |}
+
  | 0
 
+
  | 16
==== Boss Bar ====
+
  | 16
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
  !colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="15"| 0x0C
+
  | <code>minecraft:wasteland</code>
  |rowspan="15"| Play
+
  | 6
  |rowspan="15"| Client
+
  | 96
  |colspan="2"| UUID
+
  | 0
  | UUID
+
  | 16
  | Unique ID for this bar
+
  | 16
 
  |-
 
  |-
  |colspan="2"| Action
+
  | <code>minecraft:pool</code>
  | VarInt Enum
+
| 7
  | Determines the layout of the remaining packet
+
| 0
 +
| 32
 +
  | 32
 +
  | 16
 
  |-
 
  |-
  ! Action
+
  | <code>minecraft:courbet</code>
  ! Field Name
+
  | 8
  !
+
  | 32
  !
+
  | 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  |rowspan="5"| 0: add
+
  | <code>minecraft:sea</code>
  | Title
+
| 9
  | [[Chat]]
+
| 64
  |  
+
  | 32
 +
  | 32
 +
  | 16
 
  |-
 
  |-
  | Health
+
  | <code>minecraft:sunset</code>
  | Float
+
| 10
  | 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.
+
| 96
 +
  | 32
 +
  | 32
 +
| 16
 
  |-
 
  |-
  | Color
+
  | <code>minecraft:creebet</code>
  | VarInt Enum
+
  | 11
  | Color ID (see below)
+
  | 128
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Division
+
  | <code>minecraft:wanderer</code>
  | VarInt Enum
+
  | 12
  | Type of division (see below)
+
  | 0
 +
| 64
 +
| 16
 +
| 32
 
  |-
 
  |-
  | Flags
+
  | <code>minecraft:graham</code>
  | Unsigned Byte
+
| 13
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music)
+
| 16
 +
| 64
 +
  | 16
 +
  | 32
 
  |-
 
  |-
  | 1: remove
+
  | <code>minecraft:match</code>
  | ''no fields''
+
  | 14
  | ''no fields''
+
  | 0
  | Removes this boss bar
+
  | 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | 2: update health
+
  | <code>minecraft:bust</code>
  | Health
+
  | 15
  | Float
+
  | 32
  | as above
+
  | 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | 3: update title
+
  | <code>minecraft:stage</code>
  | Title
+
  | 16
  | [[Chat]]
+
  | 64
  |  
+
  | 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  |rowspan="2"| 4: update style
+
  | <code>minecraft:void</code>
  | Color
+
| 17
  | VarInt Enum
+
| 96
  | Color ID (see below)
+
  | 128
 +
  | 32
 +
  | 32
 
  |-
 
  |-
  | Dividers
+
  | <code>skull_and_roses</code>
  | VarInt Enum
+
  | 18
  | as above
+
  | 128
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | 5: update flags
+
  | <code>minecraft:wither</code>
  | Flags
+
  | 19
  | Unsigned Byte
+
  | 160
  | as above
+
  | 128
  |-
+
  | 32
  |}
+
  | 32
 
 
{| class="wikitable"
 
! ID
 
! Color
 
 
  |-
 
  |-
 +
| <code>minecraft:fighters</code>
 +
| 20
 
  | 0
 
  | 0
  | Pink
+
  | 96
 +
| 64
 +
| 32
 
  |-
 
  |-
  | 1
+
  | <code>minecraft:pointer</code>
  | Blue
+
  | 21
 +
| 0
 +
| 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  | 2
+
  | <code>minecraft:pigscene</code>
  | Red
+
  | 22
 +
| 64
 +
| 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  | 3
+
  | <code>minecraft:burning_skull</code>
  | Green
+
  | 23
 +
| 128
 +
| 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  | 4
+
  | <code>minecraft:skeleton</code>
  | Yellow
+
  | 24
 +
| 192
 +
| 64
 +
| 64
 +
| 48
 
  |-
 
  |-
  | 5
+
  | <code>minecraft:donkey_kong</code>
  | Purple
+
  | 25
  |-
+
  | 192
  | 6
+
  | 112
  | White
+
  | 64
 +
| 48
 
  |}
 
  |}
 +
 +
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
 +
 +
==== Spawn Player ====
 +
 +
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
 +
 +
This packet must be sent after the [[#Player Info|Player Info]] packet that adds the player data for the client to use when spawning a player. If the Player Info for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player Info packet includes skin/cape data.
 +
 +
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! ID
+
  ! Packet ID
  ! Type of division
+
  ! 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
 
  |-
 
  |-
  | 0
+
  | X
  | No division
+
| Double
 +
  |  
 
  |-
 
  |-
  | 1
+
  | Y
  | 6 notches
+
| Double
 +
  |  
 
  |-
 
  |-
  | 2
+
  | Z
  | 10 notches
+
| Double
 +
  |  
 
  |-
 
  |-
  | 3
+
  | Yaw
  | 12 notches
+
| Angle
 +
  |  
 
  |-
 
  |-
  | 4
+
  | Pitch
  | 20 notches
+
| Angle
 +
  |  
 
  |}
 
  |}
  
==== Server Difficulty ====
+
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).
  
Changes the difficulty setting in the client's option menu
+
For NPCs UUID v2 should be used. Note:
  
{| class="wikitable"
+
  <+Grum> i will never confirm this as a feature you know that :)
  ! Packet ID
+
 
! State
+
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>.
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="1"| 0x0D
 
|rowspan="1"| Play
 
|rowspan="1"| Client
 
| Difficulty
 
| Unsigned Byte
 
| 0: peaceful, 1: easy, 2: normal, 3: hard
 
|}
 
  
==== Tab-Complete (clientbound) ====
+
==== Entity Animation (clientbound) ====
  
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported. The client lists these in the order that they are in the array.
+
Sent whenever an entity should change animation.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,016: Line 994:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0E
+
  |rowspan="2"| 0x06
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Count
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array
+
  | Player ID
 
  |-
 
  |-
  | Matches
+
  | Animation
  | Array of String
+
  | Unsigned Byte
  | One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
  | Animation ID (see below)
 
  |}
 
  |}
  
==== Chat Message (clientbound) ====
+
Animation can be one of the following values:
 
 
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options. While Position 2 accepts json formatting it will not display, old style formatting works
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Animation
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x0F
+
  | 0
|rowspan="2"| Play
+
  | Swing main arm
|rowspan="2"| Client
 
| JSON Data
 
| [[Chat]]
 
  | Limited to 32767 bytes
 
 
  |-
 
  |-
  | Position
+
  | 1
  | Byte
+
  | Take damage
  | 0: chat (chat box), 1: system message (chat box), 2: above hotbar
+
|-
 +
  | 2
 +
| Leave bed
 +
|-
 +
| 3
 +
| Swing offhand
 +
|-
 +
| 4
 +
| Critical effect
 +
|-
 +
| 5
 +
| Magic critical effect
 
  |}
 
  |}
  
==== Multi Block Change ====
+
==== Statistics ====
 
 
Fired whenever 2 or more blocks are changed within the same chunk on the same tick.
 
  
{{Warning|Changing blocks in chunks not loaded by the client is unsafe (see note on [[#Block Change|Block Change]]).}}
+
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1).
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
  ! Bound To
+
  ! Bound To  
 
  !colspan="2"| Field Name
 
  !colspan="2"| Field Name
 
  !colspan="2"| Field Type
 
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x10
+
  |rowspan="4"| 0x07
  |rowspan="6"| Play
+
  |rowspan="4"| Play
  |rowspan="6"| Client
+
  |rowspan="4"| Client
  |colspan="2"| Chunk X
+
  |colspan="2"| Count
|colspan="2"| Int
 
| Chunk X coordinate
 
|-
 
|colspan="2"| Chunk Z
 
|colspan="2"| Int
 
| Chunk Z coordinate
 
|-
 
|colspan="2"| Record Count
 
 
  |colspan="2"| VarInt
 
  |colspan="2"| VarInt
  | Number of elements in the following array, i.e. the number of blocks affected
+
  | Number of elements in the following array
 
  |-
 
  |-
  |rowspan="3"| Record
+
  |rowspan="3"| Statistic
  | Horizontal Position
+
  | Category ID
 
  |rowspan="3"| Array
 
  |rowspan="3"| Array
  | Unsigned Byte
+
  | VarInt
  | 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.
+
  | See below
 
  |-
 
  |-
  | Y Coordinate
+
  | Statistic ID
  | Unsigned Byte
+
  | VarInt
  | Y coordinate of the block
+
  | See below
 
  |-
 
  |-
  | Block ID
+
  | Value
 
  | VarInt
 
  | VarInt
  | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (When reading data: <code>type = id &gt;&gt; 4</code>, <code>meta = id & 15</code>, when writing data: <code>id = type &lt;&lt; 4 &#124; (meta &amp; 15)</code>)
+
  | The amount to set it to
 
  |}
 
  |}
  
To decode the position into a world position:
+
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 
 
<syntaxhighlight lang="java">
 
worldX = (horizPos >> 4 & 15) + (chunkX * 16);
 
worldY = vertPos;
 
worldZ = (horizPos & 15) + (chunkZ * 16);
 
</syntaxhighlight>
 
 
 
==== Confirm Transaction (clientbound) ====
 
 
 
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag).  If the packet was not accepted, the client must respond with a [[#Confirm Transaction (serverbound)|serverbound confirm transaction]] packet.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
! ID
  ! Bound To
+
  ! Registry
  ! Field Name
+
  |-
  ! Field Type
+
| <code>minecraft.mined</code>
  ! Notes
+
| 0
 +
| Blocks
 +
|-
 +
| <code>minecraft.crafted</code>
 +
| 1
 +
| Items
 +
|-
 +
| <code>minecraft.used</code>
 +
| 2
 +
| Items
 +
|-
 +
| <code>minecraft.broken</code>
 +
| 3
 +
| Items
 +
|-
 +
| <code>minecraft.picked_up</code>
 +
| 4
 +
| Items
 +
|-
 +
  | <code>minecraft.dropped</code>
 +
  | 5
 +
  | Items
 
  |-
 
  |-
  |rowspan="3"| 0x11
+
  | <code>minecraft.killed</code>
|rowspan="3"| Play
+
  | 6
|rowspan="3"| Client
+
  | Entities
| Window ID
 
  | Byte
 
  | The ID of the window that the action occurred in
 
 
  |-
 
  |-
  | Action Number
+
  | <code>minecraft.killed_by</code>
  | Short
+
  | 7
  | Every action that is to be accepted has a unique number. This field corresponds to that number.
+
  | Entities
 
  |-
 
  |-
  | Accepted
+
  | <code>minecraft.custom</code>
  | Boolean
+
  | 8
  | Whether the action was accepted
+
  | Custom
 
  |}
 
  |}
  
==== Close Window (clientbound) ====
+
Blocks, Items, and Entities use block (not block state), item, and entity ids.
  
This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open.
+
Custom has the following (unit only matters for clients):
 
 
Note, notchian clients send a close window packet with Window ID 0 to close their inventory even though there is never an [[#Open Window|Open Window]] packet for inventory.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
! ID
  ! Bound To
+
  ! Unit
  ! Field Name
+
  |-
  ! Field Type
+
  | <code>minecraft.leave_game</code>
  ! Notes
+
  | 0
 +
  | None
 
  |-
 
  |-
  | 0x12
+
  | <code>minecraft.play_one_minute</code>
| Play
+
  | 1
| Client
+
  | Time
| Window ID
 
  | Unsigned Byte
 
  | This is the ID of the window that was closed. 0 for inventory.
 
|}
 
 
 
==== Open Window ====
 
 
 
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x13
+
  | <code>minecraft.time_since_death</code>
|rowspan="5"| Play
+
  | 2
  |rowspan="5"| Client
+
  | Time
  | Window ID
 
| Unsigned Byte
 
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
 
  |-
 
  |-
  | Window Type
+
  | <code>minecraft.sneak_Time</code>
  | String
+
  | 3
  | The window type to use for display. See [[Inventory]] for a list.
+
  | Time
 
  |-
 
  |-
  | Window Title
+
  | <code>minecraft.walk_one_cm</code>
  | [[Chat]]
+
  | 4
  | The title of the window
+
  | Distance
 
  |-
 
  |-
  | Number Of Slots
+
  | <code>minecraft.crouch_one_cm</code>
  | Unsigned Byte
+
  | 5
  | Number of slots in the window (excluding the number of slots in the player inventory)
+
  | Distance
 
  |-
 
  |-
  | Entity ID
+
  | <code>minecraft.sprint_one_cm</code>
  | Optional Int
+
  | 6
  | EntityHorse's EID. Only sent when Window Type is “EntityHorse”
+
  | Distance
  |}
+
  |-
 
+
| <code>minecraft.swim_one_cm</code>
See [[Inventory]] for further information.
+
| 7
 
+
  | Distance
==== Window Items ====
 
[[File:Inventory-slots.png|thumb|The inventory slots]]
 
 
 
Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x14
+
  | <code>minecraft.fall_one_cm</code>
|rowspan="3"| Play
+
  | 8
  |rowspan="3"| Client
+
  | Distance
  | Window ID
 
| Unsigned Byte
 
| The ID of window which items are being sent for. 0 for player inventory.
 
 
  |-
 
  |-
  | Count
+
  | <code>minecraft.climb_one_cm</code>
  | Short
+
  | 9
  | Number of elements in the following array
+
  | Distance
 
  |-
 
  |-
  | Slot Data
+
  | <code>minecraft.fly_one_cm</code>
| Array of [[Slot Data|Slot]]
+
  | 10
  |  
+
  | Distance
  |}
 
 
 
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 
 
 
==== Window Property ====
 
 
 
This packet is used to inform the client that part of a GUI window should be updated.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x15
+
  | <code>minecraft.dive_one_cm</code>
|rowspan="3"| Play
+
  | 11
|rowspan="3"| Client
+
  | Distance
| Window ID
 
  | Unsigned Byte
 
  |  
 
 
  |-
 
  |-
  | Property
+
  | <code>minecraft.minecart_one_cm</code>
  | Short
+
  | 12
  | The property to be updated, see below
+
  | Distance
 
  |-
 
  |-
  | Value
+
  | <code>minecraft.boat_one_cm</code>
| Short
+
  | 13
  | The new value for the property, see below
+
  | Distance
  |}
 
 
 
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Window type
+
  | <code>minecraft.pig_one_cm</code>
  ! Property
+
  | 14
  ! Value
+
  | Distance
 
  |-
 
  |-
  |rowspan="4"| Furnace
+
  | <code>minecraft.horse_one_cm</code>
  | 0: Fire icon (fuel left)
+
  | 15
  | counting from fuel burn time down to 0 (in-game ticks)
+
  | Distance
 
  |-
 
  |-
  | 1: Maximum fuel burn time
+
  | <code>minecraft.aviate_one_cm</code>
  | fuel burn time or 0 (in-game ticks)
+
  | 16
 +
| Distance
 
  |-
 
  |-
  | 2: Progress arrow
+
  | <code>minecraft.jump</code>
  | counting from 0 to maximum progress (in-game ticks)
+
  | 17
 +
| None
 
  |-
 
  |-
  | 3: Maximum progress
+
  | <code>minecraft.drop</code>
  | always 200 on the notchian server
+
  | 18
 +
| None
 
  |-
 
  |-
  |rowspan="10"| Enchantment Table
+
  | <code>minecraft.damage_dealt</code>
  | 0: Level requirement for top enchantment slot
+
  | 19
  |rowspan="3"| The enchantment's xp level requirement
+
  | Damage
 
  |-
 
  |-
  | 1: Level requirement for middle enchantment slot
+
  | <code>minecraft.damage_taken</code>
 +
| 20
 +
| Damage
 
  |-
 
  |-
  | 2: Level requirement for bottom enchantment slot
+
  | <code>minecraft.deaths</code>
 +
| 21
 +
| None
 
  |-
 
  |-
  | 3: The enchantment seed
+
  | <code>minecraft.mob_kills</code>
| Used for drawing the enchantment names (in [[Wikipedia:Standard Galactic Alphabet|SGA]]) clientside.  The same seed ''is'' used to calculate enchantments, but some of the data isn't sent to the client to prevent easily guessing the entire list (the seed value here is the regular seed bitwise and <code>0xFFFFFFF0</code>).
+
| 22
 +
| None
 
  |-
 
  |-
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
+
  | <code>minecraft.animals_bred</code>
  |rowspan="3"| The enchantment id (set to -1 to hide it)
+
  | 23
 +
| None
 
  |-
 
  |-
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
+
  | <code>minecraft.player_kills</code>
 +
| 24
 +
| None
 
  |-
 
  |-
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
+
  | <code>minecraft.fish_caught</code>
 +
| 25
 +
| None
 
  |-
 
  |-
  | 7: Enchantment level shown on mouse hover over the top slot
+
  | <code>minecraft.talked_to_villager</code>
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
+
  | 26
 +
| None
 
  |-
 
  |-
  | 8: Enchantment level shown on mouse hover over the middle slot
+
  | <code>minecraft.traded_with_villager</code>
 +
| 27
 +
| None
 
  |-
 
  |-
  | 9: Enchantment level shown on mouse hover over the bottom slot
+
  | <code>minecraft.eat_cake_slice</code>
 +
| 28
 +
| None
 
  |-
 
  |-
  |rowspan="3"| Beacon
+
  | <code>minecraft.fill_cauldron</code>
  | 0: Power level
+
  | 29
  | 0-4, controls what effect buttons are enabled
+
  | None
 
  |-
 
  |-
  | 1: First potion effect
+
  | <code>minecraft.use_cauldron</code>
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
+
  | 30
 +
| None
 
  |-
 
  |-
  | 2: Second potion effect
+
  | <code>minecraft.clean_armor</code>
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
+
  | 31
 +
| None
 
  |-
 
  |-
  | Anvil
+
  | <code>minecraft.clean_banner</code>
  | 0: Repair cost
+
  | 32
  | The repair's cost in xp levels
+
  | None
 
  |-
 
  |-
  | Brewing Stand
+
  | <code>minecraft.interact_with_brewingstand</code>
  | 0: Brew time
+
  | 33
  | 0–400, with 400 making the arrow empty, and 0 making the arrow full
+
  | None
|}
 
 
 
==== Set Slot ====
 
 
 
Sent by the server when an item in a slot (in a window) is added/removed.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x16
+
  | <code>minecraft.interact_with_beacon</code>
|rowspan="3"| Play
+
  | 34
|rowspan="3"| Client
+
  | None
  | Window ID
 
  | Byte
 
| The window which is being updated. 0 for player inventory. Note that all known window types include the player inventory. This packet will only be sent for the currently opened window while the player is performing actions, even if it affects the player inventory. After the window is closed, a number of these packets are sent to update the player's inventory window (0).
 
 
  |-
 
  |-
  | Slot
+
  | <code>minecraft.inspect_dropper</code>
  | Short
+
  | 35
  | The slot that should be updated
+
  | 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
 
  |-
 
  |-
  | Slot Data
+
  | <code>minecraft.open_shulker_box</code>
  | [[Slot Data|Slot]]
+
  | 49
  |  
+
  | None
 
  |}
 
  |}
  
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
+
Units:
 
 
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 ====
+
* 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
  
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.
+
==== Acknowledge Player Digging ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,360: Line 1,336:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x17
+
  |rowspan="4"| 0x08
  |rowspan="2"| Play
+
  |rowspan="4"| Play
  |rowspan="2"| Client
+
  |rowspan="4"| Client
  | Item ID
+
  | Location
 +
| Position
 +
| Position where the digging was happening
 +
|-
 +
| Block
 
  | VarInt
 
  | VarInt
  | Numeric ID of the item to apply a cooldown to.
+
  | 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.
 
  |-
 
  |-
  | Cooldown Ticks
+
  | Successful
  | VarInt
+
  | Boolean
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
+
  | True if the digging succeeded; false if the client should undo any changes it made locally. (How does this work?)
 
  |}
 
  |}
  
==== Plugin Message (clientbound) ====
+
==== Block Break Animation ====
  
{{Main|Plugin channels}}
+
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
  
Mods and plugins can use this to send their data. Minecraft itself uses a number of [[plugin channel]]s. These internal channels are prefixed with <code>MC|</code>.
+
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)
  
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/]
+
If you need to display several break animations at the same time you have to give each of them a unique Entity ID. The entity ID does not need to correspond to an actual entity on the client. It is valid to use a randomly generated number.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,388: Line 1,372:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x18
+
  |rowspan="3"| 0x09
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Channel
+
  | Entity ID
  | String
+
  | VarInt
  | Name of the [[plugin channel]] used to send the data
+
  | Entity ID of the entity breaking the block
 +
|-
 +
| Location
 +
| Position
 +
| Block Position
 
  |-
 
  |-
  | Data
+
  | Destroy Stage
  | Byte Array
+
  | Byte
  | Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].  The length of this array must be inferred from the packet length.
+
  | 0–9 to set it, any other value to remove it
 
  |}
 
  |}
  
==== Named Sound Effect ====
+
==== Block Entity Data ====
{{See also|#Sound Effect}}
 
  
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
+
Sets the block entity associated with the block at the given location.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,413: Line 1,400:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x19
+
  |rowspan="3"| 0x0A
  |rowspan="7"| Play
+
  |rowspan="3"| Play
  |rowspan="7"| Client
+
  |rowspan="3"| Client
  | Sound Name
+
  | Location
  | String
+
  | Position
  | All sound effect names as of 1.10.0 can be seen [http://pokechu22.github.io/Burger/1.10.html#sounds here].
+
  |  
 
  |-
 
  |-
  | Sound Category
+
  | Action
  | VarInt Enum
+
  | Unsigned Byte
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
+
  | The type of update to perform, see below
 
  |-
 
  |-
  | Effect Position X
+
  | NBT Data
| Int
+
  | [[NBT|NBT Tag]]
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
+
  | 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)
  |-
 
  | 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) ====
+
''Action'' field:
 +
 
 +
* '''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.
  
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.
+
{{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"
Line 1,457: Line 1,449:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x1A
+
  |rowspan="4"| 0x0B
  | Play
+
  |rowspan="4"| Play
  | Client
+
  |rowspan="4"| Client
  | Reason
+
  | Location
  | [[Chat]]
+
| Position
  | Displayed to the client when the connection terminates.
+
| Block coordinates
 +
  |-
 +
| Action ID (Byte 1)
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]]
 +
  |-
 +
| Action Param (Byte 2)
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]]
 +
|-
 +
| Block Type
 +
| VarInt
 +
| The block type ID for the block.  This must match the block at the given coordinates.
 
  |}
 
  |}
  
==== Entity Status ====
+
==== Block Change ====
 +
 
 +
Fired whenever a block is changed within the render distance.
  
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).
+
{{Warning2|Changing a block in a chunk that is not loaded is not a stable action.  The Notchian client currently uses a ''shared'' empty chunk which is modified for all block changes in unloaded chunks; while in 1.9 this chunk never renders in older versions the changed block will appear in all copies of the empty chunk.  Servers should avoid sending block changes in unloaded chunks and clients should ignore such packets.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,477: Line 1,483:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1B
+
  |rowspan="2"| 0x0C
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Entity ID
+
  | Location
  | Int
+
  | Position
  |  
+
  | Block Coordinates
 
  |-
 
  |-
  | Entity Status
+
  | Block ID
  | Byte Enum
+
  | VarInt
  | See below
+
  | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
 
  |}
 
  |}
  
See [[entities]] for a list of which statuses are valid for each type of entity.
+
==== Boss Bar ====  
 
 
==== Explosion ====
 
 
 
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
 
 
 
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,501: Line 1,501:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x1C
+
  |rowspan="14"| 0x0D
  |rowspan="9"| Play
+
  |rowspan="14"| Play
  |rowspan="9"| Client
+
  |rowspan="14"| Client
  | X
+
  |colspan="2"| UUID
  | Float
+
  | UUID
  |  
+
  | Unique ID for this bar
 
  |-
 
  |-
  | Y
+
  |colspan="2"| Action
  | Float
+
| VarInt Enum
 +
| Determines the layout of the remaining packet
 +
|-
 +
! Action
 +
! Field Name
 +
!
 +
!
 +
|-
 +
|rowspan="5"| 0: add
 +
| Title
 +
  | [[Chat]]
 
  |  
 
  |  
 
  |-
 
  |-
  | Z
+
  | Health
 
  | Float
 
  | 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.
 
  |-
 
  |-
  | Radius
+
  | Color
  | Float
+
  | VarInt Enum
  | Currently unused in the client
+
  | Color ID (see below)
 
  |-
 
  |-
  | Record Count
+
  | Division
  | Int
+
  | VarInt Enum
  | Number of elements in the following array
+
  | Type of division (see below)
 
  |-
 
  |-
  | Records
+
  | Flags
  | Array of (Byte, Byte, Byte)
+
  | Unsigned Byte
  | Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
+
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02)
 
  |-
 
  |-
  | Player Motion X
+
  | 1: remove
  | Float
+
  | ''no fields''
  | X velocity of the player being pushed by the explosion
+
  | ''no fields''
 +
| Removes this boss bar
 
  |-
 
  |-
  | Player Motion Y
+
  | 2: update health
 +
| Health
 
  | Float
 
  | Float
  | Y velocity of the player being pushed by the explosion
+
  | as above
 
  |-
 
  |-
  | Player Motion Z
+
  | 3: update title
  | Float
+
  | Title
  | Z velocity of the player being pushed by the explosion
+
  | [[Chat]]
  |}
+
  |  
 
+
|-
==== Unload Chunk ====
+
|rowspan="2"| 4: update style
 
+
  | Color
Tells the client to unload a chunk column.
+
  | VarInt Enum
 
+
  | Color ID (see below)
{| class="wikitable"
+
  |-
  ! Packet ID
+
| Dividers
  ! State
+
  | VarInt Enum
  ! Bound To
+
  | as above
  ! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x1D
+
  | 5: update flags
|rowspan="2"| Play
+
  | Flags
|rowspan="2"| Client
+
  | Unsigned Byte
  | Chunk X
+
  | as above
  | Int
 
  | Block coordinate divided by 16, rounded down
 
 
  |-
 
  |-
| Chunk Z
 
| Int
 
| Block coordinate divided by 16, rounded down
 
 
  |}
 
  |}
 
==== Change Game State ====
 
 
Used for a wide variety of game state things, from weather to bed use to game mode to demo messages.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Color
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
|rowspan="2"| 0x1E
+
  | 0
|rowspan="2"| Play
+
  | Pink
|rowspan="2"| Client
 
| Reason
 
| Unsigned Byte
 
| See below
 
|-
 
| Value
 
| Float
 
| Depends on Reason
 
|}
 
 
 
''Reason codes'':
 
 
 
{| class="wikitable"
 
! Reason
 
! Effect
 
! Value
 
|-
 
  | 0
 
  | Invalid Bed
 
| Would be used to switch between messages, but the only used message is 0 for invalid bed
 
 
  |-
 
  |-
 
  | 1
 
  | 1
  | End raining
+
  | Blue
|
 
 
  |-
 
  |-
 
  | 2
 
  | 2
  | Begin raining
+
  | Red
|
 
 
  |-
 
  |-
 
  | 3
 
  | 3
  | Change game mode
+
  | Green
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 
 
  |-
 
  |-
 
  | 4
 
  | 4
  | Exit end
+
  | Yellow
| 0: Immediately send Client Status of respawn without showing end credits; 1: Show end credits and respawn at the end (or when esc is pressed).  1 is sent if the player has not yet received the "The end?" achievement, while if they do have it 0 is used.
 
 
  |-
 
  |-
 
  | 5
 
  | 5
  | Demo message
+
  | Purple
| 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
+
  |-
  |-  
 
 
  | 6
 
  | 6
  | Arrow hitting player
+
  | White
  | Appears to be played when an arrow strikes another player in Multiplayer
+
  |}
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Type of division
 +
|-
 +
| 0
 +
| No division
 
  |-
 
  |-
  | 7
+
  | 1
  | Fade value
+
  | 6 notches
| The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
 
 
  |-
 
  |-
  | 8
+
  | 2
  | Fade time
+
  | 10 notches
| Time in ticks for the sky to fade
 
 
  |-
 
  |-
  | 10
+
  | 3
  | Play elder guardian mob appearance (effect and sound)
+
  | 12 notches
  |  
+
  |-
 +
| 4
 +
| 20 notches
 
  |}
 
  |}
  
==== Keep Alive (clientbound) ====
+
==== Server Difficulty ====
  
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
+
Changes the difficulty setting in the client's option menu
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,653: Line 1,631:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x1F
+
  |rowspan="2"| 0x0E
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Keep Alive ID
+
  | Difficulty
  | VarInt
+
| Unsigned Byte
  |  
+
| 0: peaceful, 1: easy, 2: normal, 3: hard
 +
|-
 +
| Difficulty locked?
 +
  | Boolean
 +
  |
 
  |}
 
  |}
  
==== Chunk Data ====
+
==== Chat Message (clientbound) ====  
{{See also|#Unload Chunk}}
+
 
 +
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.
  
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).
+
{{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"
Line 1,674: Line 1,657:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x20
+
  |rowspan="2"| 0x0F
  |rowspan="9"| Play
+
  |rowspan="2"| Play
  |rowspan="9"| Client
+
  |rowspan="2"| Client
  | Chunk X
+
  | JSON Data
  | Int
+
  | [[Chat]]
  | Block coordinate divided by 16, rounded down
+
  | Limited to 32767 bytes
 
  |-
 
  |-
  | Chunk Z
+
  | Position
  | Int
+
  | Byte
  | Block coordinate divided by 16, rounded down
+
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
|-
+
  |}
| Ground-Up Continuous
+
 
| Boolean
+
==== Multi Block Change ====
| This is true if the packet represents all chunk sections in this vertical chunk column, where the Primary Bit Mask specifies exactly which chunk sections are included, and which are air.
 
  |-
 
| Primary Bit Mask
 
| VarInt
 
| Bitmask with bits set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
 
|-
 
| Size
 
| VarInt
 
| Size of Data in bytes, plus size of Biomes in bytes if present
 
|-
 
| Data
 
| Array of [[SMP Map Format|Chunk Section]]
 
| The length of the array is equal to the number of bits set in Primary Bit Mask. Chunks are sent bottom-to-top, i.e. the first chunk, if sent, extends from Y=0 to Y=15.
 
|-
 
| Biomes
 
| Optional Byte Array
 
| Only if Ground-Up Continuous: biome array, byte per XZ coordinate, 256 bytes total.
 
|-
 
| Number of block entities
 
| VarInt
 
| Length of the following array
 
|-
 
| Block entities
 
| Array of [[NBT|NBT Tag]]
 
| All block entities in the chunk.  Use the x, y, and z tags in the NBT to determine their positions.
 
|}
 
  
==== Effect ====
+
Fired whenever 2 or more blocks are changed within the same chunk on the same tick.
  
Sent when a client is to play a sound or particle effect.
+
{{Warning|Changing blocks in chunks not loaded by the client is unsafe (see note on [[#Block Change|Block Change]]).}}
 
 
By default, the Minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1023 (wither spawn) and effect 1028 (enderdragon death); it is ignored on other effects.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,724: Line 1,679:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x21
+
  |rowspan="6"| 0x10
  |rowspan="4"| Play
+
  |rowspan="6"| Play
  |rowspan="4"| Client
+
  |rowspan="6"| Client
  | Effect ID
+
  |colspan="2"| Chunk X
  | Int
+
  |colspan="2"| Int
  | The ID of the effect, see below
+
  | Chunk X coordinate
 
  |-
 
  |-
  | Location
+
  |colspan="2"| Chunk Z
  | Position
+
|colspan="2"| Int
  | The location of the effect
+
| 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.
 
  |-
 
  |-
  | Data
+
  | Y Coordinate
  | Int
+
  | Unsigned Byte
  | Extra data for certain effects, see below
+
  | Y coordinate of the block
 
  |-
 
  |-
  | Disable Relative Volume
+
  | Block ID
  | Boolean
+
  | VarInt
  | See above
+
  | 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.
 
  |}
 
  |}
  
Effect IDs:
+
To decode the position into a world position:
 +
 
 +
<syntaxhighlight lang="java">
 +
worldX = (horizPos >> 4 & 15) + (chunkX * 16);
 +
worldY = vertPos;
 +
worldZ = (horizPos & 15) + (chunkZ * 16);
 +
</syntaxhighlight>
 +
 
 +
==== Tab-Complete (clientbound) ====
 +
 
 +
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported. The client sorts these alphabetically before listing them.
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! ID
+
  ! Packet ID
  ! Name
+
  ! State
  ! Data
+
! Bound To
 +
!colspan="2"| Field Name
 +
  !colspan="2"| Field Type
 +
! Notes
 +
|-
 +
|rowspan="8"| 0x11
 +
|rowspan="8"| Play
 +
|rowspan="8"| Client
 
  |-
 
  |-
  !colspan="3"| Sound
+
  |colspan="2"| ID
 +
|colspan="2"| VarInt
 +
| Transaction ID
 
  |-
 
  |-
  | 1000
+
  |colspan="2"| Start
  | Dispenser dispenses
+
|colspan="2"| VarInt
  |  
+
| Start of the text to replace
 +
|-
 +
|colspan="2"| Length
 +
  |colspan="2"| VarInt
 +
  | Length of the text to replace
 
  |-
 
  |-
  | 1001
+
  |colspan="2"| Count
  | Dispenser fails to dispense
+
  |colspan="2"| VarInt
  |  
+
  | Number of elements in the following array
 
  |-
 
  |-
  | 1002
+
  |rowspan="3"| Matches
  | Dispenser shoots
+
  | 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.
 
  |-
 
  |-
  | 1003
+
  | Has tooltip
  | Ender eye launched
+
  | Boolean
  |  
+
  | True if the following is present
 
  |-
 
  |-
  | 1004
+
  | Tooltip
  | Firework shot
+
  | Optional [[Chat]]
  |  
+
  | Tooltip to display; only present if previous boolean is true
 +
|}
 +
 
 +
==== Declare Commands ====
 +
 
 +
Lists all of the commands on the server, and how they are parsed.
 +
 
 +
This is a directed graph, with one root node.  Each redirect or child node must refer only to nodes that have already been declared.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1005
+
  |rowspan="3"| 0x12
  | Iron door opened
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Count
 +
  | VarInt
 +
  | Number of elements in the following array
 
  |-
 
  |-
  | 1006
+
  | Nodes
  | Wooden door opened
+
  | Array of [[Command Data|Node]]
  |  
+
  | An array of nodes
 
  |-
 
  |-
  | 1007
+
  | Root index
  | Wooden trapdoor opened
+
  | VarInt
  |  
+
  | Index of the <code>root</code> node in the previous array
 +
|}
 +
 
 +
For more information on this packet, see the [[Command Data]] article.
 +
 
 +
==== Window Confirmation (clientbound) ====
 +
 
 +
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag).  If the packet was not accepted, the client must respond with a [[#Window Confirmation (serverbound)|serverbound window confirmation]] packet.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1008
+
  |rowspan="3"| 0x13
  | Fence gate opened
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Window ID
 +
  | Byte
 +
  | The ID of the window that the action occurred in
 
  |-
 
  |-
  | 1009
+
  | Action Number
  | Fire extinguished
+
  | 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.
 
  |-
 
  |-
  | 1010
+
  | Accepted
  | Play record
+
  | Boolean
  | {{Minecraft Wiki|Music Discs|Record ID}}
+
  | Whether the action was accepted
 +
|}
 +
 
 +
==== Close Window (clientbound) ====
 +
 
 +
This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1011
+
  | 0x14
  | Iron door closed
+
  | Play
  |  
+
| Client
 +
| Window ID
 +
| Unsigned Byte
 +
| This is the ID of the window that was closed. 0 for inventory.
 +
  |}
 +
 
 +
==== Window Items ====
 +
[[File:Inventory-slots.png|thumb|The inventory slots]]
 +
 
 +
Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1012
+
  |rowspan="3"| 0x15
  | Wooden door closed
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Window ID
 +
  | Unsigned Byte
 +
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  | 1013
+
  | Count
  | Wooden trapdoor closed
+
  | Short
  |  
+
  | Number of elements in the following array
 
  |-
 
  |-
  | 1014
+
  | Slot Data
  | Fence gate closed
+
  | Array of [[Slot Data|Slot]]
|
 
|-
 
| 1015
 
| Ghast warns
 
 
  |  
 
  |  
 +
|}
 +
 +
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 +
 +
==== Window Property ====
 +
 +
This packet is used to inform the client that part of a GUI window should be updated.
 +
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1016
+
  |rowspan="3"| 0x16
  | Ghast shoots
+
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Window ID
 +
  | Unsigned Byte
 
  |  
 
  |  
 
  |-
 
  |-
  | 1017
+
  | Property
  | Enderdragon shoots
+
  | Short
  |  
+
  | The property to be updated, see below
 
  |-
 
  |-
  | 1018
+
  | Value
  | Blaze shoots
+
  | Short
  |  
+
  | The new value for the property, see below
 +
|}
 +
 
 +
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  | 1019
+
  ! Window type
  | Zombie attacks wood door
+
  ! Property
  |
+
  ! Value
 
  |-
 
  |-
  | 1020
+
  |rowspan="4"| Furnace
  | Zombie attacks iron door
+
  | 0: Fire icon (fuel left)
  |  
+
  | counting from fuel burn time down to 0 (in-game ticks)
 
  |-
 
  |-
  | 1021
+
  | 1: Maximum fuel burn time
| Zombie breaks wood door
+
  | fuel burn time or 0 (in-game ticks)
  |
 
 
  |-
 
  |-
  | 1022
+
  | 2: Progress arrow
| Wither breaks block
+
  | counting from 0 to maximum progress (in-game ticks)
  |
 
 
  |-
 
  |-
  | 1023
+
  | 3: Maximum progress
| Wither spawned
+
  | always 200 on the notchian server
  |  
 
 
  |-
 
  |-
  | 1024
+
  |rowspan="10"| Enchantment Table
  | Wither shoots
+
  | 0: Level requirement for top enchantment slot
  |
+
  |rowspan="3"| The enchantment's xp level requirement
 
  |-
 
  |-
  | 1025
+
  | 1: Level requirement for middle enchantment slot
| Bat takes off
 
|
 
 
  |-
 
  |-
  | 1026
+
  | 2: Level requirement for bottom enchantment slot
| Zombie infects
 
|
 
 
  |-
 
  |-
  | 1027
+
  | 3: The enchantment seed
  | Zombie villager converted
+
  | Used for drawing the enchantment names (in [[Wikipedia:Standard Galactic Alphabet|SGA]]) clientside. The same seed ''is'' used to calculate enchantments, but some of the data isn't sent to the client to prevent easily guessing the entire list (the seed value here is the regular seed bitwise and <code>0xFFFFFFF0</code>).
  |
 
 
  |-
 
  |-
  | 1028
+
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
  | Ender dragon death
+
  |rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
|
 
 
  |-
 
  |-
  | 1029
+
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
| Anvil destroyed
 
|
 
 
  |-
 
  |-
  | 1030
+
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
| Anvil used
 
|
 
 
  |-
 
  |-
  | 1031
+
  | 7: Enchantment level shown on mouse hover over the top slot
  | Anvil landed
+
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
|
 
 
  |-
 
  |-
  | 1032
+
  | 8: Enchantment level shown on mouse hover over the middle slot
| Portal travel
 
|
 
 
  |-
 
  |-
  | 1033
+
  | 9: Enchantment level shown on mouse hover over the bottom slot
| Chorus flower grown
 
|
 
 
  |-
 
  |-
  | 1034
+
  |rowspan="3"| Beacon
  | Chorus flower died
+
  | 0: Power level
  |  
+
  | 0-4, controls what effect buttons are enabled
 
  |-
 
  |-
  | 1035
+
  | 1: First potion effect
  | Brewing stand brewed
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
|
 
 
  |-
 
  |-
  | 1036
+
  | 2: Second potion effect
  | Iron trapdoor opened
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
|  
 
 
  |-
 
  |-
  | 1037
+
  | Anvil
  | Iron trapdoor closed
+
  | 0: Repair cost
  |
+
  | The repair's cost in xp levels
 
  |-
 
  |-
  !colspan="3"| Particle
+
  |rowspan="2"| Brewing Stand
 +
| 0: Brew time
 +
| 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
  |-
 
  |-
  | 2000
+
  | 1: Fuel time
  | Spawns 10 smoke particles, e.g. from a fire
+
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
| Direction, see below
 
 
  |-
 
  |-
  | 2001
+
  | Stonecutter
  | Block break + block break sound
+
  | 0: Selected recipe
  | {{Minecraft Wiki|Data values|Block ID}}
+
  | The index of the selected recipe. -1 means none is selected.
 
  |-
 
  |-
  | 2002
+
  | Loom
  | Splash potion. Particle effect + glass break sound.
+
  | 0: Selected pattern
  | [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
+
| The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern.
 +
  |}
 +
 
 +
For an enchanting table, the following numerical IDs are used:
 +
 
 +
{| class="wikitable"
 +
! Numerical ID
 +
! Enchantment ID
 +
! Enchantment Name
 
  |-
 
  |-
  | 2003
+
  | 0
| Eye of Ender entity break animation — particles and sound
+
  | minecraft:protection
|
+
  | Protection
|-
 
| 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
 
|
 
|-
 
| 3000
 
| End gateway spawn
 
|
 
|-
 
| 3001
 
| Enderdragon growl
 
|
 
|}
 
 
 
Smoke directions:
 
 
 
{| class="wikitable"
 
! ID
 
! Direction
 
|-
 
| 0
 
  | South-East
 
 
  |-
 
  |-
 
  | 1
 
  | 1
  | South
+
  | minecraft:fire_protection
 +
| Fire Protection
 
  |-
 
  |-
 
  | 2
 
  | 2
  | South-West
+
  | minecraft:feather_falling
 +
| Feather Falling
 
  |-
 
  |-
 
  | 3
 
  | 3
  | East
+
  | minecraft:blast_protection
 +
| Blast Protection
 
  |-
 
  |-
 
  | 4
 
  | 4
  | (Up or middle ?)
+
  | minecraft:projectile_protection
 +
| Projectile Protection
 
  |-
 
  |-
 
  | 5
 
  | 5
  | West
+
  | minecraft:respiration
 +
| Respiration
 
  |-
 
  |-
 
  | 6
 
  | 6
  | North-East
+
  | minecraft:aqua_affinity
 +
| Aqua Affinity
 
  |-
 
  |-
 
  | 7
 
  | 7
  | North
+
  | minecraft:thorns
 +
| Thorns
 
  |-
 
  |-
 
  | 8
 
  | 8
  | North-West
+
  | minecraft:depth_strider
  |}
+
| Depth Strider
 
+
|-
==== Particle ====
+
  | 9
 
+
| minecraft:frost_walker
Displays the named particle
+
| Frost Walker
 
+
|-
{| class="wikitable"
+
| 10
  ! Packet ID
+
| minecraft:binding_curse
  ! State
+
| Curse of Binding
  ! Bound To
+
|-
  ! Field Name
+
| 11
  ! Field Type
+
  | minecraft:sharpness
  ! Notes
+
  | Sharpness
 +
  |-
 +
  | 12
 +
  | minecraft:smite
 +
  | Smite
 
  |-
 
  |-
  |rowspan="11"| 0x22
+
  | 13
|rowspan="11"| Play
+
  | minecraft:bane_of_arthropods
|rowspan="11"| Client
+
  | Bane of Arthropods
| Particle ID
 
  | Int
 
  | See below
 
 
  |-
 
  |-
  | Long Distance
+
  | 14
  | Boolean
+
  | minecraft:knockback
  | If true, particle distance increases from 256 to 65536
+
  | Knockback
 
  |-
 
  |-
  | X
+
  | 15
  | Float
+
  | minecraft:fire_aspect
  | X position of the particle
+
  | Fire Aspect
 
  |-
 
  |-
  | Y
+
  | 16
  | Float
+
  | minecraft:looting
  | Y position of the particle
+
  | Looting
 
  |-
 
  |-
  | Z
+
  | 17
  | Float
+
  | minecraft:sweeping
  | Z position of the particle
+
  | Sweeping Edge
 
  |-
 
  |-
  | Offset X
+
  | 18
  | Float
+
  | minecraft:efficiency
  | This is added to the X position after being multiplied by random.nextGaussian()
+
  | Efficiency
 
  |-
 
  |-
  | Offset Y
+
  | 19
  | Float
+
  | minecraft:silk_touch
  | This is added to the Y position after being multiplied by random.nextGaussian()
+
  | Silk Touch
 
  |-
 
  |-
  | Offset Z
+
  | 20
  | Float
+
  | minecraft:unbreaking
  | This is added to the Z position after being multiplied by random.nextGaussian()
+
  | Unbreaking
 
  |-
 
  |-
  | Particle Data
+
  | 21
  | Float
+
  | minecraft:fortune
  | The data of each particle
+
  | Fortune
 
  |-
 
  |-
  | Particle Count
+
  | 22
  | Int
+
  | minecraft:power
  | The number of particles to create
+
  | Power
 
  |-
 
  |-
  | Data
+
  | 23
  | Array of VarInt
+
  | minecraft:punch
  | Length depends on particle. "iconcrack" has length of 2, "blockcrack", and "blockdust" have lengths of 1, the rest have 0.
+
  | Punch
|}
 
 
 
Particle IDs:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Particle Name
+
  | 24
  ! Particle ID
+
  | minecraft:flame
 +
| Flame
 
  |-
 
  |-
  | explode
+
  | 25
  | 0
+
  | minecraft:infinity
 +
| Infinity
 
  |-
 
  |-
  | largeexplosion
+
  | 26
  | 1
+
  | minecraft:luck_of_the_sea
 +
| Luck of the Sea
 
  |-
 
  |-
  | hugeexplosion
+
  | 27
  | 2
+
  | minecraft:lure
 +
| Lure
 
  |-
 
  |-
  | fireworksSpark
+
  | 28
  | 3
+
  | minecraft:loyalty
 +
| Loyalty
 
  |-
 
  |-
  | bubble
+
  | 29
  | 4
+
  | minecraft:impaling
 +
| Impaling
 
  |-
 
  |-
  | splash
+
  | 30
  | 5
+
  | minecraft:riptide
 +
| Riptide
 
  |-
 
  |-
  | wake
+
  | 31
  | 6
+
  | minecraft:channeling
 +
| Channeling
 
  |-
 
  |-
  | suspended
+
  | 32
  | 7
+
  | minecraft:mending
 +
| Mending
 
  |-
 
  |-
  | depthsuspend
+
  | 33
  | 8
+
  | minecraft:vanishing_curse
 +
| Curse of Vanishing
 +
|}
 +
 
 +
==== Set Slot ====
 +
 
 +
Sent by the server when an item in a slot (in a window) is added/removed.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | crit
+
  |rowspan="3"| 0x17
  | 9
+
|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).
 
  |-
 
  |-
  | magicCrit
+
  | Slot
  | 10
+
  | Short
 +
| The slot that should be updated
 
  |-
 
  |-
  | smoke
+
  | Slot Data
  | 11
+
  | [[Slot Data|Slot]]
 +
|
 +
|}
 +
 
 +
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
 +
 
 +
This packet can only be used to edit the hotbar of the player's inventory if window ID is set to 0 (slots 36 through 44).  If the window ID is set to -2, then any slot in the inventory can be used but no add item animation will be played.
 +
 
 +
==== Set Cooldown ====
 +
 
 +
Applies a cooldown period to all items with the given type.  Used by the Notchian server with enderpearls.  This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing).
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | largesmoke
+
  |rowspan="2"| 0x18
  | 12
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Item ID
 +
| VarInt
 +
  | Numeric ID of the item to apply a cooldown to.
 
  |-
 
  |-
  | spell
+
  | Cooldown Ticks
  | 13
+
  | VarInt
  |-
+
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
  | instantSpell
+
  |}
| 14
+
 
  |-
+
==== Plugin Message (clientbound) ====
  | mobSpell
+
 
  | 15
+
{{Main|Plugin channels}}
  |-
+
 
  | mobSpellAmbient
+
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.
  | 16
+
 
 +
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
 
  |-
 
  |-
  | witchMagic
+
  |rowspan="2"| 0x19
  | 17
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Channel
 +
| Identifier
 +
  | Name of the [[plugin channel]] used to send the data
 
  |-
 
  |-
  | dripWater
+
  | Data
  | 18
+
  | Byte Array
 +
| Any data, depending on the channel. <code>minecraft:</code> channels are documented [[plugin channel|here]].  The length of this array must be inferred from the packet length.
 +
|}
 +
 
 +
==== Named Sound Effect ====
 +
{{See also|#Sound Effect}}
 +
 
 +
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | dripLava
+
  |rowspan="7"| 0x1A
  | 19
+
|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].
 
  |-
 
  |-
  | angryVillager
+
  | Sound Category
  | 20
+
  | VarInt Enum
 +
| The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 
  |-
 
  |-
  | happyVillager
+
  | Effect Position X
  | 21
+
  | Int
 +
| Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | townaura
+
  | Effect Position Y
  | 22
+
  | Int
 +
| Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | note
+
  | Effect Position Z
  | 23
+
  | Int
 +
| Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | portal
+
  | Volume
  | 24
+
  | Float
 +
| 1 is 100%, can be more
 
  |-
 
  |-
  | enchantmenttable
+
  | Pitch
  | 25
+
  | 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | flame
+
  | 0x1B
  | 26
+
  | 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).
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | lava
+
  |rowspan="2"| 0x1C
  | 27
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| Int
 +
  |  
 
  |-
 
  |-
  | footstep
+
  | Entity Status
  | 28
+
  | 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
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | cloud
+
  |rowspan="9"| 0x1D
  | 29
+
|rowspan="9"| Play
 +
|rowspan="9"| Client
 +
| X
 +
| Float
 +
  |  
 
  |-
 
  |-
  | reddust
+
  | Y
  | 30
+
| Float
 +
  |  
 
  |-
 
  |-
  | snowballpoof
+
  | Z
  | 31
+
| Float
 +
  |  
 
  |-
 
  |-
  | snowshovel
+
  | Strength
  | 32
+
  | 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.
 
  |-
 
  |-
  | slime
+
  | Record Count
  | 33
+
  | Int
 +
| Number of elements in the following array
 
  |-
 
  |-
  | heart
+
  | Records
  | 34
+
  | Array of (Byte, Byte, Byte)
 +
| Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
 
  |-
 
  |-
  | barrier
+
  | Player Motion X
  | 35
+
  | Float
 +
| X velocity of the player being pushed by the explosion
 
  |-
 
  |-
  | iconcrack_(id)_(data)
+
  | Player Motion Y
  | 36
+
  | Float
 +
| Y velocity of the player being pushed by the explosion
 
  |-
 
  |-
  | blockcrack_(id+(data<<12))
+
  | Player Motion Z
  | 37
+
  | Float
  |-
+
  | Z velocity of the player being pushed by the explosion
| blockdust_(id)
 
| 38
 
|-
 
| droplet
 
| 39
 
|-
 
| take
 
| 40
 
|-
 
| mobappearance
 
| 41
 
|-
 
| dragonbreath
 
| 42
 
|-
 
| endrod
 
| 43
 
|-
 
| damageindicator
 
| 44
 
|-
 
| sweepattack
 
| 45
 
|-
 
| fallingdust
 
| 46
 
 
  |}
 
  |}
  
==== Join Game ====
+
==== Unload Chunk ====
  
See [[Protocol Encryption]] for information on logging in.
+
Tells the client to unload a chunk column.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,203: Line 2,368:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x23
+
  |rowspan="2"| 0x1E
  |rowspan="7"| Play
+
  |rowspan="2"| Play
  |rowspan="7"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Chunk X
 
  | Int
 
  | Int
  | The player's Entity ID (EID)
+
  | Block coordinate divided by 16, rounded down
 
  |-
 
  |-
  | Gamemode
+
  | Chunk Z
| Unsigned Byte
+
  | Int
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
+
  | Block coordinate divided by 16, rounded down
|-
 
| Dimension
 
  | Int Enum
 
| -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
 
|-
 
  | Difficulty
 
| Unsigned Byte
 
| 0: peaceful, 1: easy, 2: normal, 3: hard
 
|-
 
| Max Players
 
| Unsigned Byte
 
| Was once used by the client to draw the player list, but now is ignored
 
|-
 
| Level Type
 
| String
 
| default, flat, largeBiomes, amplified, default_1_1
 
|-
 
| Reduced Debug Info
 
| Boolean
 
| If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}.
 
 
  |}
 
  |}
  
==== Map ====
+
It is legal to send this packet even if the given chunk is not currently loaded.
 +
 
 +
==== Change Game State ====
  
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
+
Used for a wide variety of game state things, from whether to bed use to gamemode to demo messages.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,243: Line 2,390:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="13"| 0x24
+
  |rowspan="2"| 0x1F
  |rowspan="13"| Play
+
  |rowspan="2"| Play
  |rowspan="13"| Client
+
  |rowspan="2"| Client
  |colspan="2"| Item Damage
+
  | Reason
  |colspan="2"| VarInt
+
  | Unsigned Byte
  | The damage value (map ID) of the map being modified
+
  | See below
 
  |-
 
  |-
  |colspan="2"| Scale
+
  | Value
  |colspan="2"| Byte
+
  | Float
  | From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
+
  | Depends on Reason
  |-
+
  |}
|colspan="2"| Tracking Position
+
 
|colspan="2"| Boolean
+
''Reason codes'':
  | Specifies whether the icons are shown
+
 
  |-
+
{| class="wikitable"
  |colspan="2"| Icon Count
+
  ! Reason
|colspan="2"| VarInt
+
  ! Effect
| Number of elements in the following array
+
  ! Value
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  | 0
| Direction And Type
+
  | No respawn block available
|rowspan="3"| Array
+
  | Note: Sends message 'block.minecraft.spawn.not_valid'(You have no home bed or charged respawn anchor, or it was obstructed) to the client.
  | Byte
 
  | 0xF0 = Direction, 0x0F = Type
 
 
  |-
 
  |-
  | X
+
  | 1
  | Byte
+
  | End raining
 
  |  
 
  |  
 
  |-
 
  |-
  | Z
+
  | 2
  | Byte
+
  | 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
 
  |-  
 
  |-  
  |colspan="2"| Columns
+
  | 6
  |colspan="2"| Byte
+
  | Arrow hit player
  | Number of columns updated
+
  | Note: Sent when any player is struck by an arrow.
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | 7
  |colspan="2"| Optional Byte
+
  | Rain level change
  | Only if Columns is more than 0; number of rows updated
+
  | 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.
 
  |-
 
  |-
  |colspan="2"| X
+
  | 8
  |colspan="2"| Optional Byte
+
  | Thunder level change
  | Only if Columns is more than 0; x offset of the westernmost column
+
  | 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.
 
  |-
 
  |-
  |colspan="2"| Z
+
  | 9
|colspan="2"| Optional Byte
+
  | Play pufferfish sting sound
  | Only if Columns is more than 0; z offset of the northernmost row
 
 
  |-
 
  |-
  |colspan="2"| Length
+
  | 10
  |colspan="2"| Optional VarInt
+
  | Play elder guardian mob appearance (effect and sound)
  | Only if Columns is more than 0; length of the following array
+
  |  
 
  |-
 
  |-
  |colspan="2"| Data
+
  | 11
  |colspan="2"| Optional Array of Unsigned Byte
+
  | Enable respawn screen
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
+
  | 0: Enable respawn screen, 1: Immediately respawn (sent when the doImmediateRespawn gamerule changes)
  |}
+
  |}
  
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
+
==== Open Horse Window ====
  
Types are based off of rows and columns in <code>map_icons.png</code>:
+
This packet is used exclusively for opening the horse GUI.  [[#Open Window|Open Window]] is used for all other GUIs.
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Icon type
+
  |rowspan="3"| 0x20
  ! Result
+
  |rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Window ID?
 +
| Byte
 +
|
 
  |-
 
  |-
  | 0
+
  | Number of slots?
  | White arrow (players)
+
| VarInt
 +
  |
 
  |-
 
  |-
  | 1
+
  | Entity ID?
  | Green arrow (item frames)
+
  | Integer
  |-
+
  |
| 2
 
| Red arrow
 
|-
 
| 3
 
| Blue arrow
 
|-
 
| 4
 
| White cross
 
|-
 
| 5
 
| Red pointer
 
|-
 
| 6
 
| White circle (off-map players)
 
|-
 
| 7-15
 
| Unused (blue square)
 
 
  |}
 
  |}
  
==== Entity Relative Move ====
+
==== Keep Alive (clientbound) ====
  
This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Entity Teleport|Entity Teleport]] ([[#Play|Play]], 0x4A, clientbound) should be sent instead.
+
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.
  
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.
+
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,353: Line 2,503:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x25
+
  |rowspan="1"| 0x21
  |rowspan="5"| Play
+
  |rowspan="1"| Play
  |rowspan="5"| Client
+
  |rowspan="1"| Client
  | Entity ID
+
  | Keep Alive ID
  | VarInt
+
  | Long
|
 
|-
 
| 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 Look And Relative Move ====
+
==== Chunk Data ====
 +
{{Main|Chunk Format}}
 +
{{See also|#Unload Chunk}}
 +
 
 +
{{Need Info|How do biomes work now?  The biome change happened at the same time as the seed change, but it's not clear how/if biomes could be computed given that it's not the actual seed...  ([https://www.reddit.com/r/Mojira/comments/e5at6i/a_discussion_for_the_changes_to_how_biomes_are/ /r/mojira discussion] which notes that it seems to be some kind of interpolation, and 3D biomes are only used in the nether)}}
  
This packet is sent by the server when an entity rotates and moves. Since a short range is limited from -32768 to 32767, and movement is offset of fixed-point numbers, this packet allows at most 8 blocks movement in any direction. (<code>-32768 / (32 * 128) == -8</code>)
+
The 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"
Line 2,389: Line 2,527:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x26
+
  |rowspan="10"| 0x22
  |rowspan="7"| Play
+
  |rowspan="10"| Play
  |rowspan="7"| Client
+
  |rowspan="10"| Client
  | Entity ID
+
  | Chunk X
  | VarInt
+
  | Int
  |  
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
| Chunk Z
 +
| Int
 +
| Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | Delta X
+
  | Full chunk
  | Short
+
  | Boolean
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
  | See [[Chunk Format#Full chunk|Chunk Format]]
 
  |-
 
  |-
  | Delta Y
+
  | Primary Bit Mask
  | Short
+
  | VarInt
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
  | 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).
 
  |-
 
  |-
  | Delta Z
+
  | Heightmaps
  | Short
+
  | [[NBT]]
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
+
  | 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.
 
  |-
 
  |-
  | Yaw
+
  | Biomes
  | Angle
+
  | Optional array of Integer
  | New angle, not a delta
+
  | 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
 
  |-
 
  |-
  | Pitch
+
  | Number of block entities
  | Angle
+
  | VarInt
  | New angle, not a delta
+
  | Number of elements in the following array
 
  |-
 
  |-
  | On Ground
+
  | Block entities
  | Boolean
+
  | 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.
 
  |}
 
  |}
  
==== Entity Look ====
+
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.
  
This packet is sent by the server when an entity rotates.
+
By default, the Minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1023 (wither spawn), effect 1028 (enderdragon death), and effect 1038 (end portal opening); it is ignored on other effects.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,433: Line 2,586:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x27
+
  |rowspan="4"| 0x23
 
  |rowspan="4"| Play
 
  |rowspan="4"| Play
 
  |rowspan="4"| Client
 
  |rowspan="4"| Client
  | Entity ID
+
  | Effect ID
  | VarInt
+
  | Int
  |  
+
  | The ID of the effect, see below
 
  |-
 
  |-
  | Yaw
+
  | Location
  | Angle
+
  | Position
  | New angle, not a delta
+
  | The location of the effect
 
  |-
 
  |-
  | Pitch
+
  | Data
  | Angle
+
  | Int
  | New angle, not a delta
+
  | Extra data for certain effects, see below
 
  |-
 
  |-
  | On Ground
+
  | Disable Relative Volume
 
  | Boolean
 
  | Boolean
  |  
+
  | See above
 
  |}
 
  |}
  
==== Entity ====
+
Effect IDs:
 
 
This packet may be used to initialize an entity.
 
 
 
For player entities, either this packet or any move/look packet is sent every game tick. So the meaning of this packet is basically that the entity did not move/look since the last such packet.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Name
! Bound To
+
  ! Data
  ! Field Name
+
  |-
  ! Field Type
+
  !colspan="3"| Sound
  ! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x28
+
  | 1000
|rowspan="1"| Play
+
  | Dispenser dispenses
|rowspan="1"| Client
 
| Entity ID
 
  | VarInt
 
 
  |  
 
  |  
|}
 
 
==== Vehicle Move (clientbound) ====
 
 
Note that all fields use absolute positioning and do not allow for relative positioning.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x29
+
  | 1001
|rowspan="7"| Play
+
  | Dispenser fails to dispense
|rowspan="7"| Client
+
  |  
| X
 
  | Double
 
  | Absolute position (X coordinate)
 
 
  |-
 
  |-
  | Y
+
  | 1002
  | Double
+
  | Dispenser shoots
  | Absolute position (Y coordinate)
+
  |  
 
  |-
 
  |-
  | Z
+
  | 1003
  | Double
+
  | Ender eye launched
  | Absolute position (Z coordinate)
+
|
 +
|-
 +
| 1004
 +
| Firework shot
 +
  |  
 
  |-
 
  |-
  | Yaw
+
  | 1005
  | Float
+
  | Iron door opened
  | Absolute rotation on the vertical axis, in degrees
+
  |  
 
  |-
 
  |-
  | Pitch
+
  | 1006
  | Float
+
  | Wooden door opened
  | Absolute rotation on the horizontal axis, in degrees
+
  |  
|}
 
 
 
==== Open Sign Editor ====
 
 
 
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]].
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x2A
+
  | 1007
  |rowspan="1"| Play
+
| Wooden trapdoor opened
  |rowspan="1"| Client
+
  |  
  | Location
+
  |-
  | Position
+
  | 1008
 +
  | Fence gate opened
 
  |  
 
  |  
|}
 
 
==== Player Abilities (clientbound) ====
 
 
The latter 2 floats are used to indicate the field of view and flying speed respectively, while the first byte is used to determine the value of 4 booleans.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x2B
+
  | 1009
|rowspan="3"| Play
+
  | Fire extinguished
|rowspan="3"| Client
 
| Flags
 
| Byte
 
| Bit field, see below
 
|-
 
| Flying Speed
 
  | Float
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Field of View Modifier
+
  | 1010
  | Float
+
  | Play record
  | Modifies the field of view, like a speed potion. A Notchian server will use the same value as the movement speed (send in the [[Protocol#Entity_Properties|Entity Properties]] packet).
+
  | Special case, see below for more info
|}
 
 
 
About the flags:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Field
+
  | 1011
  ! Bit
+
  | Iron door closed
 +
|
 
  |-
 
  |-
  | Invulnerable
+
  | 1012
  | 0x01
+
| Wooden door closed
 +
  |  
 
  |-
 
  |-
  | Flying
+
  | 1013
  | 0x02
+
| Wooden trapdoor closed
 +
  |  
 
  |-
 
  |-
  | Allow Flying
+
  | 1014
  | 0x04
+
| Fence gate closed
 +
  |  
 
  |-
 
  |-
  | Creative Mode
+
  | 1015
  | 0x08
+
  | Ghast warns
  |}
+
  |  
 
 
==== Combat Event ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="8"| 0x2C
+
  | 1016
|rowspan="8"| Play
+
  | Ghast shoots
|rowspan="8"| Client
+
  |  
|colspan="2"| Event
 
  | VarInt Enum
 
  | Determines the layout of the remaining packet
 
 
  |-
 
  |-
! Event
+
  | 1017
! Field Name
+
  | Enderdragon shoots
!
 
!
 
|-
 
| 0: enter combat
 
  | ''no fields''
 
  | ''no fields''
 
 
  |  
 
  |  
 
  |-
 
  |-
  |rowspan="2"| 1: end combat
+
  | 1018
| Duration
+
  | Blaze shoots
  | VarInt
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Entity ID
+
  | 1019
  | Int
+
  | Zombie attacks wood door
 
  |  
 
  |  
 
  |-
 
  |-
  |rowspan="3"| 2: entity dead
+
  | 1020
| Player ID
+
  | Zombie attacks iron door
  | VarInt
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Entity ID
+
  | 1021
  | Int
+
  | Zombie breaks wood door
  |  
+
|
 +
|-
 +
| 1022
 +
| Wither breaks block
 +
  |
 
  |-
 
  |-
  | Message
+
  | 1023
  | [[Chat]]
+
  | Wither spawned
 
  |  
 
  |  
|}
 
 
==== Player List Item ====
 
 
Sent by the server to update the user list (<tab> in the client).
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="4"| Field Name
 
!colspan="3"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="19"| 0x2D
+
  | 1024
|rowspan="19"| Play
+
  | Wither shoots
|rowspan="19"| Client
+
  |
  |colspan="4"| Action
 
|colspan="3"| VarInt
 
  | Determines the rest of the Player format after the UUID
 
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  | 1025
  |colspan="3"| VarInt
+
  | Bat takes off
  | Number of elements in the following array
+
  |
 
  |-
 
  |-
  |rowspan="17"| Player
+
  | 1026
|colspan="3"| UUID
+
  | Zombie infects
  |rowspan="17"| Array
+
  |
|colspan="2"| UUID
 
  |  
 
 
  |-
 
  |-
  ! Action
+
  | 1027
  !colspan="2"| Field Name
+
  | Zombie villager converted
  !colspan="2"|  
+
  |
!
 
 
  |-
 
  |-
  |rowspan="10"| 0: add player
+
  | 1028
|colspan="2"| Name
+
  | Ender dragon death
  |colspan="2"| String
+
  |
  |  
 
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | 1029
|colspan="2"| VarInt
+
  | Anvil destroyed
| Number of elements in the following array
 
|-
 
|rowspan="4"| Property
 
| Name
 
|rowspan="4"| Array
 
  | String
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Value
+
  | 1030
  | String
+
  | Anvil used
|
 
|-
 
| Is Signed
 
| Boolean
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Signature
+
  | 1031
  | Optional String
+
  | Anvil landed
  | Only if Is Signed is true
+
  |
 
  |-
 
  |-
  |colspan="2"| Gamemode
+
  | 1032
  |colspan="2"| VarInt
+
  | Portal travel
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Ping
+
  | 1033
  |colspan="2"| VarInt
+
| Chorus flower grown
 +
|
 +
  |-
 +
| 1034
 +
| Chorus flower died
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Has Display Name
+
  | 1035
  |colspan="2"| Boolean
+
| Brewing stand brewed
 +
|
 +
  |-
 +
| 1036
 +
| Iron trapdoor opened
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | 1037
  |colspan="2"| Optional [[Chat]]
+
| Iron trapdoor closed
  | Only if Has Display Name is true
+
|
 +
|-
 +
| 1038
 +
| End portal created in overworld
 +
|
 +
|-
 +
| 1039
 +
| Phantom bites
 +
|
 +
|-
 +
  | 1040
 +
| Zombie converts to drowned
 +
|
 +
|-
 +
| 1041
 +
| Husk converts to zombie by drowning
 +
  |
 
  |-
 
  |-
  | 1: update gamemode
+
  | 1042
  |colspan="2"| Gamemode
+
  | Grindstone used
|colspan="2"| VarInt
+
  |
|
 
|-
 
| 2: update latency
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
  |  
 
 
  |-
 
  |-
  |rowspan="2"| 3: update display name
+
  | 1043
|colspan="2"| Has Display Name
+
  | Book page turned
  |colspan="2"| Boolean
+
  |
  |  
 
 
  |-
 
  |-
|colspan="2"| Display Name
 
|colspan="2"| Optional [[Chat]]
 
| Only send if Has Display Name is true
 
 
  |-
 
  |-
  | 4: remove player
+
  !colspan="3"| Particle
|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.
 
 
 
==== Player Position And Look (clientbound) ====
 
 
 
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
 
 
 
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
 
 
 
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”.
 
 
 
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
 
 
 
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x2E
+
  | 1500
|rowspan="7"| Play
+
  | Composter composts
|rowspan="7"| Client
+
  |
| X
 
  | Double
 
  | Absolute or relative position, depending on Flags
 
 
  |-
 
  |-
  | Y
+
  | 1501
  | Double
+
  | Lava converts block (either water to stone, or removes existing blocks such as torches)
  | Absolute or relative position, depending on Flags
+
  |
 
  |-
 
  |-
  | Z
+
  | 1502
  | Double
+
  | Redstone torch burns out
  | Absolute or relative position, depending on Flags
+
|
 +
|-
 +
| 1503
 +
| Ender eye placed
 +
  |
 
  |-
 
  |-
  | Yaw
+
  | 2000
  | Float
+
  | Spawns 10 smoke particles, e.g. from a fire
  | Absolute or relative rotation on the X axis, in degrees
+
  | Direction, see below
 
  |-
 
  |-
  | Pitch
+
  | 2001
  | Float
+
  | Block break + block break sound
  | Absolute or relative rotation on the Y axis, in degrees
+
  | Block state, as an index into the global palette
 
  |-
 
  |-
  | Flags
+
  | 2002
  | Byte
+
  | Splash potion. Particle effect + glass break sound.
  | Bit field, see below
+
| [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
 +
  |  
 
  |-
 
  |-
  | Teleport ID
+
  | 2005
  | VarInt
+
  | Bonemeal particles
  | Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
+
  | How many particles to spawn (if set to 0, 15 are spawned)
|}
 
 
 
About the Flags field:
 
 
 
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Field
+
  | 2006
  ! Bit
+
  | Dragon breath
 +
|
 
  |-
 
  |-
  | X
+
  | 2007
  | 0x01
+
  | Instant splash potion
 +
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
  |-
 
  |-
  | Y
+
  | 2008
  | 0x02
+
| Ender dragon destroys block
 +
  |
 
  |-
 
  |-
  | Z
+
  | 2009
  | 0x04
+
| Wet sponge vaporizes in nether
 +
  |
 
  |-
 
  |-
  | Y_ROT
+
  | 3000
  | 0x08
+
| End gateway spawn
 +
  |  
 
  |-
 
  |-
  | X_ROT
+
  | 3001
  | 0x10
+
| Enderdragon growl
  |}
+
  |
 +
  |}
 +
 
 +
Smoke directions:
  
==== Use Bed ====
+
{| class="wikitable"
 +
! ID
 +
! Direction
 +
|-
 +
| 0
 +
| South-East
 +
|-
 +
| 1
 +
| South
 +
|-
 +
| 2
 +
| South-West
 +
|-
 +
| 3
 +
| East
 +
|-
 +
| 4
 +
| (Up or middle ?)
 +
|-
 +
| 5
 +
| West
 +
|-
 +
| 6
 +
| North-East
 +
|-
 +
| 7
 +
| North
 +
|-
 +
| 8
 +
| North-West
 +
|}
  
This packet tells that a player goes to bed.
+
Play record: This is actually a special case within this packet. You can start/stop a record at a specific location. Use a valid {{Minecraft Wiki|Music Discs|Record ID}} to start a record (or overwrite a currently playing one), any other value will stop the record.  See [[Data Generators]] for information on item IDs.
  
The client with the matching Entity ID will go into bed mode.
+
==== Particle ====
  
This Packet is sent to all nearby players including the one sent to bed.
+
Displays the named particle
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,826: Line 2,907:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x2F
+
  |rowspan="11"| 0x24
  |rowspan="2"| Play
+
  |rowspan="11"| Play
  |rowspan="2"| Client
+
  |rowspan="11"| Client
  | Entity ID
+
  | Particle ID
  | VarInt
+
  | Int
  | Sleeping player's EID
+
  | The particle ID listed in [[#Particle|the particle data type]].
 
  |-
 
  |-
  | Location
+
  | Long Distance
  | Position
+
  | Boolean
  | Block location of the head part of the bed
+
  | 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]].
 
  |}
 
  |}
  
==== Destroy Entities ====
+
==== Update Light ====
  
Sent by the server when a list of entities is to be destroyed on the client.
+
Updates light levels for a chunk.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,846: Line 2,963:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x30
+
  |rowspan="10"| 0x25
  |rowspan="2"| Play
+
|rowspan="10"| Play
  |rowspan="2"| Client
+
|rowspan="10"| Client
  | Count
+
|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
 
  | VarInt
  | Number of elements in the following array
+
  | Length of the following array in bytes (always 2048)
 
  |-
 
  |-
  | Entity IDs
+
  | Sky Light array
  | Array of VarInt
+
  | Array of 2048 bytes
  | The list of entities of destroy
+
  | 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.
|}
 
 
 
==== Remove Entity Effect ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x31
+
  |rowspan="2"| Block Light arrays
  |rowspan="2"| Play
+
  | Length
  |rowspan="2"| Client
+
  |rowspan="2"| Array
| Entity ID
 
 
  | VarInt
 
  | VarInt
  |  
+
  | Length of the following array in bytes (always 2048)
 
  |-
 
  |-
  | Effect ID
+
  | Block Light array
  | Byte
+
  | Array of 2048 bytes
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | 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.
 
  |}
 
  |}
  
==== Resource Pack Send ====  
+
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.
 +
 
 +
==== Join Game ====
 +
 
 +
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,894: Line 3,029:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x32
+
  |rowspan="9"| 0x26
  |rowspan="2"| Play
+
  |rowspan="9"| Play
  |rowspan="2"| Client
+
  |rowspan="9"| Client
  | URL
+
  | Entity ID
  | String
+
  | Int
  | The URL to the resource pack.
+
  | 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.
 
  |-
 
  |-
  | Hash
+
  | Enable respawn screen
  | String
+
  | Boolean
  | A 40 character hexadecimal and lowercase [[wikipedia:SHA-1|SHA-1]] hash of the resource pack file. (must be lower case in order to work)<br />If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth — but it will still treat it as a unique id
+
  | Set to false when the doImmediateRespawn gamerule is true
 
  |}
 
  |}
  
==== Respawn ====
+
==== Map Data ====
  
To change the player's dimension (overworld/nether/end), send them a respawn packet with the appropriate dimension, followed by prechunks/chunks for the new dimension, and finally a position and look packet. You do not need to unload chunks, the client will do it automatically.
+
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,914: Line 3,077:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x33
+
  |rowspan="17"| 0x27
  |rowspan="4"| Play
+
  |rowspan="17"| Play
  |rowspan="4"| Client
+
  |rowspan="17"| Client
  | Dimension
+
  |colspan="2"| Map ID
  | Int Enum
+
  |colspan="2"| VarInt
  | -1: The Nether, 0: The Overworld, 1: The End
+
  | Map ID of the map being modified
 
  |-
 
  |-
  | Difficulty
+
  |colspan="2"| Scale
  | Unsigned Byte
+
  |colspan="2"| Byte
  | 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
+
  | 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
 
  |-
 
  |-
  | Gamemode
+
  |rowspan="6"| Icon
  | Unsigned Byte
+
| Type
  | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
+
|rowspan="6"| Array
 +
  | VarInt enum
 +
  | See below
 
  |-
 
  |-
  | Level Type
+
  | X
  | String
+
  | Byte
  | Same as [[#Join Game|Join Game]]
+
  | Map coordinates: -128 for furthest left, +127 for furthest right
|}
 
 
 
{{Warning2|Avoid changing player's dimension to same dimension they were already in unless they are dead. If you change the dimension to one they are already in, weird bugs can occur, such as the player being unable to attack other players in new world (until they die and respawn).
 
 
 
If you must respawn a player in the same dimension without killing them, send two respawn packets, one to a different world and then another to the world you want. You do not need to complete the first respawn; it only matters that you send two packets.}}
 
 
 
==== Entity Head Look ====
 
 
 
Changes the direction an entity's head is facing.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x34
+
  | Z
|rowspan="2"| Play
+
  | Byte
|rowspan="2"| Client
+
  | Map coordinates: -128 for highest, +127 for lowest
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Head Yaw
+
  | Direction
  | Angle
+
  | Byte
  | New angle, not a delta
+
  | 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}}
 
  |}
 
  |}
  
==== World Border ====
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
 +
 
 +
Types are based off of rows and columns in <code>map_icons.png</code>:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="18"| 0x35
+
  ! Icon type
  |rowspan="18"| Play
+
  ! Result
|rowspan="18"| Client
 
|colspan="2"| Action
 
| VarInt Enum
 
| Determines the format of the rest of the packet
 
 
  |-
 
  |-
  ! Action
+
  | 0
  ! Field Name
+
  | White arrow (players)
!
 
!
 
 
  |-
 
  |-
  | 0: set size
+
  | 1
  | Diameter
+
  | Green arrow (item frames)
| Double
 
| Length of a single side of the world border, in meters
 
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
  | 2
| Old Diameter
+
  | Red arrow
| Double
 
  | Current length of a single side of the world border, in meters
 
 
  |-
 
  |-
  | New Diameter
+
  | 3
  | Double
+
  | Blue arrow
| Target length of a single side of the world border, in meters
 
 
  |-
 
  |-
  | Speed
+
  | 4
  | VarLong
+
  | White cross
| 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
+
  | 5
| X
+
  | Red pointer
| Double
 
  |  
 
 
  |-
 
  |-
  | Z
+
  | 6
| Double
+
  | White circle (off-map players)
  |  
 
 
  |-
 
  |-
  |rowspan="8"| 3: initialize
+
  | 7
| X
+
  | Small white circle (far-off-map players)
| Double
 
  |  
 
 
  |-
 
  |-
  | Z
+
  | 8
| Double
+
  | Mansion
  |  
 
 
  |-
 
  |-
  | Old Diameter
+
  | 9
  | Double
+
  | Temple
  | Current length of a single side of the world border, in meters
+
  |-
 +
| 10
 +
| White Banner
 +
|-
 +
| 11
 +
| Orange Banner
 +
|-
 +
| 12
 +
| Magenta Banner
 +
|-
 +
| 13
 +
| Light Blue Banner
 +
|-
 +
| 14
 +
| Yellow Banner
 
  |-
 
  |-
  | New Diameter
+
  | 15
  | Double
+
  | Lime Banner
| Target length of a single side of the world border, in meters
 
 
  |-
 
  |-
  | Speed
+
  | 16
  | VarLong
+
  | Pink Banner
| 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
+
  | 17
  | VarInt
+
  | Gray Banner
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 
 
  |-
 
  |-
  | Warning Time
+
  | 18
  | VarInt
+
  | Light Gray Banner
| In seconds as set by <code>/worldborder warning time</code>
 
 
  |-
 
  |-
  | Warning Blocks
+
  | 19
  | VarInt
+
  | Cyan Banner
| In meters
 
 
  |-
 
  |-
  |rowspan="1"| 4: set warning time
+
  | 20
| Warning Time
+
  | Purple Banner
| VarInt
 
  | In seconds as set by <code>/worldborder warning time</code>
 
 
  |-
 
  |-
  |rowspan="1"| 5: set warning blocks
+
  | 21
  | Warning Blocks
+
| Blue Banner
  | VarInt
+
  |-
  | In meters
+
  | 22
  |}
+
  | Brown Banner
 
+
  |-
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:
+
| 23
 
+
| Green Banner
<syntaxhighlight lang="java">
+
|-
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
+
| 24
if (playerDistance < distance) {
+
| Red Banner
    warning = 1.0 - playerDistance / distance;
+
|-
} else {
+
| 25
    warning = 0.0;
+
| Black Banner
}
+
|-
</syntaxhighlight>
+
| 26
 
+
| Treasure marker
==== Camera ====
+
  |}
 
 
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
 
 
 
The player's camera will move with the entity and look where it is looking. The entity is often another player, but can be any type of entity. The player is unable to move this entity (move packets will act as if they are coming from the other entity).
 
  
If the given entity is not loaded by the player, this packet is ignored.  To return control to the player, send this packet with their entity ID.
+
==== Trade List ====
  
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).
+
The list of trades a villager NPC is offering.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,084: Line 3,254:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x36
+
  |rowspan="18"| 0x28
  |rowspan="1"| Play
+
  |rowspan="18"| Play
  |rowspan="1"| Client
+
  |rowspan="18"| Client
  | Camera ID
+
  |-
  | VarInt
+
| colspan="2" | Window ID
  | ID of the entity to set the client's camera to
+
  | colspan="2" | VarInt
  |}
+
  | The ID of the window that is open; this is an int rather than a byte.
 
+
|-
The notchian also loads certain shaders for given entities:
+
| colspan="2" | Size
 
+
| colspan="2" | Byte
* Creeper &rarr; <code>shaders/post/creeper.json</code>
+
| The number of trades in the following array
* Spider (and cave spider) &rarr; <code>shaders/post/spider.json</code>
+
|-
* Enderman &rarr; <code>shaders/post/invert.json</code>
+
| rowspan="11" | Trades
* Anything else &rarr; the current shader is unloaded
+
| Input item 1
 
+
| rowspan="11" | Array
==== Held Item Change (clientbound) ====
+
| [[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.
 +
|}
  
Sent to change the player's slot selection.
+
[[File:1.14-merchant-slots.png|thumb|The merchant UI, for reference]]
 +
{{-}}
  
{| class="wikitable"
+
==== Entity Position ====
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="1"| 0x37
 
|rowspan="1"| Play
 
|rowspan="1"| Client
 
| Slot
 
| Byte
 
| The slot which the player has selected (0–8)
 
|}
 
  
==== Display Scoreboard ====
+
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 is sent to the client when it should display a scoreboard.
+
This packet allows at most 8 blocks movement in any direction, because short range is from -32768 to 32767. And <code>32768 / (128 * 32)</code> = 8.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,135: Line 3,351:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x38
+
  |rowspan="5"| 0x29
  |rowspan="2"| Play
+
  |rowspan="5"| Play
  |rowspan="2"| Client
+
  |rowspan="5"| Client
  | Position
+
  | Entity ID
  | Byte
+
  | VarInt
  | The position of the scoreboard. 0: list, 1: sidebar, 2: below name.
+
  |  
 +
|-
 +
| 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>
 
  |-
 
  |-
  | Score Name
+
  | On Ground
  | String
+
  | Boolean
  | The unique name for the scoreboard to be displayed.
+
  |  
 
  |}
 
  |}
  
==== Entity Metadata ====
+
==== Entity Position and Rotation ====
  
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.
+
This packet is sent by the server when an entity rotates and moves. Since a short range is limited from -32768 to 32767, and movement is offset of fixed-point numbers, this packet allows at most 8 blocks movement in any direction. (<code>-32768 / (32 * 128) == -8</code>)
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,159: Line 3,387:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x39
+
  |rowspan="7"| 0x2A
  |rowspan="2"| Play
+
  |rowspan="7"| Play
  |rowspan="2"| Client
+
  |rowspan="7"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Metadata
+
  | Delta X
  | [[Entities#Entity Metadata Format|Entity Metadata]]
+
  | Short
  |  
+
| Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
  |}
+
  |-
 
+
  | Delta Y
==== Attach Entity ====
+
| Short
 
+
| Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
This packet is sent when an entity has been {{Minecraft Wiki|Lead|leashed}} to another entity.
+
|-
 
+
| Delta Z
{| class="wikitable"
+
  | Short
  ! Packet ID
+
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
  ! State
+
  |-
  ! Bound To
+
  | Yaw
  ! Field Name
+
  | Angle
  ! Field Type
+
  | New angle, not a delta
  ! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  | Pitch
|rowspan="2"| Play
+
  | Angle
|rowspan="2"| Client
+
  | New angle, not a delta
| Attached Entity ID
 
  | Int
 
  | Attached entity's EID
 
 
  |-
 
  |-
  | Holding Entity ID
+
  | On Ground
  | Int
+
  | Boolean
  | ID of the entity holding the lead. Set to -1 to detach.
+
  |  
 
  |}
 
  |}
  
==== Entity Velocity ====
+
==== Entity Rotation ====
  
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms); for example, -1343 would move (-1343 / 8000) = −0.167875 blocks per tick (or −3,3575 blocks per second).
+
This packet is sent by the server when an entity rotates.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,207: Line 3,431:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x3B
+
  |rowspan="4"| 0x2B
 
  |rowspan="4"| Play
 
  |rowspan="4"| Play
 
  |rowspan="4"| Client
 
  |rowspan="4"| Client
Line 3,214: Line 3,438:
 
  |  
 
  |  
 
  |-
 
  |-
  | Velocity X
+
  | Yaw
  | Short
+
  | Angle
  | Velocity on the X axis
+
  | New angle, not a delta
 
  |-
 
  |-
  | Velocity Y
+
  | Pitch
  | Short
+
  | Angle
  | Velocity on the Y axis
+
  | New angle, not a delta
 
  |-
 
  |-
  | Velocity Z
+
  | On Ground
  | Short
+
  | Boolean
  | Velocity on the Z axis
+
  |  
 
  |}
 
  |}
  
==== Entity Equipment ====
+
==== Entity Movement ====
 +
 
 +
This packet may be used to initialize an entity.
 +
 
 +
For player entities, either this packet or any move/look packet is sent every game tick. So the meaning of this packet is basically that the entity did not move/look since the last such packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,237: Line 3,465:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x3C
+
  |rowspan="1"| 0x2C
  |rowspan="3"| Play
+
  |rowspan="1"| Play
  |rowspan="3"| Client
+
  |rowspan="1"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
| Entity's EID
 
|-
 
| Slot
 
| VarInt Enum
 
| Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
 
|-
 
| Item
 
| [[Slot Data|Slot]]
 
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Set Experience ====
+
==== Vehicle Move (clientbound) ====
  
Sent by the server when the client should change experience levels.
+
Note that all fields use absolute positioning and do not allow for relative positioning.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,265: Line 3,485:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x3D
+
  |rowspan="5"| 0x2D
  |rowspan="3"| Play
+
  |rowspan="5"| Play
  |rowspan="3"| Client
+
  |rowspan="5"| Client
  | Experience bar
+
  | X
  | Float
+
  | Double
  | Between 0 and 1
+
  | Absolute position (X coordinate)
 +
|-
 +
| Y
 +
| Double
 +
| Absolute position (Y coordinate)
 
  |-
 
  |-
  | Level
+
  | Z
  | VarInt
+
  | Double
  |  
+
  | Absolute position (Z coordinate)
 
  |-
 
  |-
  | Total Experience
+
  | Yaw
  | VarInt
+
  | Float
  | See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
+
  | Absolute rotation on the vertical axis, in degrees
 +
|-
 +
| Pitch
 +
| Float
 +
| Absolute rotation on the horizontal axis, in degrees
 
  |}
 
  |}
  
==== Update Health ====
+
==== Open Book ====
 +
 
 +
Sent when a player right clicks with a signed book. This tells the client to open the book GUI.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x2E
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Hand
 +
| VarInt enum
 +
| 0: Main hand, 1: Off hand
 +
|}
  
Sent by the server to update/set the health of the player it is sent to.
+
==== Open Window ====
  
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
+
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"
Line 3,295: Line 3,541:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x3E
+
  |rowspan="3"| 0x2F
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
 
  |rowspan="3"| Client
 
  |rowspan="3"| Client
  | Health
+
  | Window ID
  | Float
+
  | VarInt
  | 0 or less = dead, 20 = full HP
+
  | A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
  |-
 
  |-
  | Food
+
  | Window Type
 
  | VarInt
 
  | VarInt
  | 0–20
+
  | The window type to use for display. Contained in the <code>minecraft:menu</code> regisry; see [[Inventory]] for the different values.
  |-  
+
  |-
  | Food Saturation
+
  | Window Title
  | Float
+
  | [[Chat]]
  | Seems to vary from 0.0 to 5.0 in integer increments
+
  | The title of the window
 
  |}
 
  |}
  
==== Scoreboard Objective ====
+
==== Open Sign Editor ====
  
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
+
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]].  There must already be a sign at the given location (which the client does not do automatically) - send a [[#Block Change|Block Change]] first.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,323: Line 3,569:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x3F
+
  |rowspan="1"| 0x30
  |rowspan="4"| Play
+
  |rowspan="1"| Play
  |rowspan="4"| Client
+
  |rowspan="1"| Client
  | Objective Name
+
  | Location
| String
+
  | Position
| An unique name for the objective
+
  |  
|-
 
| Mode
 
| Byte
 
| 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
 
|-
 
| Objective Value
 
| Optional String
 
| Only if mode is 0 or 2. The text to be displayed for the score
 
|-
 
| Type
 
  | Optional String
 
  | Only if mode is 0 or 2. “integer” or “hearts”
 
 
  |}
 
  |}
  
==== Set Passengers ====
+
==== Craft Recipe Response ====
 +
 
 +
Response to the serverbound packet ([[#Craft Recipe Request|Craft Recipe Request]]), with the same recipe ID.  Appears to be used to notify the UI.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,353: Line 3,589:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x40
+
  |rowspan="2"| 0x31
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Window ID
  | VarInt
+
  | Byte
  | Vehicle's EID
+
  |
|-
 
| Passenger Count
 
| VarInt
 
| Number of elements in the following array
 
 
  |-
 
  |-
  | Passengers
+
  | Recipe
  | Array of VarInt
+
  | Identifier
  | EIDs of entity's passengers
+
  | A recipe ID
 
  |}
 
  |}
  
==== Teams ====
+
==== Player Abilities (clientbound) ====
  
Creates and updates teams.
+
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"
Line 3,377: Line 3,609:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="23"| 0x41
+
  |rowspan="3"| 0x32
  |rowspan="23"| Play
+
  |rowspan="3"| Play
  |rowspan="23"| Client
+
  |rowspan="3"| Client
  |colspan="2"| Team Name
+
  | Flags
| String
 
| A unique name for the team. (Shared with scoreboard).
 
|-
 
|colspan="2"| Mode
 
 
  | Byte
 
  | Byte
  | Determines the layout of the remaining packet
+
  | Bit field, see below
 
  |-
 
  |-
  |rowspan="9"| 0: create team
+
  | Flying Speed
  | Team Display Name
+
  | Float
| String
+
  | 0.05 by default
  |  
 
 
  |-
 
  |-
  | Team Prefix
+
  | Field of View Modifier
  | String
+
  | Float
  | Displayed before the names of players that are part of this team
+
  | 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.
 +
|}
 +
 
 +
About the flags:
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  | Team Suffix
+
  ! Field
  | String
+
  ! Bit
| Displayed after the names of players that are part of this team
 
 
  |-
 
  |-
  | Friendly Flags
+
  | Invulnerable
  | Byte
+
  | 0x01
| Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible players on same team
 
 
  |-
 
  |-
  | Name Tag Visibility
+
  | Flying
  | String Enum
+
  | 0x02
| <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
 
 
  |-
 
  |-
  | Collision Rule
+
  | Allow Flying
  | String Enum
+
  | 0x04
| <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
 
 
  |-
 
  |-
  | Color
+
  | Creative Mode (Instant Break)
  | Byte
+
  | 0x08
  | Same as [[Chat]] colors
+
  |}
  |-
+
 
  | Player Count
+
==== Combat Event ====
  | VarInt
+
 
  | Number of elements in the following array
+
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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
! Field Type
 +
! Notes
 +
  |-
 +
  |rowspan="8"| 0x33
 +
|rowspan="8"| Play
 +
|rowspan="8"| Client
 +
|colspan="2"| Event
 +
  | VarInt Enum
 +
  | Determines the layout of the remaining packet
 
  |-
 
  |-
  | Players
+
  ! Event
  | Array of String
+
  ! Field Name
  | Usernames of the players in this team. Maximum 40 characters per entry.
+
  !
 +
!
 
  |-
 
  |-
  | 1: remove team
+
  | 0: enter combat
 
  | ''no fields''
 
  | ''no fields''
 
  | ''no fields''
 
  | ''no fields''
 
  |  
 
  |  
 
  |-
 
  |-
  |rowspan="7"| 2: update team info
+
  |rowspan="2"| 1: end combat
  | Team Display Name
+
  | Duration
  | String
+
  | VarInt
  |  
+
  | Length of the combat in ticks.
 
  |-
 
  |-
  | Team Prefix
+
  | Entity ID
  | String
+
  | Int
  | Displayed before the names of players that are part of this team
+
  | ID of the primary opponent of the ended combat, or -1 if there is no obvious primary opponent.
 
  |-
 
  |-
  | Team Suffix
+
  |rowspan="3"| 2: entity dead
  | String
+
| Player ID
  | Displayed after the names of players that are part of this team
+
  | VarInt
 +
  | Entity ID of the player that died (should match the client's entity ID).
 
  |-
 
  |-
  | Friendly Flags
+
  | Entity ID
  | Byte
+
  | Int
  | Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible players on same team
+
  | The killing entity's ID, or -1 if there is no obvious killer.
 
  |-
 
  |-
  | Name Tag Visibility
+
  | Message
  | String Enum
+
  | [[Chat]]
| <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
+
  | The death message
|-
 
| Collision Rule
 
| String Enum
 
| <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
 
|-
 
| Color
 
| Byte
 
| Same as [[Chat]] colors
 
|-
 
|rowspan="2"| 3: add players to team
 
| Player Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Players
 
| Array of String
 
| Usernames of the added players. Maximum 40 characters per entry.
 
|-
 
|rowspan="2"| 4: remove players from team
 
| Player Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Players
 
| Array of String
 
  | Usernames of the removed players. Maximum 40 characters per entry.
 
 
  |}
 
  |}
  
==== Update Score ====
+
==== Player Info ====
  
This is sent to the client when it should update a scoreboard item.  
+
Sent by the server to update the user list (<tab> in the client).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,490: Line 3,709:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="4"| Field Name
  ! Field Type
+
  !colspan="3"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x42
+
  |rowspan="19"| 0x34
  |rowspan="4"| Play
+
  |rowspan="19"| Play
  |rowspan="4"| Client
+
  |rowspan="19"| Client
  | Score Name
+
  |colspan="4"| Action
  | String
+
  |colspan="3"| VarInt
  | The name of the score to be updated or removed
+
  | Determines the rest of the Player format after the UUID
 
  |-
 
  |-
  | Action
+
  |colspan="4"| Number Of Players
  | Byte
+
  |colspan="3"| VarInt
  | 0 to create/update an item. 1 to remove an item.
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Objective Name
+
  |rowspan="17"| Player
  | String
+
|colspan="3"| UUID
  | The name of the objective the score belongs to
+
|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
 
  | Value
  | Optional VarInt
+
  | String (32767)
  | The score to be displayed next to the entry. Only sent when Action does not equal 1.
+
  |  
  |}
+
  |-
 
+
| Is Signed
==== Spawn Position ====
+
  | Boolean
 
+
  |
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.
+
  |-
 
+
  | Signature
{| class="wikitable"
+
  | Optional String (32767)
  ! Packet ID
+
  | Only if Is Signed is true
  ! State
 
  ! Bound To
 
  ! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x43
+
  |colspan="2"| Gamemode
  |rowspan="1"| Play
+
|colspan="2"| VarInt
  |rowspan="1"| Client
+
|
  | Location
+
|-
  | Position
+
|colspan="2"| Ping
  | Spawn location
+
|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''
 +
  |  
 
  |}
 
  |}
  
==== Time Update ====
+
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.
  
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.
+
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.
  
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
+
==== Face Player ====
  
The default SMP server increments the time by <code>20</code> every second.
+
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"
Line 3,550: Line 3,825:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x44
+
  |rowspan="8"| 0x35
  |rowspan="2"| Play
+
  |rowspan="8"| Play
  |rowspan="2"| Client
+
  |rowspan="8"| Client
  | World Age
+
  |-
  | Long
+
  | Feet/eyes
  | In ticks; not changed by server commands
+
  | 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
 
  |-
 
  |-
  | Time of day
+
  | Entity feet/eyes
  | Long
+
  | Optional VarInt enum
  | The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
+
  | Whether to look at the entity's eyes or feet.  Same values and meanings as before, just for the entity's head/feet.
 
  |}
 
  |}
  
==== Title ====
+
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.
 +
 
 +
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,568: Line 3,876:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x45
+
  |rowspan="7"| 0x36
  |rowspan="9"| Play
+
  |rowspan="7"| Play
  |rowspan="9"| Client
+
  |rowspan="7"| Client
  |colspan="2"| Action
+
  | X
  | VarInt Enum
+
  | Double
  |  
+
  | Absolute or relative position, depending on Flags
 
  |-
 
  |-
  ! Action
+
  | Y
  ! Field Name
+
  | Double
  !
+
  | Absolute or relative position, depending on Flags
!
 
 
  |-
 
  |-
  | 0: set title
+
  | Z
  | Title Text
+
  | Double
| [[Chat]]
+
  | Absolute or relative position, depending on Flags
  |  
 
 
  |-
 
  |-
  | 1: set subtitle
+
  | Yaw
  | Subtitle Text
+
  | Float
| [[Chat]]
+
  | Absolute or relative rotation on the X axis, in degrees
  |  
 
 
  |-
 
  |-
  |rowspan="3"| 2: set times and display
+
  | Pitch
| Fade In
+
  | Float
  | Int
+
  | Absolute or relative rotation on the Y axis, in degrees
  | Ticks to spend fading in
 
 
  |-
 
  |-
  | Stay
+
  | Flags
  | Int
+
  | Byte
  | Ticks to keep the title displayed
+
  | Bit field, see below
 
  |-
 
  |-
  | Fade Out
+
  | Teleport ID
  | Int
+
  | VarInt
  | Ticks to spend out, not when to start fading out
+
  | Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
|-
 
| 3: hide
 
| ''no fields''
 
| ''no fields''
 
|
 
|-
 
| 4: reset
 
| ''no fields''
 
| ''no fields''
 
|  
 
 
  |}
 
  |}
  
“Hide” makes the title disappear, but if you run times again the same title will appear. “Reset” erases the text.
+
About the Flags field:
  
The title is visible on screen for Fade In + Stay + Fade Out ticks.
+
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
  
==== Sound Effect ====
+
{| class="wikitable"
 +
|-
 +
! Field
 +
! Bit
 +
|-
 +
| X
 +
| 0x01
 +
|-
 +
| Y
 +
| 0x02
 +
|-
 +
| Z
 +
| 0x04
 +
|-
 +
| Y_ROT
 +
| 0x08
 +
|-
 +
| X_ROT
 +
| 0x10
 +
|}
  
This packet is used to play a number of hardcoded sound events. For custom sounds, use [[#Named Sound Effect|Named Sound Effect]] ([[#Play|Play]], 0x19, clientbound).
+
==== Unlock Recipes ====
 
 
{{Warning|Numeric sound effect IDs are liable to change between versions}}
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,636: Line 3,947:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x46
+
  |rowspan="10"| 0x37
  |rowspan="7"| Play
+
  |rowspan="10"| Play
  |rowspan="