Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
(→‎Login: Login plugin messages)
(Fixed a link)
 
(103 intermediate revisions by 25 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''' ([[Protocol version numbers|1.13.1, protocol 401]]). 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] ([http://wiki.vg/MCDevs More Information]).
+
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 47: Line 47:
 
  |-
 
  |-
 
  | Global palette
 
  | Global palette
  | A table/dictionary/palette mapping nonnegative integers to block states. Block state IDs are created in a linear fashion based off of order of assignment.  One block state ID allocated for each unique block state for a block; if a block has multiple properties then the number of allocated states is the product of the number of values for each property.  A current list of properties and state ID ranges is found on [http://pokechu22.github.io/Burger/1.13.1.html burger].
+
  | 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.
 
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.
Line 66: 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 111: 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]], 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|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all.
 
Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all.
Line 140: Line 140:
 
  | Protocol Version
 
  | Protocol Version
 
  | VarInt
 
  | VarInt
  | See [[protocol version numbers]] (currently 401 in Minecraft 1.13.1)
+
  | See [[protocol version numbers]] (currently 578 in Minecraft 1.15.2)
 
  |-
 
  |-
 
  | Server Address
 
  | Server Address
 
  | String (255)
 
  | 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 179: 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 195: 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
 +
| Long
 +
  | Should be the same as sent by the client
 +
  |}
 +
 
 +
=== Serverbound ===
 +
 
 +
==== Request ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | X
+
  |rowspan="1"| 0x00
| Double
+
  | Status
|
+
  | Server
|-
+
  |colspan="3"| ''no fields''
| Y
 
| Double
 
|  
 
  |-
 
  | Z
 
  | Double
 
|
 
|-
 
| Pitch
 
| Angle
 
|
 
|-
 
| Yaw
 
| Angle
 
|
 
|-
 
| Data
 
| Int
 
| Meaning dependent on the value of the Type field, see [[Object Data]] for details.
 
|-
 
| Velocity X
 
| Short
 
|rowspan="3"| Same units as [[#Entity Velocity|Entity Velocity]].  Always sent, but only used when Data is greater than 0 (except for some entities which always ignore it; see [[Object Data]] for details).
 
|-
 
| Velocity Y
 
| Short
 
|-
 
| Velocity Z
 
| Short
 
 
  |}
 
  |}
  
==== 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
+
== 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 ===
 +
 
 +
==== Disconnect (login) ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Y
+
  |rowspan="1"| 0x00
  | Double
+
  |rowspan="1"| Login
  |  
+
  |rowspan="1"| Client
|-
+
  | Reason
  | Z
+
  | [[Chat]]
  | Double
 
 
  |  
 
  |  
|-
 
| Count
 
| Short
 
| The amount of experience this orb will reward once collected
 
 
  |}
 
  |}
  
==== Spawn Global Entity ====
+
==== Encryption Request ====
 
 
With this packet, the server notifies the client of thunderbolts striking within a 512 block radius around the player. The coordinates specify where exactly the thunderbolt strikes.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 293: Line 306:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x02
+
  |rowspan="5"| 0x01
  |rowspan="5"| Play
+
  |rowspan="5"| Login
 
  |rowspan="5"| Client
 
  |rowspan="5"| Client
  | Entity ID
+
  | Server ID
 +
| String (20)
 +
| Appears to be empty
 +
|-
 +
| Public Key Length
 
  | VarInt
 
  | VarInt
  | The EID of the thunderbolt
+
  | Length of Public Key
 
  |-
 
  |-
  | Type
+
  | Public Key
  | Byte Enum
+
  | Byte Array
| The global entity type, currently always 1 for thunderbolt
 
|-
 
| X
 
| Double
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Y
+
  | Verify Token Length
  | Double
+
  | VarInt
  |  
+
  | Length of Verify Token. Always 4 for Notchian servers.
 
  |-
 
  |-
  | Z
+
  | Verify Token
  | Double
+
  | Byte Array
  |  
+
  | A sequence of random bytes generated by the server
 
  |}
 
  |}
  
==== Spawn Mob ====
+
See [[Protocol Encryption]] for details.
  
Sent by the server when a mob entity is spawned.
+
==== Login Success ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 329: Line 342:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="13"| 0x03
+
  |rowspan="2"| 0x02
  |rowspan="13"| Play
+
  |rowspan="2"| Login
  |rowspan="13"| Client
+
  |rowspan="2"| Client
| Entity ID
 
| VarInt
 
|
 
|-
 
| Entity UUID
 
 
  | UUID
 
  | UUID
  |  
+
  | String (36)
 +
| Unlike in other packets, this field contains the UUID as a string with hyphens.
 
  |-
 
  |-
  | Type
+
  | Username
  | VarInt
+
  | String (16)
| The type of mob. See [[Entities#Mobs]]
 
|-
 
| X
 
| Double
 
 
  |  
 
  |  
  |-
+
  |}
| Y
+
 
| Double
+
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]]).
| Z
+
 
| Double
+
The notchian client doesn't send any (non-[[#Keep Alive|keep alive]]) packets until the next tick/[[#Time Update|time update]] packet.
|
+
}}
|-
 
| 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 ====
+
==== Set Compression ====
  
This packet shows location, name, and type of painting.
+
Enables compression.  If compression is enabled, all following packets are encoded in the [[#With compression|compressed packet format]].  Negative or zero values will disable compression, meaning the packet format should remain in the [[#Without compression|uncompressed packet format]].  However, this packet is entirely optional, and if not sent, compression will also not be enabled (the notchian server does not send the packet when compression is disabled).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 397: Line 373:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x04
+
  |rowspan="1"| 0x03
  |rowspan="5"| Play
+
  |rowspan="1"| Login
  |rowspan="5"| Client
+
  |rowspan="1"| Client
  | Entity ID
+
  | Threshold
 
  | VarInt
 
  | 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
 
  |-
 
  |-
  | Entity UUID
+
  |rowspan="3"| 0x04
  | UUID
+
|rowspan="3"| Login
  |  
+
|rowspan="3"| Client
 +
| Message ID
 +
  | VarInt
 +
  | Generated by the server - should be unique to the connection.
 
  |-
 
  |-
  | Title
+
  | Channel
  | String (13)
+
  | Identifier
  | Name of the painting. Max length 13
+
  | Name of the [[plugin channel]] used to send the data
 
  |-
 
  |-
  | Location
+
  | Data
| Position
+
  | Byte Array
| Center coordinates (see below)
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
|-
 
| 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.
+
=== Serverbound ===
  
List of paintings by coordinates in <code>paintings_kristoffer_zetterstrand.png</code> (where x and y are in pixels from the top left and width and height are in pixels or 16ths of a block):
+
==== Login Start  ====
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Name
+
  ! Packet ID
  ! x
+
! State
  ! y
+
  ! Bound To
  ! width
+
  ! Field Name
  ! height
+
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>Kebab</code>
+
  |rowspan="1"| 0x00
  | 0
+
  |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>Aztec</code>
+
  |rowspan="4"| 0x01
  | 16
+
|rowspan="4"| Login
  | 0
+
  |rowspan="4"| Server
  | 16
+
  | Shared Secret Length
  | 16
+
  | VarInt
 +
  | Length of Shared Secret
 
  |-
 
  |-
  | <code>Alban</code>
+
  | Shared Secret
  | 32
+
  | Byte Array
  | 0
+
  |  
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Aztec2</code>
+
  | Verify Token Length
  | 48
+
  | VarInt
  | 0
+
  | Length of Verify Token
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Bomb</code>
+
  | Verify Token
  | 64
+
  | Byte Array
  | 0
+
  |  
  | 16
+
  |}
  | 16
+
 
 +
See [[Protocol Encryption]] for details.
 +
 
 +
==== Login Plugin Response ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | <code>Plant</code>
+
  |rowspan="3"| 0x02
  | 80
+
|rowspan="3"| Login
  | 0
+
  |rowspan="3"| Server
  | 16
+
  | Message ID
  | 16
+
  | VarInt
 +
  | Should match ID from server.
 
  |-
 
  |-
  | <code>Wasteland</code>
+
  | Successful
| 96
+
| Boolean
| 0
+
| <code>true</code> if the client understands the request, <code>false</code> otherwise. When <code>false</code>, no payload follows.
| 16
 
| 16
 
 
  |-
 
  |-
  | <code>Pool</code>
+
  | Data
  | 0
+
  | Optional Byte Array
  | 32
+
  | Any data, depending on the channel. The length of this array must be inferred from the packet length.
  | 32
+
  |}
| 16
+
 
|-
+
== Play ==
| <code>Courbet</code>
+
 
| 32
+
=== Clientbound ===
| 32
+
 
| 32
+
==== Spawn Entity ====
| 16
+
 
  |-
+
Sent by the server when a vehicle or other non-living entity is created.
  | <code>Sea</code>
+
 
  | 64
+
{| class="wikitable"
  | 32
+
  ! Packet ID
  | 32
+
  ! State
  | 16
+
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | <code>Sunset</code>
+
  |rowspan="12"| 0x00
  | 96
+
|rowspan="12"| Play
  | 32
+
  |rowspan="12"| Client
  | 32
+
  | Entity ID
  | 16
+
  | VarInt
 +
  | EID of the entity
 
  |-
 
  |-
  | <code>Creebet</code>
+
  | Object UUID
  | 128
+
  | UUID
  | 32
+
  |  
| 32
 
| 16
 
 
  |-
 
  |-
  | <code>Wanderer</code>
+
  | Type
  | 0
+
  | VarInt
  | 64
+
  | The type of entity (same as in [[#Spawn Living Entity|Spawn Living Entity]])
| 16
 
| 32
 
 
  |-
 
  |-
  | <code>Graham</code>
+
  | X
  | 16
+
  | Double
  | 64
+
  |  
| 16
 
| 32
 
 
  |-
 
  |-
  | <code>Match</code>
+
  | Y
  | 0
+
  | Double
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Bust</code>
+
  | Z
  | 32
+
  | Double
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Stage</code>
+
  | Pitch
  | 64
+
  | Angle
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Void</code>
+
  | Yaw
  | 96
+
  | Angle
  | 128
+
  |  
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>SkullAndRoses</code>
+
  | Data
  | 128
+
  | Int
  | 128
+
  | Meaning dependent on the value of the Type field, see [[Object Data]] for details.
| 32
 
| 32
 
 
  |-
 
  |-
  | <code>Wither</code>
+
  | Velocity X
  | 160
+
  | Short
  | 128
+
  |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).
| 32
 
  | 32
 
 
  |-
 
  |-
  | <code>Fighters</code>
+
  | Velocity Y
  | 0
+
  | Short
| 96
 
| 64
 
| 32
 
 
  |-
 
  |-
  | <code>Pointer</code>
+
  | Velocity Z
  | 0
+
  | Short
| 192
+
  |}
| 64
+
 
| 64
+
==== Spawn Experience Orb ====
|-
+
 
| <code>Pigscene</code>
+
Spawns one or more experience orbs.
| 64
+
 
| 192
 
| 64
 
| 64
 
|-
 
| <code>BurningSkull</code>
 
| 128
 
| 192
 
| 64
 
| 64
 
|-
 
| <code>Skeleton</code>
 
| 192
 
| 64
 
| 64
 
| 48
 
|-
 
| <code>DonkeyKong</code>
 
| 192
 
| 112
 
| 64
 
| 48
 
  |}
 
 
 
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
 
 
 
==== 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 List Item|Player List Item]] 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"
 
  ! Packet ID
 
  ! Packet ID
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
+
==== Spawn Weather Entity ====
 +
 
 +
With this packet, the server notifies the client of thunderbolts striking within a 512 block radius around the player. The coordinates specify where exactly the thunderbolt strikes.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="5"| 0x02
 +
|rowspan="5"| Play
 +
|rowspan="5"| Client
 +
| Entity ID
 +
| VarInt
 +
| The EID of the thunderbolt
 +
|-
 +
| Type
 +
| Byte Enum
 +
| The global entity type, currently always 1 for thunderbolt
 +
|-
 +
| X
 +
| Double
 +
  |  
 +
  |-
 +
  | Y
 +
  | Double
 
  |  
 
  |  
 
  |-
 
  |-
  | Metadata
+
  | Z
  | [[Entities#Entity Metadata Format|Entity Metadata]]
+
  | Double
 
  |  
 
  |  
 
  |}
 
  |}
  
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs.
+
==== Spawn Living Entity ====
 
 
In offline mode, [[Wikipedia:Universally unique identifier#Versions 3 and 5 (namespace name-based)|UUID v3]] is used with the String <code>OfflinePlayer:&lt;player name&gt;</code>, encoded in UTF-8 (and case-sensitive).
 
 
 
For NPCs UUID v2 should be used. Note:
 
 
 
<+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.
+
Sent by the server when a living entity is spawned.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 665: Line 639:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x06
+
  |rowspan="12"| 0x03
  |rowspan="2"| Play
+
  |rowspan="12"| Play
  |rowspan="2"| Client
+
  |rowspan="12"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Player ID
+
  |  
 
  |-
 
  |-
  | Animation
+
  | Entity UUID
  | Unsigned Byte
+
  | UUID
  | Animation ID (see below)
+
  |  
|}
 
 
 
Animation can be one of the following values:
 
 
 
{| class="wikitable"
 
! ID
 
! Animation
 
 
  |-
 
  |-
  | 0
+
  | Type
  | Swing main arm
+
  | VarInt
 +
| The type of mob. See [[Entities#Mobs]]
 
  |-
 
  |-
  | 1
+
  | X
  | Take damage
+
| Double
 +
  |  
 
  |-
 
  |-
  | 2
+
  | Y
  | Leave bed
+
| Double
 +
  |  
 
  |-
 
  |-
  | 3
+
  | Z
  | Swing offhand
+
| Double
 +
  |  
 
  |-
 
  |-
  | 4
+
  | Yaw
  | Critical effect
+
| Angle
 +
  |  
 
  |-
 
  |-
  | 5
+
  | Pitch
  | Magic critical effect
+
  | Angle
  |}
+
  |  
 
 
==== Statistics ====
 
 
 
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1).
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
!colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x07
+
  | Head Pitch
  |rowspan="3"| Play
+
| Angle
  |rowspan="3"| Client
+
  |  
  |colspan="2"| Count
+
  |-
  |colspan="2"| VarInt
+
  | Velocity X
  | Number of elements in the following array
+
  | Short
 +
  | Same units as [[#Entity Velocity|Entity Velocity]]
 
  |-
 
  |-
  |rowspan="2"| Statistic
+
  | Velocity Y
  | Name
+
  | Short
  |rowspan="2"| Array
+
  | Same units as [[#Entity Velocity|Entity Velocity]]
| String (32767)
 
| [https://gist.github.com/Alvin-LB/8d0d13db00b3c00fd0e822a562025eff https://gist.github.com/Alvin-LB/8d0d13db00b3c00fd0e822a562025eff]
 
 
  |-
 
  |-
  | Value
+
  | Velocity Z
  | VarInt
+
  | Short
  | The amount to set it to
+
  | Same units as [[#Entity Velocity|Entity Velocity]]
 
  |}
 
  |}
  
==== Block Break Animation ====
+
==== Spawn Painting ====
  
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
+
This packet shows location, name, and type of painting.
 
 
Block break animations can still be applied on air; the animation will remain visible although there is no block being broken.  However, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency.  (An effect similar to this can be seen in normal gameplay when breaking ice blocks)
 
 
 
If you need to display several break animations at the same time you have to give each of them a unique Entity ID. The entity ID does not need to correspond to an actual entity on the client. It is valid to use a randomly generated number.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 748: Line 703:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x08
+
  |rowspan="5"| 0x04
  |rowspan="3"| Play
+
  |rowspan="5"| Play
  |rowspan="3"| Client
+
  |rowspan="5"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Entity ID of the entity breaking the block
+
|
 +
|-
 +
  | Entity UUID
 +
| UUID
 +
|
 +
|-
 +
| Motive
 +
| VarInt
 +
| Panting's ID, see below
 
  |-
 
  |-
 
  | Location
 
  | Location
 
  | Position
 
  | Position
  | Block Position
+
  | Center coordinates (see below)
 
  |-
 
  |-
  | Destroy Stage
+
  | Direction
  | Byte
+
  | Byte Enum
  | 0–9 to set it, any other value to remove it
+
  | Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
 
  |}
 
  |}
  
==== Update Block Entity ====
+
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.
  
Sets tile entity associated with the block at the given location.
+
List of paintings by coordinates in <code>paintings_kristoffer_zetterstrand.png</code> (where x and y are in pixels from the top left and width and height are in pixels or 16ths of a block):
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
! ID
  ! Bound To
+
  ! x
  ! Field Name
+
  ! y
  ! Field Type
+
  ! width
  ! Notes
+
  ! height
 +
|-
 +
| <code>minecraft:kebab</code>
 +
| 0
 +
  | 0
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  |rowspan="3"| 0x09
+
  | <code>minecraft:aztec</code>
  |rowspan="3"| Play
+
  | 1
  |rowspan="3"| Client
+
  | 16
  | Location
+
  | 0
  | Position
+
  | 16
  |  
+
  | 16
 
  |-
 
  |-
  | Action
+
  | <code>minecraft:alban</code>
  | Unsigned Byte
+
  | 2
  | The type of update to perform, see below
+
  | 32
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | NBT Data
+
  | <code>minecraft:aztec2</code>
  | [[NBT|NBT Tag]]
+
  | 3
  | 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)
+
| 48
  |}
+
  | 0
 
+
  | 16
''Action'' field:
+
| 16
 
 
* '''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''': Set type of flower in flower pot
 
* '''6''': Set base color and patterns on a banner
 
* '''7''': Set the data for a Structure tile entity
 
* '''8''': Set the destination for a end gateway
 
* '''9''': Set the text on a sign
 
* '''10''': Declare a shulker box, no data appears to be sent and the client seems to do fine without this packet. Perhaps it is a leftover from earlier versions?
 
* '''11''': Set the color of a bed
 
 
 
==== 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"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x0A
+
  | <code>minecraft:bomb</code>
  |rowspan="4"| Play
+
  | 4
  |rowspan="4"| Client
+
  | 64
  | Location
+
  | 0
  | Position
+
  | 16
  | Block coordinates
+
  | 16
 
  |-
 
  |-
  | Action ID (Byte 1)
+
  | <code>minecraft:plant</code>
  | Unsigned Byte
+
  | 5
  | Varies depending on block — see [[Block Actions]]
+
  | 80
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Action Param (Byte 2)
+
  | <code>minecraft:wasteland</code>
  | Unsigned Byte
+
  | 6
  | Varies depending on block — see [[Block Actions]]
+
  | 96
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Block Type
+
  | <code>minecraft:pool</code>
  | VarInt
+
  | 7
  | The block type ID for the block, not including metadata/damage value.  This must match the block at the given coordinates.
+
  | 0
  |}
+
  | 32
 
+
  | 32
==== 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:courbet</code>
  |rowspan="2"| Play
+
  | 8
  |rowspan="2"| Client
+
  | 32
  | Location
+
  | 32
  | Position
+
  | 32
  | Block Coordinates
+
  | 16
 
  |-
 
  |-
  | Block ID
+
  | <code>minecraft:sea</code>
| VarInt
+
  | 9
| 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>)
+
| 64
  |}
+
  | 32
 
+
  | 32
==== Boss Bar ====
+
  | 16
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
  !colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="14"| 0x0C
+
  | <code>minecraft:sunset</code>
  |rowspan="14"| Play
+
  | 10
  |rowspan="14"| Client
+
  | 96
  |colspan="2"| UUID
+
  | 32
  | UUID
+
  | 32
  | Unique ID for this bar
+
  | 16
 
  |-
 
  |-
  |colspan="2"| Action
+
  | <code>minecraft:creebet</code>
  | VarInt Enum
+
| 11
  | Determines the layout of the remaining packet
+
| 128
 +
| 32
 +
  | 32
 +
  | 16
 
  |-
 
  |-
  ! Action
+
  | <code>minecraft:wanderer</code>
  ! Field Name
+
  | 12
  !
+
  | 0
  !
+
  | 64
 +
| 16
 +
| 32
 
  |-
 
  |-
  |rowspan="5"| 0: add
+
  | <code>minecraft:graham</code>
  | Title
+
| 13
  | [[Chat]]
+
| 16
  |  
+
  | 64
 +
  | 16
 +
  | 32
 
  |-
 
  |-
  | Health
+
  | <code>minecraft:match</code>
  | Float
+
  | 14
  | 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.
+
  | 0
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Color
+
  | <code>minecraft:bust</code>
  | VarInt Enum
+
  | 15
  | Color ID (see below)
+
  | 32
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Division
+
  | <code>minecraft:stage</code>
  | VarInt Enum
+
  | 16
  | Type of division (see below)
+
  | 64
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Flags
+
  | <code>minecraft:void</code>
  | Unsigned Byte
+
| 17
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music)
+
| 96
 +
| 128
 +
  | 32
 +
  | 32
 
  |-
 
  |-
  | 1: remove
+
  | <code>skull_and_roses</code>
  | ''no fields''
+
  | 18
  | ''no fields''
+
  | 128
  | Removes this boss bar
+
  | 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | 2: update health
+
  | <code>minecraft:wither</code>
  | Health
+
  | 19
  | Float
+
  | 160
  | as above
+
  | 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | 3: update title
+
  | <code>minecraft:fighters</code>
  | Title
+
  | 20
  | [[Chat]]
+
  | 0
  |  
+
  | 96
 +
| 64
 +
| 32
 
  |-
 
  |-
  |rowspan="2"| 4: update style
+
  | <code>minecraft:pointer</code>
  | Color
+
| 21
  | VarInt Enum
+
| 0
  | Color ID (see below)
+
  | 192
 +
  | 64
 +
  | 64
 
  |-
 
  |-
  | Dividers
+
  | <code>minecraft:pigscene</code>
  | VarInt Enum
+
  | 22
  | as above
+
  | 64
 +
| 192
 +
| 64
 +
| 64
 +
|-
 +
| <code>minecraft:burning_skull</code>
 +
| 23
 +
| 128
 +
| 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  | 5: update flags
+
  | <code>minecraft:skeleton</code>
  | Flags
+
  | 24
  | Unsigned Byte
+
  | 192
  | as above
+
  | 64
 +
| 64
 +
| 48
 
  |-
 
  |-
 +
| <code>minecraft:donkey_kong</code>
 +
| 25
 +
| 192
 +
| 112
 +
| 64
 +
| 48
 
  |}
 
  |}
 +
 +
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
 +
 +
==== Spawn Player ====
 +
 +
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
  ! Color
+
  ! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 0
+
  |rowspan="7"| 0x05
  | Pink
+
|rowspan="7"| Play
 +
|rowspan="7"| Client
 +
| Entity ID
 +
| VarInt
 +
  | Player's EID
 
  |-
 
  |-
  | 1
+
  | Player UUID
  | Blue
+
  | UUID
 +
| See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
 
  |-
 
  |-
  | 2
+
  | X
  | Red
+
| Double
 +
  |  
 
  |-
 
  |-
  | 3
+
  | Y
  | Green
+
| Double
 +
  |  
 
  |-
 
  |-
  | 4
+
  | Z
  | Yellow
+
| Double
 +
  |  
 
  |-
 
  |-
  | 5
+
  | Yaw
  | Purple
+
| Angle
 +
  |  
 
  |-
 
  |-
  | 6
+
  | Pitch
  | White
+
| Angle
 +
  |  
 
  |}
 
  |}
  
{| class="wikitable"
+
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs.
! ID
+
 
! Type of division
+
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).
|-
 
| 0
 
| No division
 
|-
 
| 1
 
| 6 notches
 
|-
 
| 2
 
| 10 notches
 
|-
 
| 3
 
| 12 notches
 
|-
 
| 4
 
| 20 notches
 
|}
 
  
==== Server Difficulty ====
+
For NPCs UUID v2 should be used. Note:
  
Changes the difficulty setting in the client's option menu
+
<+Grum> i will never confirm this as a feature you know that :)
  
{| class="wikitable"
+
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>.
! Packet ID
 
! State
 
! 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
 
|}
 
  
==== Chat Message (clientbound) ====  
+
==== Entity Animation (clientbound) ====
  
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options.  See [[Chat#Processing chat|processing chat]] for more info about these positions.
+
Sent whenever an entity should change animation.
 
 
{{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,024: Line 994:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0E
+
  |rowspan="2"| 0x06
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | JSON Data
+
  | Entity ID
  | [[Chat]]
+
  | VarInt
  | Limited to 32767 bytes
+
  | Player ID
 
  |-
 
  |-
  | Position
+
  | Animation
  | Byte
+
  | Unsigned Byte
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
+
  | Animation ID (see below)
 
  |}
 
  |}
  
==== Multi Block Change ====
+
Animation can be one of the following values:
 
 
Fired whenever 2 or more blocks are changed within the same chunk on the same tick.
 
 
 
{{Warning|Changing blocks in chunks not loaded by the client is unsafe (see note on [[#Block Change|Block Change]]).}}
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Animation
  ! Bound To
+
  |-
  !colspan="2"| Field Name
+
  | 0
  !colspan="2"| Field Type
+
  | Swing main arm
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x0F
+
  | 1
|rowspan="6"| Play
+
  | Take damage
|rowspan="6"| Client
 
|colspan="2"| Chunk X
 
|colspan="2"| Int
 
  | Chunk X coordinate
 
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  | 2
|colspan="2"| Int
+
  | Leave bed
  | Chunk Z coordinate
 
 
  |-
 
  |-
  |colspan="2"| Record Count
+
  | 3
|colspan="2"| VarInt
+
  | Swing offhand
  | Number of elements in the following array, i.e. the number of blocks affected
 
 
  |-
 
  |-
  |rowspan="3"| Record
+
  | 4
| Horizontal Position
+
  | Critical effect
|rowspan="3"| Array
 
  | Unsigned Byte
 
| The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
 
 
  |-
 
  |-
  | Y Coordinate
+
  | 5
  | Unsigned Byte
+
  | Magic critical effect
| Y coordinate of the block
 
|-
 
| Block ID
 
| VarInt
 
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (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>)
 
 
  |}
 
  |}
  
To decode the position into a world position:
+
==== Statistics ====
  
<syntaxhighlight lang="java">
+
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1).
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"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
  ! Bound To
+
  ! Bound To  
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x10
+
  |rowspan="4"| 0x07
  |rowspan="2"| Play
+
  |rowspan="4"| Play
  |rowspan="2"| Client
+
  |rowspan="4"| Client
  | Count
+
  |colspan="2"| Count
  | VarInt
+
  |colspan="2"| VarInt
 
  | Number of elements in the following array
 
  | Number of elements in the following array
 
  |-
 
  |-
  | Matches
+
  |rowspan="3"| Statistic
| Array of String (32767)
+
  | Category ID
  | One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
  |rowspan="3"| Array
|}
+
  | VarInt
 
+
  | See below
==== 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
 
 
  |-
 
  |-
  |rowspan="3"| 0x11
+
  | Statistic ID
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Count
 
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array
+
  | See below
 
  |-
 
  |-
  | Nodes
+
  | Value
| Array of [[Command Data|Node]]
 
| An array of nodes
 
|-
 
| Root index
 
 
  | VarInt
 
  | VarInt
  | Index of the <code>root</code> node in the previous array
+
  | The amount to set it to
 
  |}
 
  |}
  
For more information on this packet, see the [[Command Data]] article.
+
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 
 
==== 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
 
  |-
 
  |-
  |rowspan="3"| 0x12
+
  | <code>minecraft.crafted</code>
  |rowspan="3"| Play
+
| 1
  |rowspan="3"| Client
+
| Items
  | Window ID
+
|-
  | Byte
+
| <code>minecraft.used</code>
  | The ID of the window that the action occurred in
+
| 2
 +
| Items
 +
|-
 +
| <code>minecraft.broken</code>
 +
| 3
 +
| Items
 +
  |-
 +
| <code>minecraft.picked_up</code>
 +
| 4
 +
| Items
 +
|-
 +
| <code>minecraft.dropped</code>
 +
| 5
 +
  | Items
 +
|-
 +
  | <code>minecraft.killed</code>
 +
  | 6
 +
  | Entities
 
  |-
 
  |-
  | Action Number
+
  | <code>minecraft.killed_by</code>
  | Short
+
  | 7
  | 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.
+
  | 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):
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
! ID
  ! Bound To
+
  ! Unit
  ! Field Name
+
  |-
  ! Field Type
+
| <code>minecraft.leave_game</code>
  ! Notes
+
| 0
 +
| None
 +
|-
 +
  | <code>minecraft.play_one_minute</code>
 +
  | 1
 +
  | Time
 
  |-
 
  |-
  | 0x13
+
  | <code>minecraft.time_since_death</code>
| Play
+
  | 2
| 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"| 0x14
+
  | <code>minecraft.sneak_Time</code>
|rowspan="5"| Play
+
  | 3
  |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.walk_one_cm</code>
  | String (32)
+
  | 4
  | The window type to use for display. See [[Inventory]] for a list.
+
  | Distance
 
  |-
 
  |-
  | Window Title
+
  | <code>minecraft.crouch_one_cm</code>
  | [[Chat]]
+
  | 5
  | The title of the window
+
  | Distance
 
  |-
 
  |-
  | Number Of Slots
+
  | <code>minecraft.sprint_one_cm</code>
  | Unsigned Byte
+
  | 6
  | Number of slots in the window (excluding the number of slots in the player inventory). Always 0 for non-storage windows (e.g. Workbench, Anvil).
+
  | Distance
 
  |-
 
  |-
  | Entity ID
+
  | <code>minecraft.swim_one_cm</code>
  | Optional Int
+
  | 7
  | EntityHorse's EID. Only sent when Window Type is “EntityHorse”
+
  | Distance
|}
 
 
 
See [[Inventory]] for further information.
 
 
 
==== Window Items ====
 
[[File:Inventory-slots.png|thumb|The inventory slots]]
 
 
 
Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x15
+
  | <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"| 0x16
+
  | <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
 +
|-
 +
| <code>minecraft.interact_with_brewingstand</code>
 +
| 33
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_beacon</code>
 +
| 34
 +
| None
 
  |-
 
  |-
  |rowspan="2"| Brewing Stand
+
  | <code>minecraft.inspect_dropper</code>
  | 0: Brew time
+
  | 35
  | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
+
  | None
 
  |-
 
  |-
  | 1: Fuel time
+
  | <code>minecraft.inspect_hopper</code>
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
+
  | 36
  |}
+
  | 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"| 0x17
+
  | <code>minecraft.inspect_dispenser</code>
|rowspan="3"| Play
+
  | 37
|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.play_noteblock</code>
  | Short
+
  | 38
  | The slot that should be updated
+
  | None
 
  |-
 
  |-
  | Slot Data
+
  | <code>minecraft.tune_noteblock</code>
  | [[Slot Data|Slot]]
+
| 39
  |  
+
| None
  |}
+
|-
 
+
| <code>minecraft.pot_flower</code>
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
+
| 40
 
+
  | None
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.
+
|-
 +
  | <code>minecraft.trigger_trapped_chest</code>
 +
  | 41
 +
| None
 +
|-
 +
| <code>minecraft.open_enderchest</code>
 +
| 42
 +
| None
 +
|-
 +
| <code>minecraft.enchant_item</code>
 +
| 43
 +
| None
 +
|-
 +
| <code>minecraft.play_record</code>
 +
| 44
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_furnace</code>
 +
| 45
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_crafting_table</code>
 +
  | 46
 +
| None
 +
|-
 +
| <code>minecraft.open_chest</code>
 +
| 47
 +
| None
 +
|-
 +
| <code>minecraft.sleep_in_bed</code>
 +
| 48
 +
| None
 +
|-
 +
| <code>minecraft.open_shulker_box</code>
 +
| 49
 +
| None
 +
|}
 +
 
 +
Units:
  
==== 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. 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).
+
==== Acknowledge Player Digging ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,401: Line 1,336:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x18
+
  |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,429: Line 1,372:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x19
+
  |rowspan="3"| 0x09
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Channel
+
  | Entity ID
  | String (20)
+
  | 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,454: Line 1,400:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x1A
+
  |rowspan="3"| 0x0A
  |rowspan="7"| Play
+
  |rowspan="3"| Play
  |rowspan="7"| Client
+
  |rowspan="3"| Client
  | Sound Name
+
  | Location
  | String (256)
+
  | Position
  | All sound effect names as of 1.12.2 can be seen [http://pokechu22.github.io/Burger/1.12.2.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
  
Sent by the server before it disconnects a client. The client assumes that the server has already closed the connection by the time the packet arrives.
+
==== Block Action ====
  
{| class="wikitable"
+
This packet is used for a number of actions and animations performed by blocks, usually non-persistent.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
| 0x1B
 
| Play
 
| Client
 
| Reason
 
| [[Chat]]
 
| Displayed to the client when the connection terminates.
 
|}
 
  
==== Entity Status ====
+
See [[Block Actions]] for a list of values.
  
Entity statuses generally trigger an animation for an entityThe available statuses vary by the entity's type (and are available to subclasses of that type as well).
+
{{Warning2|This packet uses a block ID, not a block stateUnfortunately, block IDs are not directly included in the output from [[Data Generators]], but can manually be calculated.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,518: Line 1,449:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1C
+
  |rowspan="4"| 0x0B
  |rowspan="2"| Play
+
  |rowspan="4"| Play
  |rowspan="2"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  | Location
  | Int
+
| Position
  |  
+
| Block coordinates
 +
|-
 +
| Action ID (Byte 1)
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]]
 +
|-
 +
| Action Param (Byte 2)
 +
  | Unsigned Byte
 +
  | Varies depending on block — see [[Block Actions]]
 
  |-
 
  |-
  | Entity Status
+
  | Block Type
  | Byte Enum
+
  | VarInt
  | See below
+
  | The block type ID for the block.  This must match the block at the given coordinates.
 
  |}
 
  |}
  
See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
+
==== Block Change ====
  
==== NBT Query Response ====
+
Fired whenever a block is changed within the render distance.
  
Sent in response to [[#Query Block NBT|Query Block NBT]] or [[#Query Entity NBT|Query Entity NBT]].
+
{{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,544: Line 1,483:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1D
+
  |rowspan="2"| 0x0C
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Transaction ID
+
  | Location
 +
| Position
 +
| Block Coordinates
 +
|-
 +
| Block ID
 
  | VarInt
 
  | VarInt
  | Can be compared to the one sent in the original query packet.
+
  | 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.
|-
 
| NBT
 
| [[NBT|NBT Tag]]
 
| The NBT of the block or entity. May be a TAG_END (0) in which case no NBT is present.
 
 
  |}
 
  |}
  
==== Explosion ====
+
==== Boss Bar ====  
 
 
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,566: Line 1,501:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x1E
+
  |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
 +
  |-
 +
  |colspan="2"| Action
 +
| VarInt Enum
 +
| Determines the layout of the remaining packet
 +
|-
 +
! Action
 +
! Field Name
 +
!
 +
!
 
  |-
 
  |-
  | Y
+
  |rowspan="5"| 0: add
  | Float
+
| 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
 +
|-
 +
| 3: update title
 +
| Title
 +
| [[Chat]]
 +
|
 +
|-
 +
|rowspan="2"| 4: update style
 +
| Color
 +
| VarInt Enum
 +
| Color ID (see below)
 +
|-
 +
| Dividers
 +
| VarInt Enum
 +
| as above
 +
|-
 +
| 5: update flags
 +
| Flags
 +
| Unsigned Byte
 +
| as above
 
  |-
 
  |-
| Player Motion Z
 
| Float
 
| Z velocity of the player being pushed by the explosion
 
 
  |}
 
  |}
 
==== Unload Chunk ====
 
 
Tells the client to unload a chunk column.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Color
  ! Bound To
+
  |-
! Field Name
+
  | 0
  ! Field Type
+
  | Pink
  ! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x1F
+
  | 1
|rowspan="2"| Play
+
  | Blue
|rowspan="2"| Client
 
| Chunk X
 
| Int
 
  | Block coordinate divided by 16, rounded down
 
 
  |-
 
  |-
  | Chunk Z
+
  | 2
  | Int
+
  | Red
  | Block coordinate divided by 16, rounded down
+
  |-
  |}
+
| 3
 
+
| Green
It is legal to send this packet even if the given chunk is not currently loaded.
+
|-
 
+
| 4
==== Change Game State ====
+
| Yellow
 +
|-
 +
| 5
 +
| Purple
 +
|-
 +
| 6
 +
| White
 +
  |}
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Type of division
 +
|-
 +
| 0
 +
| No division
 +
|-
 +
| 1
 +
| 6 notches
 +
|-
 +
| 2
 +
| 10 notches
 +
|-
 +
| 3
 +
| 12 notches
 +
|-
 +
| 4
 +
| 20 notches
 +
|}
 +
 
 +
==== Server Difficulty ====
  
Used for a wide variety of game state things, from whether to bed use to gamemode to demo messages.
+
Changes the difficulty setting in the client's option menu
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,648: Line 1,631:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x20
+
  |rowspan="2"| 0x0E
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Reason
+
  | Difficulty
 
  | Unsigned Byte
 
  | Unsigned Byte
  | See below
+
  | 0: peaceful, 1: easy, 2: normal, 3: hard
 
  |-
 
  |-
  | Value
+
  | Difficulty locked?
  | Float
+
  | Boolean
  | Depends on Reason
+
  |
 
  |}
 
  |}
  
''Reason codes'':
+
==== Chat Message (clientbound) ====
  
{| class="wikitable"
+
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility optionsSee [[Chat#Processing chat|processing chat]] for more info about these positions.
! Reason
 
! Effect
 
! Value
 
|-
 
| 0
 
| Invalid Bed
 
| Would be used to switch between messages, but the only used message is 0 for invalid bed
 
|-
 
| 1
 
| End raining
 
|
 
|-
 
| 2
 
| Begin raining
 
|
 
|-
 
| 3
 
| Change gamemode
 
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 
|-
 
| 4
 
| Exit end
 
| 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?" advancement, while if they do have it 0 is used.
 
|-
 
| 5
 
| Demo message
 
| 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
 
|-
 
| 6
 
| Arrow hitting player
 
| Appears to be played when an arrow strikes another player in Multiplayer
 
|-
 
| 7
 
| Fade value
 
| The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
 
|-
 
| 8
 
| Fade time
 
| Time in ticks for the sky to fade
 
|-
 
| 10
 
| Play elder guardian mob appearance (effect and sound)
 
|
 
|}
 
  
==== Keep Alive (clientbound) ====
+
{{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.}}
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
 
 
 
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,722: Line 1,657:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x21
+
  |rowspan="2"| 0x0F
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Keep Alive ID
+
  | JSON Data
  | Long
+
| [[Chat]]
  |  
+
| Limited to 32767 bytes
 +
|-
 +
| Position
 +
  | Byte
 +
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
 
  |}
 
  |}
  
==== Chunk Data ====
+
==== Multi Block Change ====
{{Main|Chunk Format}}
+
 
{{See also|#Unload Chunk}}
+
Fired whenever 2 or more blocks are changed within the same chunk on the same tick.
  
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).
+
{{Warning|Changing blocks in chunks not loaded by the client is unsafe (see note on [[#Block Change|Block Change]]).}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,740: Line 1,679:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x22
+
  |rowspan="6"| 0x10
  |rowspan="8"| Play
+
  |rowspan="6"| Play
  |rowspan="8"| Client
+
  |rowspan="6"| Client
  | Chunk X
+
  |colspan="2"| Chunk X
  | Int
+
  |colspan="2"| Int
  | Chunk coordinate (block coordinate divided by 16, rounded down)
+
  | Chunk X coordinate
 +
|-
 +
|colspan="2"| Chunk Z
 +
|colspan="2"| Int
 +
| Chunk Z coordinate
 +
|-
 +
|colspan="2"| Record Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array, i.e. the number of blocks affected
 
  |-
 
  |-
  | Chunk Z
+
  |rowspan="3"| Record
  | Int
+
| Horizontal Position
  | Chunk coordinate (block coordinate divided by 16, rounded down)
+
|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.
 
  |-
 
  |-
  | Ground-Up Continuous
+
  | Y Coordinate
  | Boolean
+
  | Unsigned Byte
  | See [[Chunk Format#Ground-up continuous|Chunk Format]]
+
  | Y coordinate of the block
 
  |-
 
  |-
  | Primary Bit Mask
+
  | Block ID
| 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
 
  | VarInt
  | Size of Data in bytes
+
  | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
 +
|}
 +
 
 +
To decode the position into a world position:
 +
 
 +
<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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 +
|-
 +
|rowspan="8"| 0x11
 +
|rowspan="8"| Play
 +
|rowspan="8"| Client
 +
|-
 +
|colspan="2"| ID
 +
|colspan="2"| VarInt
 +
| Transaction ID
 +
|-
 +
|colspan="2"| Start
 +
|colspan="2"| VarInt
 +
| Start of the text to replace
 
  |-
 
  |-
  | Data
+
  |colspan="2"| Length
  | Byte array
+
  |colspan="2"| VarInt
  | See [[Chunk Format#Data structure|data structure]] in Chunk Format
+
  | Length of the text to replace
 
  |-
 
  |-
  | Number of block entities
+
  |colspan="2"| Count
  | VarInt
+
  |colspan="2"| VarInt
 
  | Number of elements in the following array
 
  | Number of elements in the following array
 
  |-
 
  |-
  | Block entities
+
  |rowspan="3"| Matches
  | Array of [[NBT|NBT Tag]]
+
| Match
  | All block entities in the chunkUse the x, y, and z tags in the NBT to determine their positions.
+
  |rowspan="3"| Array
 +
| String (32767)
 +
  | One eligible value to insert, note that each command is sent separately instead of in a single string, hence the need for Count.  Note that for instance this doesn't include a leading <code>/</code> on commands.
 +
|-
 +
| Has tooltip
 +
| Boolean
 +
  | True if the following is present
 +
|-
 +
| Tooltip
 +
| Optional [[Chat]]
 +
| Tooltip to display; only present if previous boolean is true
 
  |}
 
  |}
  
==== Effect ====
+
==== Declare Commands ====
  
Sent when a client is to play a sound or particle effect.
+
Lists all of the commands on the server, and how they are parsed.
  
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.
+
This is a directed graph, with one root node. Each redirect or child node must refer only to nodes that have already been declared.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,794: Line 1,782:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x23
+
  |rowspan="3"| 0x12
  |rowspan="4"| Play
+
  |rowspan="3"| Play
  |rowspan="4"| Client
+
  |rowspan="3"| Client
  | Effect ID
+
  | Count
  | Int
+
  | VarInt
  | The ID of the effect, see below
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Location
+
  | Nodes
  | Position
+
  | Array of [[Command Data|Node]]
  | The location of the effect
+
  | An array of nodes
 
  |-
 
  |-
  | Data
+
  | Root index
  | Int
+
  | VarInt
  | Extra data for certain effects, see below
+
  | Index of the <code>root</code> node in the previous array
|-
 
| Disable Relative Volume
 
| Boolean
 
| See above
 
 
  |}
 
  |}
  
Effect IDs:
+
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"
 
{| class="wikitable"
  ! ID
+
  ! Packet ID
  ! Name
+
  ! State
  ! Data
+
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
! Notes
 
  |-
 
  |-
  !colspan="3"| Sound
+
  |rowspan="3"| 0x13
 +
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Window ID
 +
| Byte
 +
| The ID of the window that the action occurred in
 
  |-
 
  |-
  | 1000
+
  | Action Number
  | Dispenser dispenses
+
  | 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.
 
  |-
 
  |-
  | 1001
+
  | Accepted
  | Dispenser fails to dispense
+
  | Boolean
  |
+
| 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
 
  |-
 
  |-
  | 1002
+
  | 0x14
  | Dispenser shoots
+
  | 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
 
  |-
 
  |-
  | 1003
+
  |rowspan="3"| 0x15
  | Ender eye launched
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Window ID
 +
  | Unsigned Byte
 +
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  | 1004
+
  | Count
  | Firework shot
+
  | Short
  |  
+
  | Number of elements in the following array
 
  |-
 
  |-
  | 1005
+
  | Slot Data
  | Iron door opened
+
  | Array of [[Slot Data|Slot]]
 
  |  
 
  |  
 +
|}
 +
 +
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
 
  |-
 
  |-
  | 1006
+
  |rowspan="3"| 0x16
  | Wooden door opened
+
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Window ID
 +
  | Unsigned Byte
 
  |  
 
  |  
 
  |-
 
  |-
  | 1007
+
  | Property
  | Wooden trapdoor opened
+
  | Short
  |  
+
  | The property to be updated, see below
 
  |-
 
  |-
  | 1008
+
  | Value
  | Fence gate opened
+
  | 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"
 
  |-
 
  |-
  | 1009
+
  ! Window type
  | Fire extinguished
+
  ! Property
  |
+
  ! Value
 
  |-
 
  |-
  | 1010
+
  |rowspan="4"| Furnace
  | Play record
+
  | 0: Fire icon (fuel left)
  | Special case, see below for more info
+
  | counting from fuel burn time down to 0 (in-game ticks)
 
  |-
 
  |-
  | 1011
+
  | 1: Maximum fuel burn time
| Iron door closed
+
  | fuel burn time or 0 (in-game ticks)
  |  
 
 
  |-
 
  |-
  | 1012
+
  | 2: Progress arrow
| Wooden door closed
+
  | counting from 0 to maximum progress (in-game ticks)
  |  
 
 
  |-
 
  |-
  | 1013
+
  | 3: Maximum progress
| Wooden trapdoor closed
+
  | always 200 on the notchian server
  |  
 
 
  |-
 
  |-
  | 1014
+
  |rowspan="10"| Enchantment Table
  | Fence gate closed
+
  | 0: Level requirement for top enchantment slot
  |  
+
  |rowspan="3"| The enchantment's xp level requirement
 
  |-
 
  |-
  | 1015
+
  | 1: Level requirement for middle enchantment slot
| Ghast warns
 
|
 
 
  |-
 
  |-
  | 1016
+
  | 2: Level requirement for bottom enchantment slot
| Ghast shoots
 
|
 
 
  |-
 
  |-
  | 1017
+
  | 3: The enchantment seed
  | Enderdragon shoots
+
  | 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>).
  |
 
 
  |-
 
  |-
  | 1018
+
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
  | Blaze shoots
+
  |rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
|  
 
 
  |-
 
  |-
  | 1019
+
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
| Zombie attacks wood door
 
|
 
 
  |-
 
  |-
  | 1020
+
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
| Zombie attacks iron door
 
|
 
 
  |-
 
  |-
  | 1021
+
  | 7: Enchantment level shown on mouse hover over the top slot
  | Zombie breaks wood door
+
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
|
 
 
  |-
 
  |-
  | 1022
+
  | 8: Enchantment level shown on mouse hover over the middle slot
| Wither breaks block
 
|
 
 
  |-
 
  |-
  | 1023
+
  | 9: Enchantment level shown on mouse hover over the bottom slot
| Wither spawned
 
|
 
 
  |-
 
  |-
  | 1024
+
  |rowspan="3"| Beacon
  | Wither shoots
+
  | 0: Power level
  |
+
  | 0-4, controls what effect buttons are enabled
 
  |-
 
  |-
  | 1025
+
  | 1: First potion effect
  | Bat takes off
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
|
 
 
  |-
 
  |-
  | 1026
+
  | 2: Second potion effect
  | Zombie infects
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
|
 
 
  |-
 
  |-
  | 1027
+
  | Anvil
  | Zombie villager converted
+
  | 0: Repair cost
  |
+
  | The repair's cost in xp levels
 
  |-
 
  |-
  | 1028
+
  |rowspan="2"| Brewing Stand
  | Ender dragon death
+
  | 0: Brew time
  |
+
  | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
  |-
 
  |-
  | 1029
+
  | 1: Fuel time
| Anvil destroyed
+
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
  |  
 
 
  |-
 
  |-
  | 1030
+
  | Stonecutter
  | Anvil used
+
  | 0: Selected recipe
  |  
+
  | The index of the selected recipe. -1 means none is selected.
 
  |-
 
  |-
  | 1031
+
  | Loom
  | Anvil landed
+
  | 0: Selected pattern
  |
+
  | 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
 
  |-
 
  |-
  | 1032
+
  | 0
  | Portal travel
+
  | minecraft:protection
  |  
+
  | Protection
 
  |-
 
  |-
  | 1033
+
  | 1
  | Chorus flower grown
+
  | minecraft:fire_protection
  |
+
  | Fire Protection
 
  |-
 
  |-
  | 1034
+
  | 2
  | Chorus flower died
+
  | minecraft:feather_falling
  |  
+
  | Feather Falling
 
  |-
 
  |-
  | 1035
+
  | 3
  | Brewing stand brewed
+
  | minecraft:blast_protection
  |
+
  | Blast Protection
 
  |-
 
  |-
  | 1036
+
  | 4
  | Iron trapdoor opened
+
  | minecraft:projectile_protection
  |  
+
  | Projectile Protection
 
  |-
 
  |-
  | 1037
+
  | 5
  | Iron trapdoor closed
+
  | minecraft:respiration
  |
+
  | Respiration
 
  |-
 
  |-
  !colspan="3"| Particle
+
  | 6
 +
| minecraft:aqua_affinity
 +
| Aqua Affinity
 
  |-
 
  |-
  | 2000
+
  | 7
  | Spawns 10 smoke particles, e.g. from a fire
+
  | minecraft:thorns
  | Direction, see below
+
  | Thorns
 
  |-
 
  |-
  | 2001
+
  | 8
  | Block break + block break sound
+
  | minecraft:depth_strider
  | Block state, determined by <code>meta << 12 | block id</code> (this differs from normal global palette use)
+
  | Depth Strider
 
  |-
 
  |-
  | 2002
+
  | 9
  | Splash potion. Particle effect + glass break sound.
+
  | minecraft:frost_walker
  | [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
+
  | Frost Walker
 
  |-
 
  |-
  | 2003
+
  | 10
  | Eye of Ender entity break animation — particles and sound
+
  | minecraft:binding_curse
  |  
+
  | Curse of Binding
 
  |-
 
  |-
  | 2004
+
  | 11
  | Mob spawn particle effect: smoke + flames
+
  | minecraft:sharpness
  |  
+
  | Sharpness
 
  |-
 
  |-
  | 2005
+
  | 12
  | Bonemeal particles
+
  | minecraft:smite
  | How many particles to spawn (if set to 0, 15 are spawned)
+
  | Smite
 
  |-
 
  |-
  | 2006
+
  | 13
  | Dragon breath
+
  | minecraft:bane_of_arthropods
  |
+
  | Bane of Arthropods
 
  |-
 
  |-
  | 2007
+
  | 14
  | Instant splash potion
+
  | minecraft:knockback
  | [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
+
  | Knockback
 
  |-
 
  |-
  | 3000
+
  | 15
  | End gateway spawn
+
  | minecraft:fire_aspect
  |  
+
  | Fire Aspect
 
  |-
 
  |-
  | 3001
+
  | 16
| Enderdragon growl
+
  | minecraft:looting
  |
+
  | Looting
  |}
 
 
 
Smoke directions:
 
 
 
{| class="wikitable"
 
! ID
 
! Direction
 
 
  |-
 
  |-
  | 0
+
  | 17
  | South-East
+
  | minecraft:sweeping
 +
| Sweeping Edge
 
  |-
 
  |-
  | 1
+
  | 18
  | South
+
  | minecraft:efficiency
 +
| Efficiency
 
  |-
 
  |-
  | 2
+
  | 19
  | South-West
+
  | minecraft:silk_touch
 +
| Silk Touch
 
  |-
 
  |-
  | 3
+
  | 20
  | East
+
  | minecraft:unbreaking
 +
| Unbreaking
 
  |-
 
  |-
  | 4
+
  | 21
  | (Up or middle ?)
+
  | minecraft:fortune
 +
| Fortune
 
  |-
 
  |-
  | 5
+
  | 22
  | West
+
  | minecraft:power
 +
| Power
 
  |-
 
  |-
  | 6
+
  | 23
  | North-East
+
  | minecraft:punch
 +
| Punch
 
  |-
 
  |-
  | 7
+
  | 24
  | North
+
  | minecraft:flame
 +
| Flame
 
  |-
 
  |-
  | 8
+
  | 25
  | North-West
+
| minecraft:infinity
 +
| Infinity
 +
|-
 +
| 26
 +
| minecraft:luck_of_the_sea
 +
| Luck of the Sea
 +
|-
 +
| 27
 +
| minecraft:lure
 +
| Lure
 +
|-
 +
| 28
 +
| minecraft:loyalty
 +
| Loyalty
 +
|-
 +
| 29
 +
| minecraft:impaling
 +
| Impaling
 +
  |-
 +
| 30
 +
| minecraft:riptide
 +
| Riptide
 +
|-
 +
| 31
 +
| minecraft:channeling
 +
| Channeling
 +
|-
 +
| 32
 +
| minecraft:mending
 +
| Mending
 +
|-
 +
| 33
 +
| minecraft:vanishing_curse
 +
| Curse of Vanishing
 
  |}
 
  |}
  
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.
+
==== Set Slot ====
  
==== Particle ====
+
Sent by the server when an item in a slot (in a window) is added/removed.
 
 
Displays the named particle
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,066: Line 2,139:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="11"| 0x24
+
  |rowspan="3"| 0x17
  |rowspan="11"| Play
+
  |rowspan="3"| Play
  |rowspan="11"| Client
+
  |rowspan="3"| Client
  | Particle ID
+
  | Window ID
  | Int
+
  | Byte
  | See below
+
  | 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).
 
  |-
 
  |-
  | Long Distance
+
  | Slot
  | Boolean
+
  | Short
  | If true, particle distance increases from 256 to 65536
+
  | The slot that should be updated
 
  |-
 
  |-
  | X
+
  | Slot Data
  | Float
+
  | [[Slot Data|Slot]]
| X position of the particle
+
  |  
  |-
+
  |}
  | Y
+
 
| Float
+
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
| Y position of the particle
+
 
|-
+
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.
| Z
+
 
| Float
+
==== Set Cooldown ====
| 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
 
| Array of VarInt
 
| Length depends on particle. "iconcrack" has length of 2, "blockcrack", "blockdust", and "fallingdust" have lengths of 1, the rest have 0.
 
|}
 
  
Particle IDs:
+
Applies a cooldown period to all items with the given type.  Used by the Notchian server with enderpearls.  This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing).
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Particle Name
+
  |rowspan="2"| 0x18
  ! Particle ID
+
  |rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Item ID
 +
| VarInt
 +
| Numeric ID of the item to apply a cooldown to.
 
  |-
 
  |-
  | explode
+
  | Cooldown Ticks
  | 0
+
  | VarInt
 +
| Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
 +
|}
 +
 
 +
==== Plugin Message (clientbound) ====
 +
 
 +
{{Main|Plugin channels}}
 +
 
 +
Mods and plugins can use this to send their data. Minecraft itself uses several [[plugin channel]]s. These internal channels are in the <code>minecraft</code> namespace.
 +
 
 +
More 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
 
  |-
 
  |-
  | largeexplode
+
  |rowspan="2"| 0x19
  | 1
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Channel
 +
| Identifier
 +
  | Name of the [[plugin channel]] used to send the data
 
  |-
 
  |-
  | hugeexplosion
+
  | Data
  | 2
+
  | 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
 
  |-
 
  |-
  | fireworksSpark
+
  |rowspan="7"| 0x1A
  | 3
+
|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].
 
  |-
 
  |-
  | bubble
+
  | Sound Category
  | 4
+
  | VarInt Enum
 +
| The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 
  |-
 
  |-
  | splash
+
  | Effect Position X
  | 5
+
  | Int
 +
| Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | wake
+
  | Effect Position Y
  | 6
+
  | Int
 +
| Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | suspended
+
  | Effect Position Z
  | 7
+
  | Int
 +
| Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | depthsuspend
+
  | Volume
  | 8
+
  | Float
 +
| 1 is 100%, can be more
 
  |-
 
  |-
  | crit
+
  | Pitch
  | 9
+
  | 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
 
  |-
 
  |-
  | magicCrit
+
  | 0x1B
  | 10
+
  | 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
 
  |-
 
  |-
  | smoke
+
  |rowspan="2"| 0x1C
  | 11
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| Int
 +
  |  
 
  |-
 
  |-
  | largesmoke
+
  | Entity Status
  | 12
+
  | 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
 
  |-
 
  |-
  | spell
+
  |rowspan="9"| 0x1D
  | 13
+
|rowspan="9"| Play
 +
|rowspan="9"| Client
 +
| X
 +
| Float
 +
  |  
 
  |-
 
  |-
  | instantSpell
+
  | Y
  | 14
+
| Float
 +
  |  
 
  |-
 
  |-
  | mobSpell
+
  | Z
  | 15
+
| Float
 +
  |  
 
  |-
 
  |-
  | mobSpellAmbient
+
  | Strength
  | 16
+
  | 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.
 
  |-
 
  |-
  | witchMagic
+
  | Record Count
  | 17
+
  | Int
 +
| Number of elements in the following array
 
  |-
 
  |-
  | dripWater
+
  | Records
  | 18
+
  | Array of (Byte, Byte, Byte)
 +
| Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
 
  |-
 
  |-
  | dripLava
+
  | Player Motion X
  | 19
+
  | Float
 +
| X velocity of the player being pushed by the explosion
 
  |-
 
  |-
  | angryVillager
+
  | Player Motion Y
  | 20
+
  | Float
 +
| Y velocity of the player being pushed by the explosion
 
  |-
 
  |-
  | happyVillager
+
  | Player Motion Z
  | 21
+
  | Float
 +
| Z velocity of the player being pushed by the explosion
 +
|}
 +
 
 +
==== Unload Chunk ====
 +
 
 +
Tells the client to unload a chunk column.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | townaura
+
  |rowspan="2"| 0x1E
  | 22
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Chunk X
 +
| Int
 +
  | Block coordinate divided by 16, rounded down
 
  |-
 
  |-
  | note
+
  | Chunk Z
  | 23
+
  | Int
 +
| Block coordinate divided by 16, rounded down
 +
|}
 +
 
 +
It is legal to send this packet even if the given chunk is not currently loaded.
 +
 
 +
==== Change Game State ====
 +
 
 +
Used for a wide variety of game state things, from whether to bed use to gamemode to demo messages.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | portal
+
  |rowspan="2"| 0x1F
  | 24
+
|rowspan="2"| Play
  |-
+
  |rowspan="2"| Client
  | enchantmenttable
+
  | Reason
  | 25
+
  | Unsigned Byte
 +
  | See below
 
  |-
 
  |-
  | flame
+
  | Value
  | 26
+
  | Float
 +
| Depends on Reason
 +
|}
 +
 
 +
''Reason codes'':
 +
 
 +
{| class="wikitable"
 +
! Reason
 +
! Effect
 +
! Value
 
  |-
 
  |-
  | lava
+
  | 0
  | 27
+
  | No respawn block available
 +
| Note: Sends message 'block.minecraft.spawn.not_valid'(You have no home bed or charged respawn anchor, or it was obstructed) to the client.
 
  |-
 
  |-
  | footstep
+
  | 1
  | 28
+
| End raining
 +
  |  
 
  |-
 
  |-
  | cloud
+
  | 2
  | 29
+
| Begin raining
 +
  |  
 
  |-
 
  |-
  | reddust
+
  | 3
  | 30
+
  | Change gamemode
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 
  |-
 
  |-
  | snowballpoof
+
  | 4
  | 31
+
  | 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.
 
  |-
 
  |-
  | snowshovel
+
  | 5
  | 32
+
  | Demo event
 +
| 0: Show welcome to demo screen<br> 101: Tell movement controls<br> 102: Tell jump control<br> 103: Tell inventory control<br> 104: Tell that the demo is over and print a message about how to take a screenshot
 +
|-
 +
| 6
 +
| Arrow hit player
 +
| Note: Sent when any player is struck by an arrow.
 
  |-
 
  |-
  | slime
+
  | 7
  | 33
+
  | Rain level change
 +
| Note: Seems to change both skycolor and lightning. <strong>[https://imgur.com/a/K6wSrkW You can see some level images here]</strong><br>This can cause [https://imgur.com/gallery/ZQX0Wd5 <strong>HUD color change in client</strong>], when level is higher than 20. It goes away only when game is restarted or client receives same packet (from any server) but with value of 0. Is this a bug?<br><br>Rain level starting from 0.
 
  |-
 
  |-
  | heart
+
  | 8
  | 34
+
  | Thunder level change
 +
| Note: Seems to change both skycolor and lightning (same as Rain level change, but doesn't start rain). It also requires rain to render by notchian client. ()<br>This can cause [https://imgur.com/gallery/ZQX0Wd5 <strong>HUD color change in client</strong>], when level is higher than 20. It goes away only when game is restarted or client receives same packet (from any server) but with value of 0. Is this a bug?<br><br>Thunder level starting from 0.
 
  |-
 
  |-
  | barrier
+
  | 9
  | 35
+
  | Play pufferfish sting sound
 
  |-
 
  |-
  | iconcrack_(id)_(data)
+
  | 10
  | 36
+
| Play elder guardian mob appearance (effect and sound)
 +
  |  
 
  |-
 
  |-
  | blockcrack_(id+(data<<12))
+
  | 11
  | 37
+
| Enable respawn screen
  |-
+
|  0: Enable respawn screen, 1: Immediately respawn (sent when the doImmediateRespawn gamerule changes)  
  | blockdust_(id)
+
  |}
  | 38
+
 
 +
==== Open Horse Window ====
 +
 
 +
This packet is used exclusively for opening the horse GUI. [[#Open Window|Open Window]] is used for all other GUIs.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | droplet
+
  |rowspan="3"| 0x20
  | 39
+
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Window ID?
 +
| Byte
 +
  |
 
  |-
 
  |-
  | take
+
  | Number of slots?
  | 40
+
| VarInt
 +
  |
 
  |-
 
  |-
  | mobappearance
+
  | Entity ID?
  | 41
+
  | Integer
  |-
+
  |
| dragonbreath
 
| 42
 
|-
 
| endrod
 
| 43
 
|-
 
| damageindicator
 
| 44
 
|-
 
| sweepattack
 
| 45
 
|-
 
| fallingdust
 
| 46
 
|-
 
| totem
 
| 47
 
|-
 
| spit
 
| 48
 
 
  |}
 
  |}
  
==== Join Game ====
+
==== Keep Alive (clientbound) ====
 +
 
 +
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
  
See [[Protocol Encryption]] for information on logging in.
+
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,281: Line 2,503:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x25
+
  |rowspan="1"| 0x21
  |rowspan="7"| Play
+
  |rowspan="1"| Play
  |rowspan="7"| Client
+
  |rowspan="1"| Client
  | Entity ID
+
  | Keep Alive ID
  | Int
+
  | Long
| 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.
 
|-
 
| 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 Enum (16)
 
| 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}}.  For servers in development, this should almost always be false.
 
 
  |}
 
  |}
  
==== Map ====
+
==== 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)}}
  
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
+
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,321: Line 2,523:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="13"| 0x26
+
  |rowspan="10"| 0x22
  |rowspan="13"| Play
+
  |rowspan="10"| Play
  |rowspan="13"| Client
+
  |rowspan="10"| Client
  |colspan="2"| Item Damage
+
  | Chunk X
  |colspan="2"| VarInt
+
  | Int
  | The damage value (map ID) of the map being modified
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  |colspan="2"| Scale
+
  | Chunk Z
  |colspan="2"| Byte
+
  | Int
  | From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
|-
 
|colspan="2"| Tracking Position
 
|colspan="2"| Boolean
 
| Specifies whether the icons are shown
 
|-
 
|colspan="2"| Icon Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  | Full chunk
  | Direction And Type
+
| Boolean
  |rowspan="3"| Array
+
  | See [[Chunk Format#Full chunk|Chunk Format]]
  | Byte
+
  |-
  | 0xF0 = Type, 0x0F = Direction
+
| 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).
 
  |-
 
  |-
  | X
+
  | Heightmaps
  | Byte
+
  | [[NBT]]
  |  
+
  | Compound containing one long array named <code>MOTION_BLOCKING</code>, which is a heightmap for the highest solid block at each position in the chunk (as a compacted long array with 256 entries at 9 bits per entry totaling 36 longs). The Notchian server also adds a <code>WORLD_SURFACE</code> long array, the purpose of which is unknown, but it's not required for the chunk to be accepted.
 
  |-
 
  |-
  | Z
+
  | Biomes
  | Byte
+
  | Optional array of Integer
  |  
+
  | 1024 biome IDs, ordered by x then z then y, in 4&times;4&times;4 blocks.  Not present if full chunk is false.
 
  |-  
 
  |-  
  |colspan="2"| Columns
+
  | Size
  |colspan="2"| Byte
+
  | VarInt
  | Number of columns updated
+
  | Size of Data in bytes
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | Data
  |colspan="2"| Optional Byte
+
  | Byte array
  | Only if Columns is more than 0; number of rows updated
+
  | See [[Chunk Format#Data structure|data structure]] in Chunk Format
 
  |-
 
  |-
  |colspan="2"| X
+
  | Number of block entities
  |colspan="2"| Optional Byte
+
  | VarInt
  | Only if Columns is more than 0; x offset of the westernmost column
+
  | Number of elements in the following array
 
  |-
 
  |-
  |colspan="2"| Z
+
  | Block entities
  |colspan="2"| Optional Byte
+
  | Array of [[NBT|NBT Tag]]
  | Only if Columns is more than 0; z offset of the northernmost row
+
  | All block entities in the chunk. Use the x, y, and z tags in the NBT to determine their positions.
  |-
 
|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}}
 
 
  |}
 
  |}
  
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
+
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.
  
Types are based off of rows and columns in <code>map_icons.png</code>:
+
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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Icon type
+
  |rowspan="4"| 0x23
  ! Result
+
|rowspan="4"| Play
  |-
+
  |rowspan="4"| Client
  | 0
+
  | Effect ID
  | White arrow (players)
+
  | Int
 +
  | The ID of the effect, see below
 
  |-
 
  |-
  | 1
+
  | Location
  | Green arrow (item frames)
+
  | Position
 +
| The location of the effect
 
  |-
 
  |-
  | 2
+
  | Data
  | Red arrow
+
  | Int
 +
| Extra data for certain effects, see below
 
  |-
 
  |-
  | 3
+
  | Disable Relative Volume
  | Blue arrow
+
  | Boolean
 +
| See above
 +
|}
 +
 
 +
Effect IDs:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Name
 +
! Data
 
  |-
 
  |-
  | 4
+
  !colspan="3"| Sound
| White cross
 
 
  |-
 
  |-
  | 5
+
  | 1000
  | Red pointer
+
| Dispenser dispenses
 +
  |  
 
  |-
 
  |-
  | 6
+
  | 1001
  | White circle (off-map players)
+
| Dispenser fails to dispense
 +
  |  
 
  |-
 
  |-
  | 7
+
  | 1002
  | Small white circle (far-off-map players)
+
| Dispenser shoots
 +
  |  
 
  |-
 
  |-
  | 8
+
  | 1003
  | Mansion
+
| Ender eye launched
 +
  |  
 
  |-
 
  |-
  | 9
+
  | 1004
  | Temple
+
| Firework shot
 +
  |  
 
  |-
 
  |-
  | 10-15
+
  | 1005
  | Unused (blue square)
+
  | Iron door opened
  |}
+
  |  
 
 
==== Entity ====
 
 
 
This packet may be used to initialize an entity.
 
 
 
For player entities, either this packet or any move/look packet is sent every game tick. So the meaning of this packet is basically that the entity did not move/look since the last such packet.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x27
+
  | 1006
|rowspan="1"| Play
+
  | Wooden door opened
|rowspan="1"| Client
 
| Entity ID
 
  | VarInt
 
 
  |  
 
  |  
|}
 
 
==== Entity Relative Move ====
 
 
This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Entity Teleport|Entity Teleport]] should be sent instead.
 
 
This packet allows at most 8 blocks movement in any direction, because short range is from -32768 to 32767. And <code>32768 / (128 * 32)</code> = 8.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x28
+
  | 1007
|rowspan="5"| Play
+
  | Wooden trapdoor opened
|rowspan="5"| Client
 
| Entity ID
 
  | VarInt
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Delta X
+
  | 1008
  | Short
+
  | Fence gate opened
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
  |  
 
  |-
 
  |-
  | Delta Y
+
  | 1009
  | Short
+
  | Fire extinguished
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
  |  
 
  |-
 
  |-
  | Delta Z
+
  | 1010
  | Short
+
  | Play record
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
+
  | Special case, see below for more info
 
  |-
 
  |-
  | On Ground
+
  | 1011
  | Boolean
+
  | Iron door closed
 
  |  
 
  |  
|}
 
 
==== Entity Look And Relative Move ====
 
 
This packet is sent by the server when an entity rotates and moves. Since a short range is limited from -32768 to 32767, and movement is offset of fixed-point numbers, this packet allows at most 8 blocks movement in any direction. (<code>-32768 / (32 * 128) == -8</code>)
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x29
+
  | 1012
|rowspan="7"| Play
+
  | Wooden door closed
|rowspan="7"| Client
 
| Entity ID
 
  | VarInt
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Delta X
+
  | 1013
  | Short
+
  | Wooden trapdoor closed
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
+
  |  
 
  |-
 
  |-
  | Delta Y
+
  | 1014
  | Short
+
  | Fence gate closed
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
+
  |  
 
  |-
 
  |-
  | Delta Z
+
  | 1015
  | Short
+
  | Ghast warns
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
+
  |  
 
  |-
 
  |-
  | Yaw
+
  | 1016
  | Angle
+
  | Ghast shoots
  | New angle, not a delta
+
  |  
 
  |-
 
  |-
  | Pitch
+
  | 1017
  | Angle
+
  | Enderdragon shoots
  | New angle, not a delta
+
  |  
 
  |-
 
  |-
  | On Ground
+
  | 1018
  | Boolean
+
  | Blaze shoots
 
  |  
 
  |  
|}
 
 
==== Entity Look ====
 
 
This packet is sent by the server when an entity rotates.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x2A
+
  | 1019
|rowspan="4"| Play
+
  | Zombie attacks wood door
|rowspan="4"| Client
 
| Entity ID
 
  | VarInt
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Yaw
+
  | 1020
  | Angle
+
  | Zombie attacks iron door
  | New angle, not a delta
+
  |  
 
  |-
 
  |-
  | Pitch
+
  | 1021
  | Angle
+
  | Zombie breaks wood door
  | New angle, not a delta
+
|
 +
|-
 +
| 1022
 +
| Wither breaks block
 +
  |
 
  |-
 
  |-
  | On Ground
+
  | 1023
  | Boolean
+
  | Wither spawned
 
  |  
 
  |  
|}
 
 
==== 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="5"| 0x2B
+
  | 1024
|rowspan="5"| Play
+
  | Wither shoots
|rowspan="5"| Client
+
  |
| X
 
  | Double
 
  | Absolute position (X coordinate)
 
 
  |-
 
  |-
  | Y
+
  | 1025
  | Double
+
  | Bat takes off
  | Absolute position (Y coordinate)
+
  |
 
  |-
 
  |-
  | Z
+
  | 1026
  | Double
+
  | Zombie infects
  | Absolute position (Z coordinate)
+
  |
 
  |-
 
  |-
  | Yaw
+
  | 1027
  | Float
+
  | Zombie villager converted
  | Absolute rotation on the vertical axis, in degrees
+
  |
 
  |-
 
  |-
  | Pitch
+
  | 1028
  | Float
+
  | Ender dragon death
  | Absolute rotation on the horizontal axis, in degrees
+
  |
  |}
+
  |-
 
+
  | 1029
==== Open Sign Editor ====
+
| Anvil destroyed
 
+
  |
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"
 
  ! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x2C
+
  | 1030
|rowspan="1"| Play
+
  | Anvil used
|rowspan="1"| Client
 
| Location
 
  | Position
 
 
  |  
 
  |  
|}
 
 
==== 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"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x2D
+
  | 1031
|rowspan="2"| Play
+
  | Anvil landed
|rowspan="2"| Client
 
| Window ID
 
  | Byte
 
 
  |
 
  |
 
  |-
 
  |-
  | Recipe
+
  | 1032
  | VarInt
+
  | Portal travel
  | A recipe ID
+
  |  
|}
 
 
 
==== 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"| 0x2E
+
  | 1033
|rowspan="3"| Play
+
  | Chorus flower grown
|rowspan="3"| Client
+
  |
| Flags
 
  | Byte
 
  | Bit field, see below
 
 
  |-
 
  |-
  | Flying Speed
+
  | 1034
  | Float
+
  | Chorus flower died
 
  |  
 
  |  
 
  |-
 
  |-
  | Field of View Modifier
+
  | 1035
  | Float
+
  | Brewing stand brewed
  | 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).
+
  |
|}
 
 
 
About the flags:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Field
+
  | 1036
  ! Bit
+
  | Iron trapdoor opened
 +
|
 
  |-
 
  |-
  | Invulnerable
+
  | 1037
  | 0x01
+
| Iron trapdoor closed
 +
  |
 
  |-
 
  |-
  | Flying
+
  | 1038
  | 0x02
+
| End portal created in overworld
 +
  |
 
  |-
 
  |-
  | Allow Flying
+
  | 1039
  | 0x04
+
| Phantom bites
 +
  |
 
  |-
 
  |-
  | Creative Mode (Instant Break)
+
  | 1040
  | 0x08
+
  | Zombie converts to drowned
  |}
+
  |
 
 
==== Combat Event ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="8"| 0x2F
+
  | 1041
|rowspan="8"| Play
+
  | Husk converts to zombie by drowning
|rowspan="8"| Client
+
  |
|colspan="2"| Event
 
  | VarInt Enum
 
  | Determines the layout of the remaining packet
 
 
  |-
 
  |-
  ! Event
+
  | 1042
  ! Field Name
+
  | Grindstone used
  !
+
  |
!
 
 
  |-
 
  |-
  | 0: enter combat
+
  | 1043
  | ''no fields''
+
  | Book page turned
| ''no fields''
+
  |
  |  
 
 
  |-
 
  |-
|rowspan="2"| 1: end combat
 
| Duration
 
| VarInt
 
|
 
 
  |-
 
  |-
  | Entity ID
+
  !colspan="3"| Particle
| Int
 
|
 
 
  |-
 
  |-
  |rowspan="3"| 2: entity dead
+
  | 1500
| Player ID
+
  | Composter composts
  | VarInt
+
  |
  |  
 
 
  |-
 
  |-
  | Entity ID
+
  | 1501
  | Int
+
  | Lava converts block (either water to stone, or removes existing blocks such as torches)
  |  
+
  |
 
  |-
 
  |-
  | Message
+
  | 1502
  | [[Chat]]
+
  | Redstone torch burns out
  |  
+
  |
  |}
+
  |-
 
+
| 1503
==== Player List Item ====
+
  | Ender eye placed
 
+
  |
Sent by the server to update the user list (<tab> in the client).
+
  |-
 
+
  | 2000
{| class="wikitable"
+
  | Spawns 10 smoke particles, e.g. from a fire
  ! Packet ID
+
  | Direction, see below
  ! State
 
  ! Bound To
 
  !colspan="4"| Field Name
 
  !colspan="3"| Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="19"| 0x30
+
  | 2001
|rowspan="19"| Play
+
  | Block break + block break sound
|rowspan="19"| Client
+
  | Block state, as an index into the global palette
|colspan="4"| Action
 
  |colspan="3"| VarInt
 
  | Determines the rest of the Player format after the UUID
 
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  | 2002
  |colspan="3"| VarInt
+
  | Splash potion. Particle effect + glass break sound.
  | Number of elements in the following array
+
  | [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
  |-
 
  |-
  |rowspan="17"| Player
+
  | 2003
|colspan="3"| UUID
+
  | Eye of Ender entity break animation — particles and sound
  |rowspan="17"| Array
 
|colspan="2"| UUID
 
 
  |  
 
  |  
 
  |-
 
  |-
  ! Action
+
  | 2004
!colspan="2"| Field Name
+
  | Mob spawn particle effect: smoke + flames
!colspan="2"|  
 
!
 
  |-
 
|rowspan="10"| 0: add player
 
|colspan="2"| Name
 
|colspan="2"| String (16)
 
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | 2005
  |colspan="2"| VarInt
+
| Bonemeal particles
  | Number of elements in the following array
+
| How many particles to spawn (if set to 0, 15 are spawned)
 +
  |-
 +
| 2006
 +
| Dragon breath
 +
  |
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | 2007
| Name
+
  | Instant splash potion
|rowspan="4"| Array
+
  | [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
  | String (32767)
 
  |  
 
 
  |-
 
  |-
  | Value
+
  | 2008
  | String (32767)
+
  | Ender dragon destroys block
|
+
  |
|-
 
| Is Signed
 
| Boolean
 
  |  
 
 
  |-
 
  |-
  | Signature
+
  | 2009
  | Optional String (32767)
+
  | Wet sponge vaporizes in nether
  | Only if Is Signed is true
+
  |
 
  |-
 
  |-
  |colspan="2"| Gamemode
+
  | 3000
  |colspan="2"| VarInt
+
  | End gateway spawn
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Ping
+
  | 3001
  |colspan="2"| VarInt
+
| Enderdragon growl
  | Measured in milliseconds
+
|
 +
  |}
 +
 
 +
Smoke directions:
 +
 
 +
{| class="wikitable"
 +
  ! ID
 +
! Direction
 
  |-
 
  |-
  |colspan="2"| Has Display Name
+
  | 0
|colspan="2"| Boolean
+
  | South-East
  |  
 
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | 1
|colspan="2"| Optional [[Chat]]
+
  | South
  | Only if Has Display Name is true
 
 
  |-
 
  |-
  | 1: update gamemode
+
  | 2
  |colspan="2"| Gamemode
+
  | South-West
  |colspan="2"| VarInt
+
|-
  |  
+
  | 3
  |-  
+
  | East
  | 2: update latency
+
  |-
  |colspan="2"| Ping
+
  | 4
  |colspan="2"| VarInt
+
  | (Up or middle ?)
  | Measured in milliseconds
+
|-
 +
  | 5
 +
  | West
 
  |-
 
  |-
  |rowspan="2"| 3: update display name
+
  | 6
|colspan="2"| Has Display Name
+
  | North-East
|colspan="2"| Boolean
 
  |  
 
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | 7
|colspan="2"| Optional [[Chat]]
+
  | North
  | Only send if Has Display Name is true
 
 
  |-
 
  |-
  | 4: remove player
+
  | 8
|colspan="2"| ''no fields''
+
  | North-West
|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.
+
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.
  
Ping values correspond with icons in the following way:
+
==== Particle ====
* 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.
 
  
==== Face Player ====
+
Displays the named particle
 
 
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 2,864: Line 2,907:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="8"| 0x31
+
  |rowspan="11"| 0x24
  |rowspan="8"| Play
+
  |rowspan="11"| Play
  |rowspan="8"| Client
+
  |rowspan="11"| Client
 +
| Particle ID
 +
| Int
 +
| The particle ID listed in [[#Particle|the particle data type]].
 
  |-
 
  |-
  | Feet/eyes
+
  | Long Distance
  | VarInt enum
+
  | Boolean
  | Values are feet=0, eyes=1.  If set to eyes, aims using the head position; otherwise aims using the feet position.
+
  | If true, particle distance increases from 256 to 65536
 
  |-
 
  |-
  | Target x
+
  | X
 
  | Double
 
  | Double
  | x coordinate of the point to face towards
+
  | X position of the particle
 
  |-
 
  |-
  | Target y
+
  | Y
 
  | Double
 
  | Double
  | y coordinate of the point to face towards
+
  | Y position of the particle
 
  |-
 
  |-
  | Target z
+
  | Z
 
  | Double
 
  | Double
  | z coordinate of the point to face towards
+
  | 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()
 
  |-
 
  |-
  | Is entity
+
  | Particle Data
  | Boolean
+
  | Float
  | If true, additional information about an entity is provided.
+
  | The data of each particle
 
  |-
 
  |-
  | Entity ID
+
  | Particle Count
  | Optional VarInt
+
  | Int
  | Only if is entity is true &mdash; the entity to face towards
+
  | The number of particles to create
 
  |-
 
  |-
  | Entity feet/eyes
+
  | Data
  | Optional VarInt enum
+
  | Varies
  | Whether to look at the entity's eyes or feet.  Same values and meanings as before, just for the entity's head/feet.
+
  | The variable data listed in [[#Particle|the particle data type]].
 
  |}
 
  |}
  
If the entity given by entity ID cannot be found, this packet should be treated as if is entity was false.
+
==== Update Light ====
  
==== Player Position And Look (clientbound) ====
+
Updates light levels for a chunk.
 
 
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 2,915: Line 2,963:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x32
+
  |rowspan="10"| 0x25
  |rowspan="7"| Play
+
  |rowspan="10"| Play
  |rowspan="7"| Client
+
  |rowspan="10"| Client
  | X
+
  |colspan="2"| Chunk X
  | Double
+
  |colspan="2"| VarInt
  | Absolute or relative position, depending on Flags
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | Y
+
  |colspan="2"| Chunk Z
  | Double
+
  |colspan="2"| VarInt
  | Absolute or relative position, depending on Flags
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | Z
+
  |colspan="2"| Sky Light Mask
  | Double
+
  |colspan="2"| VarInt
  | Absolute or relative position, depending on Flags
+
  | 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)
 
  |-
 
  |-
  | Yaw
+
  |colspan="2"| Block Light Mask
  | Float
+
  |colspan="2"| VarInt
  | Absolute or relative rotation on the X axis, in degrees
+
  | Mask containing 18 bits, with the same order as sky light
 
  |-
 
  |-
  | Pitch
+
  |colspan="2"| Empty Sky Light Mask
  | Float
+
  |colspan="2"| VarInt
  | Absolute or relative rotation on the Y axis, in degrees
+
  | 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.
 
  |-
 
  |-
  | Flags
+
  |colspan="2"| Empty Block Light Mask
  | Byte
+
  |colspan="2"| VarInt
  | Bit field, see below
+
  | 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.
 
  |-
 
  |-
  | Teleport ID
+
  |rowspan="2"| Sky Light arrays
 +
| Length
 +
|rowspan="2"| Array
 
  | VarInt
 
  | VarInt
  | Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
+
  | Length of the following array in bytes (always 2048)
  |}
+
  |-
 
+
| Sky Light array
About the Flags field:
+
| Array of 2048 bytes
 
+
  | There is 1 array for each bit set to true in the sky light mask, starting with the lowest value.  Half a byte per light value.
  <Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
+
|-
 
+
|rowspan="2"| Block Light arrays
{| class="wikitable"
+
  | Length
  |-
+
  |rowspan="2"| Array
! Field
+
  | VarInt
! Bit
+
  | Length of the following array in bytes (always 2048)
  |-
 
  | X
 
  | 0x01
 
 
  |-
 
  |-
  | Y
+
  | Block Light array
  | 0x02
+
  | Array of 2048 bytes
  |-
+
  | There is 1 array for each bit set to true in the block light mask, starting with the lowest value. Half a byte per light value.
| Z
 
| 0x04
 
|-
 
  | Y_ROT
 
| 0x08
 
|-
 
| X_ROT
 
| 0x10
 
 
  |}
 
  |}
  
==== Use Bed ====
+
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.
  
This packet tells that a player goes to bed.
+
==== Join Game ====
  
The client with the matching Entity ID will go into bed mode.
+
See [[Protocol Encryption]] for information on logging in.
 
 
This Packet is sent to all nearby players including the one sent to bed.
 
 
 
Any packets sent with a location not currently occupied by a bed will be ignored by clients.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,994: Line 3,029:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x33
+
  |rowspan="9"| 0x26
  |rowspan="2"| Play
+
  |rowspan="9"| Play
  |rowspan="2"| Client
+
  |rowspan="9"| Client
 
  | Entity ID
 
  | Entity ID
  | VarInt
+
  | Int
  | Sleeping player's EID
+
  | 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.
 
  |-
 
  |-
  | Location
+
  | Hashed seed
  | Position
+
  | Long
  | Block location of the head part of the bed
+
  | First 8 bytes of the SHA-256 hash of the world's seed.
  |}
+
  |-
 
+
| Max Players
==== Unlock Recipes ====
+
  | Unsigned Byte
 
+
  | Was once used by the client to draw the player list, but now is ignored
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="8"| 0x34
+
  | Level Type
  |rowspan="8"| Play
+
  | String Enum (16)
  |rowspan="8"| Client
+
  | default, flat, largeBiomes, amplified, customized, buffet, default_1_1
 
  |-
 
  |-
  | Action
+
  | View Distance
 
  | VarInt
 
  | VarInt
  | 0: init, 1: add, 2: remove
+
  | Render distance (2-32)
 
  |-
 
  |-
  | Crafting Book Open
+
  | Reduced Debug Info
 
  | Boolean
 
  | Boolean
  | If true, then the crafting book will be open when the player opens its inventory.
+
  | If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}.  For servers in development, this should almost always be false.
 
  |-
 
  |-
  | Filtering Craftable
+
  | Enable respawn screen
 
  | Boolean
 
  | Boolean
  | If true, then the filtering option is active when the players opens its inventory.
+
  | Set to false when the doImmediateRespawn gamerule is true
|-
 
| Array size 1
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Recipe IDs
 
| Array of VarInt
 
|
 
|-
 
| Array size 2
 
| Optional VarInt
 
| Number of elements in the following array, only present if mode is 0 (init)
 
|-
 
| Recipe IDs
 
| Optional Array of VarInt, only present if mode is 0 (init)
 
|
 
 
  |}
 
  |}
Action:
 
* 0 (init) = All the recipes in the list 2 will added to the recipe book. All the recipes in list 1 will be tagged as displayed, recipes that aren't tagged will be shown in the notification. VERIFY LIST ORDER?
 
* 1 (add) = All the recipes in the list are added and their icon will be shown in the notification.
 
* 2 (remove) = Remove all the recipes in the list. This allows them to re-displayed when they are readded.
 
  
Recipe ID:
+
==== Map Data ====
These are hardcoded values in the client and server, all the recipe json files will be loaded in a specific order (alphabetical, like sounds) and internal ids will be assigned in that order. There are also inbuilt recipes like fireworks, banners, etc., these are the first recipes to have their id assigned. Due the fact that the recipes are loaded in a specific order will the ids very likely change when recipes get added. [https://twitter.com/dinnerbone/status/856505341479145472 Custom recipes are scheduled for Minecraft 1.13], so most likely will things change a bit in that version.
 
  
==== Destroy Entities ====
+
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
 
 
Sent by the server when a list of entities is to be destroyed on the client.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,064: Line 3,077:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x35
+
  |rowspan="17"| 0x27
  |rowspan="2"| Play
+
  |rowspan="17"| Play
  |rowspan="2"| Client
+
  |rowspan="17"| Client
  | Count
+
|colspan="2"| Map ID
  | VarInt
+
|colspan="2"| VarInt
 +
| Map ID of the map being modified
 +
|-
 +
|colspan="2"| Scale
 +
|colspan="2"| Byte
 +
| From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
 +
|-
 +
|colspan="2"| Tracking Position
 +
|colspan="2"| Boolean
 +
| Specifies whether player and item frame icons are shown
 +
|-
 +
|colspan="2"| Locked
 +
|colspan="2"| Boolean
 +
| True if the map has been locked in a cartography table
 +
|-
 +
  |colspan="2"| Icon Count
 +
  |colspan="2"| VarInt
 
  | Number of elements in the following array
 
  | Number of elements in the following array
 
  |-
 
  |-
  | Entity IDs
+
  |rowspan="6"| Icon
| Array of VarInt
+
  | Type
  | The list of entities of destroy
+
  |rowspan="6"| Array
  |}
+
  | VarInt enum
 
+
  | See below
==== Remove Entity Effect ====
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x36
+
  | X
|rowspan="2"| Play
+
  | Byte
|rowspan="2"| Client
+
  | Map coordinates: -128 for furthest left, +127 for furthest right
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Effect ID
+
  | Z
 
  | Byte
 
  | Byte
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | Map coordinates: -128 for highest, +127 for lowest
|}
 
 
 
==== Resource Pack Send ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x37
+
  | Direction
  |rowspan="2"| Play
+
| Byte
  |rowspan="2"| Client
+
| 0-15
  | URL
+
|-
  | String (32767)
+
| Has Display Name
  | The URL to the resource pack.
+
| 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
 
  |-
 
  |-
  | Hash
+
  |colspan="2"| Data
  | String (40)
+
  |colspan="2"| Optional Array of Unsigned Byte
  | 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
+
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
  |}
 
  |}
  
==== Respawn ====
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
  
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.
+
Types are based off of rows and columns in <code>map_icons.png</code>:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x38
+
  ! Icon type
  |rowspan="4"| Play
+
  ! Result
|rowspan="4"| Client
 
| Dimension
 
| Int Enum
 
| -1: The Nether, 0: The Overworld, 1: The End
 
 
  |-
 
  |-
  | Difficulty
+
  | 0
  | Unsigned Byte
+
  | White arrow (players)
  | 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
+
|-
 +
  | 1
 +
| Green arrow (item frames)
 +
|-
 +
| 2
 +
| Red arrow
 
  |-
 
  |-
  | Gamemode
+
  | 3
  | Unsigned Byte
+
  | Blue arrow
| 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
 
 
  |-
 
  |-
  | Level Type
+
  | 4
  | String (16)
+
  | White cross
| Same as [[#Join Game|Join Game]]
 
|}
 
 
 
{{Warning2|Avoid changing player's dimension to same dimension they were already in unless they are dead. If you change the dimension to one they are already in, weird bugs can occur, such as the player being unable to attack other players in new world (until they die and respawn).
 
 
 
If you must respawn a player in the same dimension without killing them, send two respawn packets, one to a different world and then another to the world you want. You do not need to complete the first respawn; it only matters that you send two packets.}}
 
 
 
==== Entity Head Look ====
 
 
 
Changes the direction an entity's head is facing.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x39
+
  | 5
|rowspan="2"| Play
+
  | Red pointer
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
  |  
 
 
  |-
 
  |-
  | Head Yaw
+
  | 6
  | Angle
+
  | White circle (off-map players)
  | New angle, not a delta
+
  |-
  |}
+
  | 7
 
+
| Small white circle (far-off-map players)
==== Select Advancement Tab ====
+
|-
 
+
| 8
Sent by the server to indicate that the client should switch advancement tab. Sent either when the client switches tab in the GUI or when an advancement in another tab is made.
+
| Mansion
 
+
  |-
{| class="wikitable"
+
  | 9
  ! Packet ID
+
  | Temple
  ! State
+
  |-
  ! Bound To
+
  | 10
  ! Field Name
+
  | White Banner
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  | 11
|rowspan="2"| Play
+
  | Orange Banner
|rowspan="2"| Client
 
| Has id
 
| Boolean
 
  | Indicates if the next field is present
 
 
  |-
 
  |-
  | Optional Identifier
+
  | 12
  | String (32767)
+
  | Magenta Banner
| See below
 
|}
 
 
 
The Identifier can be one of the following:
 
 
 
{| class="wikitable"
 
! Optional Identifier
 
 
  |-
 
  |-
  | minecraft:story/root
+
  | 13
 +
| Light Blue Banner
 
  |-
 
  |-
  | minecraft:nether/root
+
  | 14
 +
| Yellow Banner
 
  |-
 
  |-
  | minecraft:end/root
+
  | 15
 +
| Lime Banner
 
  |-
 
  |-
  | minecraft:adventure/root
+
  | 16
 +
| Pink Banner
 
  |-
 
  |-
  | minecraft:husbandry/root
+
  | 17
  |}
+
  | Gray Banner
 
+
|-
If no or an invalid identifier is sent, the client will switch to the first tab in the GUI.
+
| 18
 
+
| Light Gray Banner
==== World Border ====  
+
|-
 +
| 19
 +
| Cyan Banner
 +
|-
 +
| 20
 +
| Purple Banner
 +
|-
 +
| 21
 +
| Blue Banner
 +
|-
 +
| 22
 +
| Brown Banner
 +
|-
 +
| 23
 +
| Green Banner
 +
|-
 +
| 24
 +
| Red Banner
 +
|-
 +
| 25
 +
| Black Banner
 +
|-
 +
| 26
 +
| Treasure marker
 +
|}
 +
 
 +
==== Trade List ====
 +
 
 +
The list of trades a villager NPC is offering.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,233: Line 3,255:
 
  ! Bound To
 
  ! Bound To
 
  !colspan="2"| Field Name
 
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="18"| 0x3B
+
  |rowspan="18"| 0x28
 
  |rowspan="18"| Play
 
  |rowspan="18"| Play
 
  |rowspan="18"| Client
 
  |rowspan="18"| Client
|colspan="2"| Action
 
| VarInt Enum
 
| Determines the format of the rest of the packet
 
 
  |-
 
  |-
  ! Action
+
  | colspan="2" | Window ID
  ! Field Name
+
  | colspan="2" | VarInt
  !
+
  | The ID of the window that is open; this is an int rather than a byte.
!
 
 
  |-
 
  |-
  | 0: set size
+
  | colspan="2" | Size
  | Diameter
+
  | colspan="2" | Byte
| Double
+
  | The number of trades in the following array
  | Length of a single side of the world border, in meters
 
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
  | rowspan="11" | Trades
  | Old Diameter
+
| Input item 1
  | Double
+
  | rowspan="11" | Array
  | Current length of a single side of the world border, in meters
+
  | [[Slot]]
 +
  | The first item the villager is buying
 
  |-
 
  |-
  | New Diameter
+
  | Output item
  | Double
+
  | [[Slot]]
  | Target length of a single side of the world border, in meters
+
  | The item the villager is selling
 
  |-
 
  |-
  | Speed
+
  | Has second item
  | VarLong
+
  | Boolean
  | 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.
+
  | Whether there is a second item
 
  |-
 
  |-
  |rowspan="2"| 2: set center
+
  | Input item 2
| X
+
  | Optional [[Slot]]
  | Double
+
  | The second item the villager is buying; only present if they have a second item.
  |  
 
 
  |-
 
  |-
  | Z
+
  | Trade disabled
  | Double
+
  | Boolean
  |  
+
  | True if the trade is disabled; false if the trade is enabled.
 
  |-
 
  |-
  |rowspan="8"| 3: initialize
+
  | Number of trade uses
| X
+
  | Integer
  | Double
+
  | Number of times the trade has been used so far
  |  
 
 
  |-
 
  |-
  | Z
+
  | Maximum number of trade uses
  | Double
+
  | Integer
  |  
+
  | Number of times this trade can be used
 
  |-
 
  |-
  | Old Diameter
+
  | XP
  | Double
+
  | Integer
  | Current length of a single side of the world border, in meters
+
  |
 
  |-
 
  |-
  | New Diameter
+
  | Special Price
  | Double
+
  | Integer
  | Target length of a single side of the world border, in meters
+
  |
 
  |-
 
  |-
  | Speed
+
  | Price Multiplier
  | VarLong
+
  | Float
  | 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
+
  | Demand
  | VarInt
+
  | Integer
  | Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
+
  |
 
  |-
 
  |-
  | Warning Time
+
  |colspan="2"| Villager level
  | VarInt
+
  |colspan="2"| VarInt
  | In seconds as set by <code>/worldborder warning time</code>
+
  | 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
 
  |-
 
  |-
  | Warning Blocks
+
  |colspan="2"| Experience
  | VarInt
+
  |colspan="2"| VarInt
  | In meters
+
  | Total experience for this villager (always 0 for the wandering trader)
 
  |-
 
  |-
  |rowspan="1"| 4: set warning time
+
  |colspan="2"| Is regular villager
  | Warning Time
+
  |colspan="2"| Boolean
  | VarInt
+
  | True if this is a regular villager; false for the wandering trader. When false, hides the villager level and some other GUI elements.
  | In seconds as set by <code>/worldborder warning time</code>
 
 
  |-
 
  |-
  |rowspan="1"| 5: set warning blocks
+
  |colspan="2"| Can restock
  | Warning Blocks
+
  |colspan="2"| Boolean
  | VarInt
+
  | 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.
  | In meters
 
 
  |}
 
  |}
  
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:
+
[[File:1.14-merchant-slots.png|thumb|The merchant UI, for reference]]
 +
{{-}}
  
<syntaxhighlight lang="java">
+
==== Entity Position ====
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 
if (playerDistance < distance) {
 
    warning = 1.0 - playerDistance / distance;
 
} else {
 
    warning = 0.0;
 
}
 
</syntaxhighlight>
 
  
==== Camera ====
+
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.
  
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
+
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 player's camera will move with the entity and look where it is looking. The entity is often another player, but can be any type of entity.  The player is unable to move this entity (move packets will act as if they are coming from the other entity).
 
 
 
If the given entity is not loaded by the player, this packet is ignored.  To return control to the player, send this packet with their entity ID.
 
 
 
The Notchian server resets this (sends it back to the default entity) whenever the spectated entity is killed or the player sneaks, but only if they were spectating an entity. It also sends this packet whenever the player switches out of spectator mode (even if they weren't spectating an entity).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,348: Line 3,351:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x3C
+
  |rowspan="5"| 0x29
  |rowspan="1"| Play
+
  |rowspan="5"| Play
  |rowspan="1"| Client
+
  |rowspan="5"| Client
  | Camera ID
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  | ID of the entity to set the client's camera to
+
  |  
 +
|-
 +
| 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
 +
|
 
  |}
 
  |}
  
The notchian also loads certain shaders for given entities:
+
==== Entity Position and Rotation ====
  
* Creeper &rarr; <code>shaders/post/creeper.json</code>
+
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>)
* Spider (and cave spider) &rarr; <code>shaders/post/spider.json</code>
 
* Enderman &rarr; <code>shaders/post/invert.json</code>
 
* Anything else &rarr; the current shader is unloaded
 
 
 
==== Held Item Change (clientbound) ====
 
 
 
Sent to change the player's slot selection.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,375: Line 3,387:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x3D
+
  |rowspan="7"| 0x2A
  |rowspan="1"| Play
+
  |rowspan="7"| Play
  |rowspan="1"| Client
+
  |rowspan="7"| Client
  | Slot
+
  | Entity ID
  | Byte
+
  | VarInt
  | The slot which the player has selected (0–8)
+
  |  
 +
|-
 +
| Delta X
 +
| Short
 +
| Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
 +
|-
 +
| Delta Y
 +
| Short
 +
| Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
 +
|-
 +
| Delta Z
 +
| Short
 +
| Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 +
|-
 +
| Yaw
 +
| Angle
 +
| New angle, not a delta
 +
|-
 +
| Pitch
 +
| Angle
 +
| New angle, not a delta
 +
|-
 +
| On Ground
 +
| Boolean
 +
|
 
  |}
 
  |}
  
==== Display Scoreboard ====
+
==== Entity Rotation ====
  
This is sent to the client when it should display a scoreboard.
+
This packet is sent by the server when an entity rotates.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,395: Line 3,431:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3E
+
  |rowspan="4"| 0x2B
  |rowspan="2"| Play
+
  |rowspan="4"| Play
  |rowspan="2"| Client
+
  |rowspan="4"| Client
  | Position
+
  | Entity ID
  | Byte
+
  | VarInt
  | The position of the scoreboard. 0: list, 1: sidebar, 2: below name, 3 - 18: team specific sidebar, indexed as 3 + team color.
+
  |  
 
  |-
 
  |-
  | Score Name
+
  | Yaw
  | String (16)
+
  | Angle
  | The unique name for the scoreboard to be displayed.
+
| New angle, not a delta
 +
|-
 +
| Pitch
 +
| Angle
 +
| New angle, not a delta
 +
|-
 +
| On Ground
 +
| Boolean
 +
  |  
 
  |}
 
  |}
  
==== Entity Metadata ====
+
==== Entity Movement ====
 +
 
 +
This packet may be used to initialize an entity.
  
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.
+
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,419: Line 3,465:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3F
+
  |rowspan="1"| 0x2C
  |rowspan="2"| Play
+
  |rowspan="1"| Play
  |rowspan="2"| Client
+
  |rowspan="1"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
|
 
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Entity Metadata]]
 
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Attach Entity ====
+
==== Vehicle Move (clientbound) ====
  
This packet is sent when an entity has been {{Minecraft Wiki|Lead|leashed}} to another entity.
+
Note that all fields use absolute positioning and do not allow for relative positioning.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,443: Line 3,485:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x40
+
  |rowspan="5"| 0x2D
  |rowspan="2"| Play
+
  |rowspan="5"| Play
  |rowspan="2"| Client
+
  |rowspan="5"| Client
  | Attached Entity ID
+
  | X
  | Int
+
  | Double
  | Attached entity's EID
+
  | Absolute position (X coordinate)
 +
|-
 +
| Y
 +
| Double
 +
| Absolute position (Y coordinate)
 +
|-
 +
| Z
 +
| Double
 +
| Absolute position (Z coordinate)
 
  |-
 
  |-
  | Holding Entity ID
+
  | Yaw
  | Int
+
  | Float
  | ID of the entity holding the lead. Set to -1 to detach.
+
  | Absolute rotation on the vertical axis, in degrees
  |}
+
|-
 
+
| Pitch
==== Entity Velocity ====
+
| Float
 
+
| Absolute rotation on the horizontal axis, in degrees
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).
+
  |}
 +
 
 +
==== Open Book ====
 +
 
 +
Sent when a player right clicks with a signed book. This tells the client to open the book GUI.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,467: Line 3,521:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x41
+
  |rowspan="1"| 0x2E
  |rowspan="4"| Play
+
  |rowspan="1"| Play
  |rowspan="4"| Client
+
  |rowspan="1"| Client
  | Entity ID
+
  | Hand
  | VarInt
+
  | VarInt enum
  |  
+
  | 0: Main hand, 1: Off hand
|-
 
| Velocity X
 
| Short
 
| Velocity on the X axis
 
|-
 
| Velocity Y
 
| Short
 
| Velocity on the Y axis
 
|-
 
| Velocity Z
 
| Short
 
| Velocity on the Z axis
 
 
  |}
 
  |}
  
==== Entity Equipment ====
+
==== Open Window ====
 +
 
 +
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.  For horses, use [[#Open Horse Window|Open Horse Window]].
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,497: Line 3,541:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x42
+
  |rowspan="3"| 0x2F
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
 
  |rowspan="3"| Client
 
  |rowspan="3"| Client
  | Entity ID
+
  | Window ID
 
  | VarInt
 
  | VarInt
  | Entity's EID
+
  | A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
  |-
 
  |-
  | Slot
+
  | Window Type
  | VarInt Enum
+
  | VarInt
  | Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
+
  | The window type to use for display. Contained in the <code>minecraft:menu</code> regisry; see [[Inventory]] for the different values.
 
  |-
 
  |-
  | Item
+
  | Window Title
  | [[Slot Data|Slot]]
+
  | [[Chat]]
  |  
+
  | The title of the window
 
  |}
 
  |}
  
==== Set Experience ====
+
==== Open Sign Editor ====
  
Sent by the server when the client should change experience levels.
+
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,525: Line 3,569:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x43
+
  |rowspan="1"| 0x30
  |rowspan="3"| Play
+
  |rowspan="1"| Play
  |rowspan="3"| Client
+
  |rowspan="1"| Client
  | Experience bar
+
  | Location
| Float
+
  | Position
| Between 0 and 1
 
|-
 
| Level
 
  | VarInt
 
 
  |  
 
  |  
|-
 
| Total Experience
 
| VarInt
 
| See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
 
 
  |}
 
  |}
  
==== Update Health ====
+
==== Craft Recipe Response ====
  
Sent by the server to update/set the health of the player it is sent to.
+
Response to the serverbound packet ([[#Craft Recipe Request|Craft Recipe Request]]), with the same recipe ID. Appears to be used to notify the UI.
 
 
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,555: Line 3,589:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x44
+
  |rowspan="2"| 0x31
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Health
+
  | Window ID
  | Float
+
  | Byte
  | 0 or less = dead, 20 = full HP
+
  |
 
  |-
 
  |-
  | Food
+
  | Recipe
  | VarInt
+
  | Identifier
  | 0–20
+
  | A recipe ID
|-
 
| Food Saturation
 
| Float
 
| Seems to vary from 0.0 to 5.0 in integer increments
 
 
  |}
 
  |}
  
==== Scoreboard Objective ====
+
==== Player Abilities (clientbound) ====
  
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
+
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,583: Line 3,613:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x45
+
  |rowspan="3"| 0x32
  |rowspan="4"| Play
+
  |rowspan="3"| Play
  |rowspan="4"| Client
+
  |rowspan="3"| Client
  | Objective Name
+
  | Flags
| String (16)
 
| An unique name for the objective
 
|-
 
| Mode
 
 
  | Byte
 
  | Byte
  | 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
+
  | Bit field, see below
 
  |-
 
  |-
  | Objective Value
+
  | Flying Speed
  | Optional String (32)
+
  | Float
  | Only if mode is 0 or 2. The text to be displayed for the score
+
  | 0.05 by default
 
  |-
 
  |-
  | Type
+
  | Field of View Modifier
  | Optional String (16)
+
  | Float
  | Only if mode is 0 or 2. “integer” or “hearts”
+
  | 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.
 
  |}
 
  |}
  
==== Set Passengers ====
+
About the flags:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x46
+
! Field
  |rowspan="3"| Play
+
! Bit
  |rowspan="3"| Client
+
  |-
  | Entity ID
+
  | Invulnerable
  | VarInt
+
  | 0x01
  | Vehicle's EID
+
  |-
 +
  | Flying
 +
  | 0x02
 
  |-
 
  |-
  | Passenger Count
+
  | Allow Flying
  | VarInt
+
  | 0x04
| Number of elements in the following array
 
 
  |-
 
  |-
  | Passengers
+
  | Creative Mode (Instant Break)
  | Array of VarInt
+
  | 0x08
| EIDs of entity's passengers
 
 
  |}
 
  |}
  
==== Teams ====
+
==== Combat Event ====
  
Creates and updates teams.
+
Originally used for metadata for twitch streaming circa 1.8.  Now only used to display the game over screen (with enter combat and end combat completely ignored by the Notchain client)
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,641: Line 3,661:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="23"| 0x47
+
  |rowspan="8"| 0x33
  |rowspan="23"| Play
+
  |rowspan="8"| Play
  |rowspan="23"| Client
+
  |rowspan="8"| Client
  |colspan="2"| Team Name
+
  |colspan="2"| Event
  | String (16)
+
  | VarInt Enum
  | A unique name for the team. (Shared with scoreboard).
+
  | Determines the layout of the remaining packet
 
  |-
 
  |-
  |colspan="2"| Mode
+
  ! Event
  | Byte
+
  ! Field Name
  | Determines the layout of the remaining packet
+
  !
 +
!
 
  |-
 
  |-
  |rowspan="9"| 0: create team
+
  | 0: enter combat
  | Team Display Name
+
  | ''no fields''
  | String (32)
+
  | ''no fields''
 
  |  
 
  |  
 
  |-
 
  |-
  | Team Prefix
+
  |rowspan="2"| 1: end combat
  | String (16)
+
| Duration
  | Displayed before the names of players that are part of this team
+
  | VarInt
 +
  | Length of the combat in ticks.
 
  |-
 
  |-
  | Team Suffix
+
  | Entity ID
  | String (16)
+
  | Int
  | Displayed after 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.
 
  |-
 
  |-
  | Friendly Flags
+
  |rowspan="3"| 2: entity dead
  | Byte
+
  | Player ID
  | Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible players on same team
+
  | VarInt
 +
| Entity ID of the player that died (should match the client's entity ID).
 
  |-
 
  |-
  | Name Tag Visibility
+
  | Entity ID
  | String Enum (32)
+
  | Int
  | <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
+
  | The killing entity's ID, or -1 if there is no obvious killer.
 
  |-
 
  |-
  | Collision Rule
+
  | Message
  | String Enum (32)
+
  | [[Chat]]
  | <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
+
  | The death message
  |-
+
  |}
| Color
+
 
| Byte
+
==== Player Info ====
| For colors, the same [[Chat]] colors (0-15).  -1 indicates RESET/no color.
+
 
  |-
+
Sent by the server to update the user list (<tab> in the client).
  | Entity Count
+
 
  | VarInt
+
{| class="wikitable"
  | Number of elements in the following array
+
! Packet ID
 +
  ! State
 +
  ! Bound To
 +
  !colspan="4"| Field Name
 +
  !colspan="3"| Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Entities
+
  |rowspan="19"| 0x34
  | Array of String (40)
+
|rowspan="19"| Play
  | Identifiers for the entities in this team.  For players, this is their username; for other entities, it is their UUID.
+
  |rowspan="19"| Client
 +
|colspan="4"| Action
 +
|colspan="3"| VarInt
 +
  | Determines the rest of the Player format after the UUID
 
  |-
 
  |-
  | 1: remove team
+
  |colspan="4"| Number Of Players
  | ''no fields''
+
  |colspan="3"| VarInt
| ''no fields''
+
  | Number of elements in the following array
  |  
 
 
  |-
 
  |-
  |rowspan="7"| 2: update team info
+
  |rowspan="17"| Player
  | Team Display Name
+
|colspan="3"| UUID
  | String (32)
+
  |rowspan="17"| Array
 +
  |colspan="2"| UUID
 
  |  
 
  |  
 
  |-
 
  |-
  | Team Prefix
+
  ! Action
  | String (16)
+
!colspan="2"| Field Name
  | Displayed before the names of entities that are part of this team
+
  !colspan="2"|  
 +
  !
 
  |-
 
  |-
  | Team Suffix
+
  |rowspan="10"| 0: add player
  | String (16)
+
|colspan="2"| Name
  | Displayed after the names of entities that are part of this team
+
  |colspan="2"| String (16)
 +
  |  
 
  |-
 
  |-
  | Friendly Flags
+
  |colspan="2"| Number Of Properties
  | Byte
+
  |colspan="2"| VarInt
  | Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible entities on same team
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Name Tag Visibility
+
|rowspan="4"| Property
  | String Enum (32)
+
  | Name
  | <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
+
|rowspan="4"| Array
 +
  | String (32767)
 +
  |  
 +
|-
 +
| Value
 +
| String (32767)
 +
|
 +
|-
 +
| Is Signed
 +
| Boolean
 +
|
 
  |-
 
  |-
  | Collision Rule
+
  | Signature
  | String Enum (32)
+
  | Optional String (32767)
  | <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
+
  | Only if Is Signed is true
 
  |-
 
  |-
  | Color
+
  |colspan="2"| Gamemode
  | Byte
+
  |colspan="2"| VarInt
  | For colors, the same [[Chat]] colors (0-15).  -1 indicates RESET/no color.
+
  |  
 
  |-
 
  |-
  |rowspan="2"| 3: add players to team
+
  |colspan="2"| Ping
  | Entity Count
+
  |colspan="2"| VarInt
| VarInt
+
  | Measured in milliseconds
  | Number of elements in the following array
 
 
  |-
 
  |-
  | Entities
+
  |colspan="2"| Has Display Name
  | Array of String (40)
+
  |colspan="2"| Boolean
  | Identifiers for the entities added.  For players, this is their username; for other entities, it is their UUID.
+
  |  
 
  |-
 
  |-
  |rowspan="2"| 4: remove players from team
+
  |colspan="2"| Display Name
  | Entity Count
+
  |colspan="2"| Optional [[Chat]]
| VarInt
+
  | Only if Has Display Name is true
  | Number of elements in the following array
 
 
  |-
 
  |-
  | Entities
+
  | 1: update gamemode
  | Array of String (40)
+
|colspan="2"| Gamemode
  | Identifiers for the entities removed. For players, this is their username; for other entities, it is their UUID.
+
|colspan="2"| VarInt
|}
+
|
 +
|-
 +
| 2: update latency
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
| Measured in milliseconds
 +
|-
 +
|rowspan="2"| 3: update display name
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
|colspan="2"| Optional [[Chat]]
 +
| Only send if Has Display Name is true
 +
|-
 +
| 4: remove player
 +
|colspan="2"| ''no fields''
 +
|colspan="2"| ''no fields''
 +
  |  
 +
  |}
 +
 
 +
The Property field looks as in the response of [[Mojang API#UUID -> Profile + Skin/Cape]], except of course using the protocol format instead of JSON. That is, each player will usually have one property with Name “textures” and Value being a base64-encoded JSON string as documented at [[Mojang API#UUID -> Profile + Skin/Cape]]. An empty properties array is also acceptable, and will cause clients to display the player with one of the two default skins depending on UUID.
 +
 
 +
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.
  
==== Update Score ====
+
==== Face Player ====
  
This is sent to the client when it should update a scoreboard item.  
+
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,754: Line 3,825:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x48
+
  |rowspan="8"| 0x35
  |rowspan="4"| Play
+
  |rowspan="8"| Play
  |rowspan="4"| Client
+
  |rowspan="8"| Client
| Entity Name
 
| String (40)
 
| The entity whose score this is.  For players, this is their username; for other entities, it is their UUID.
 
 
  |-
 
  |-
  | Action
+
  | Feet/eyes
  | Byte
+
  | VarInt enum
  | 0 to create/update an item. 1 to remove an item.
+
  | Values are feet=0, eyes=1. If set to eyes, aims using the head position; otherwise aims using the feet position.
 
  |-
 
  |-
  | Objective Name
+
  | Target x
  | String (16)
+
  | Double
  | The name of the objective the score belongs to