Difference between revisions of "Protocol"

From wiki.vg
Jump to: navigation, search
(Added Xp seed to Enchanting.)
(Fix wrong begin/end raining values)
 
(371 intermediate revisions by 52 users not shown)
Line 1: Line 1:
{{Box|
+
{{Box
BORDER = #9999FF|
+
  |BORDER = #9999FF
BACKGROUND = #99CCFF|
+
  |BACKGROUND = #99CCFF
WIDTH = 100%|
+
  |WIDTH = 100%
ICON = |
+
  |ICON =  
HEADING = Heads up! |
+
  |HEADING = Heads up!
CONTENT =  
+
  |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''computer edition''' ([[Protocol version numbers|1.15.2, protocol 578]]). For the computer edition pre-releases, see [[Pre-release protocol]]. For Pocket Edition, see [[Pocket Edition Protocol Documentation]].
This article is about the protocol for the latest '''stable''' release of Minecraft computer edition. For the current pre-release protocol, see [[Pre-release protocol]].
 
 
}}
 
}}
  
This page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''. The protocol for Pocket Minecraft is substantially different, and is documented at [[Pocket Minecraft Protocol]].
+
This page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''.
  
If you're having trouble, check out the [[Protocol FAQ|FAQ]] or ask for help in the IRC channel ([irc://irc.freenode.net/mcdevs #mcdevs on irc.freenode.net]).
+
If you're having trouble, check out the [[Protocol FAQ|FAQ]] or ask for help in the IRC channel [ircs://chat.freenode.net:6697/mcdevs #mcdevs on chat.freenode.net] ([http://wiki.vg/MCDevs More Information]).
  
 
'''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, etc… you still need to provide attribution to #mcdevs if you copy any of the contents of this page for publication elsewhere.
 
'''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, etc… you still need to provide attribution to #mcdevs if you copy any of the contents of this page for publication elsewhere.
Line 19: Line 18:
 
== Definitions ==
 
== Definitions ==
  
The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] ([[#Handshaking|Handshaking]], 0x00, serverbound) and [[#Login Success|Login Success]] ([[#Login|Login]], 0x02, clientbound).
+
The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] and [[#Login Success|Login Success]].
  
 
=== Data types ===
 
=== Data types ===
  
<!-- Transcluded contents of Data Types article in here - go to that page if you want to edit it -->
+
{{:Data types}} <!-- Transcluded contents of Data types article in here go to that page if you want to edit it -->
 
 
{{:Data Types}}
 
  
 
=== Other definitions ===
 
=== Other definitions ===
Line 44: Line 41:
 
  |-
 
  |-
 
  | XYZ
 
  | XYZ
  | In this document, the axis names are the same as those shown in the debug screen (F3). Y points upwards, X points East, and Z points South.
+
  | In this document, the axis names are the same as those shown in the debug screen (F3). Y points upwards, X points east, and Z points south.
 +
|-
 +
| Meter
 +
| The meter is Minecraft's base unit of length, equal to the length of a vertex of a solid block. The term “block” may be used to mean “meter” or “cubic meter”.
 +
|-
 +
| Global palette
 +
| A table/dictionary/palette mapping nonnegative integers to block states. Block state IDs are created in a linear fashion based off of order of assignment.  One block state ID allocated for each unique block state for a block; if a block has multiple properties then the number of allocated states is the product of the number of values for each property.  A current list of properties and state ID ranges is found on [https://pokechu22.github.io/Burger/1.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.
 
  |-
 
  |-
  !colspan="2"| See also: [[Units of Measurement]]
+
  | Notchian
 +
| The official implementation of vanilla Minecraft as developed and released by Mojang.
 
  |}
 
  |}
  
Line 73: Line 79:
 
=== With compression ===
 
=== With compression ===
  
Once a [[#Set Compression|Set Compression]] packet is sent, [[wikipedia:Zlib|zlib]] compression is enabled for all following packets. The format of a packet changes slighty to include the size of the uncompressed packet.
+
Once a [[#Set Compression|Set Compression]] packet (with a non-negative threshold) is sent, [[wikipedia:Zlib|zlib]] compression is enabled for all following packets. The format of a packet changes slighty to include the size of the uncompressed packet.
  
 
{| class=wikitable
 
{| class=wikitable
Line 93: Line 99:
 
  |rowspan="2"| Yes
 
  |rowspan="2"| Yes
 
  | Packet ID
 
  | Packet ID
  | Varint
+
  | VarInt
 
  | zlib compressed packet ID (see the sections below)
 
  | zlib compressed packet ID (see the sections below)
 
  |-
 
  |-
Line 105: 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 [[#Set Compression|Set Compression]] packet, otherwise the client/server will disconnect.
+
If compressed, the uncompressed length of (Packet ID + Data) must be equal to or over the threshold set in the packet [[#Set Compression|Set Compression]], otherwise the receiving party will disconnect.
  
Compression can be disabled by sending a [[#Set Compression|Set Compression]] packet with a Threshold of -1.
+
Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all.
  
 
== Handshaking ==
 
== Handshaking ==
 +
 +
=== Clientbound ===
 +
 +
There are no clientbound packets in the Handshaking state, since the protocol immediately switches to a different state after the client sends the first packet.
  
 
=== Serverbound ===
 
=== Serverbound ===
Line 126: Line 136:
 
  |-
 
  |-
 
  |rowspan="4"| 0x00
 
  |rowspan="4"| 0x00
  |rowspan="4"| Handshake
+
  |rowspan="4"| Handshaking
 
  |rowspan="4"| Server
 
  |rowspan="4"| Server
 
  | Protocol Version
 
  | Protocol Version
 
  | VarInt
 
  | VarInt
  | See [[protocol version numbers]] (currently 47)
+
  | See [[protocol version numbers]] (currently 578 in Minecraft 1.15.2)
 
  |-
 
  |-
 
  | Server Address
 
  | Server Address
  | String
+
  | String (255)
  | hostname or IP, e.g. localhost or 127.0.0.1<!-- does this support IPv6? -->
+
  | Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. The Notchian server does not use this information. Note that SRV records are a complete redirect, e.g. if _minecraft._tcp.example.com points to mc.example.org, users connecting to example.com will provide mc.example.org as server address in addition to connecting to it.
 
  |-  
 
  |-  
 
  | Server Port
 
  | Server Port
 
  | Unsigned Short
 
  | Unsigned Short
  | default is 25565
+
  | Default is 25565.  The Notchian server does not use this information.
 
  |-
 
  |-
 
  | Next State
 
  | Next State
  | VarInt
+
  | VarInt Enum
 
  | 1 for [[#Status|status]], 2 for [[#Login|login]]
 
  | 1 for [[#Status|status]], 2 for [[#Login|login]]
 
  |}
 
  |}
  
== Play ==
+
==== Legacy Server List Ping ====
  
=== Clientbound ===
+
{{Warning|This packet uses a nonstandard format. It is never length-prefixed, and the packet ID is an Unsigned Byte instead of a VarInt.}}
  
==== Keep Alive ====
+
While not technically part of the current protocol, legacy clients may send this packet to initiate [[Server List Ping]], and modern servers should handle it correctly.
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 161: Line 169:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x00
+
  | 0xFE
  |rowspan="1"| Play
+
  | Handshaking
  |rowspan="1"| Client
+
  | Server
  | Keep Alive ID
+
  | Payload
  | VarInt
+
  | Unsigned Byte
  |  
+
  | always 1 (<code>0x01</code>)
 
  |}
 
  |}
  
==== Join Game ====
+
See [[Server List Ping#1.6]] for the details of the protocol that follows this packet.
 +
 
 +
== Play ==
 +
 
 +
=== Clientbound ===
 +
 
 +
==== Spawn Object ====
  
See [[Protocol Encryption]] for information on logging in.
+
Sent by the server when a vehicle or other object is created.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 181: Line 195:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x01
+
  |rowspan="12"| 0x00
  |rowspan="7"| Play
+
  |rowspan="12"| Play
  |rowspan="7"| Client
+
  |rowspan="12"| Client
 
  | Entity ID
 
  | Entity ID
  | Int
+
  | VarInt
  | The player's Entity ID (EID)
+
  | EID of the object
 
  |-
 
  |-
  | Gamemode
+
  | Object UUID
  | Unsigned Byte
+
  | UUID
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
+
  |  
 
  |-
 
  |-
  | Dimension
+
  | Type
  | Byte
+
  | VarInt
  | -1: Nether, 0: Overworld, 1: End
+
| The type of object (same as in [[#Spawn Mob|Spawn Mob]])
 +
  |-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Pitch
 +
| Angle
 +
|
 +
|-
 +
| Yaw
 +
| Angle
 +
|
 
  |-
 
  |-
  | Difficulty
+
  | Data
  | Unsigned Byte
+
  | Int
  | 0: peaceful, 1: easy, 2: normal, 3: hard
+
  | Meaning dependent on the value of the Type field, see [[Object Data]] for details.
 
  |-
 
  |-
  | Max Players
+
  | Velocity X
  | Unsigned Byte
+
  | Short
  | Used by the client to draw the player list
+
  |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).
 
  |-
 
  |-
  | Level Type
+
  | Velocity Y
  | String
+
  | Short
| default, flat, largeBiomes, amplified, default_1_1
 
 
  |-
 
  |-
  | Reduced Debug Info
+
  | Velocity Z
  | Boolean
+
  | Short
| If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}.
 
 
  |}
 
  |}
  
{{Warning|If the Dimension isn't valid then the client will crash}}
+
==== Spawn Experience Orb ====
  
==== Chat Message ====
+
Spawns one or more experience orbs.
 
 
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options. While Position 2 accepts json formatting it will not display, old style formatting works
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 227: Line 257:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x02
+
  |rowspan="5"| 0x01
  |rowspan="2"| Play
+
  |rowspan="5"| Play
  |rowspan="2"| Client
+
  |rowspan="5"| Client
  | JSON Data
+
  | Entity ID
  | [[Chat]]
+
  | VarInt
  | Limited to 32767 bytes
+
|
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
  |  
 
  |-
 
  |-
  | Position
+
  | Count
  | Byte
+
  | Short
  | 0: chat (chat box), 1: system message (chat box), 2: above action bar
+
  | The amount of experience this orb will reward once collected
 
  |}
 
  |}
  
{{Warning|Malformed JSON will disconnect the client}}
+
==== Spawn Global Entity ====
  
==== Time Update ====
+
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.
 
 
Time is based on ticks, where 20 ticks happen every second. There are 24000 ticks in a day, making Minecraft days exactly 20 minutes long.
 
 
 
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
 
 
 
The default SMP server increments the time by <code>20</code> every second.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 257: Line 293:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x03
+
  |rowspan="5"| 0x02
  |rowspan="2"| Play
+
  |rowspan="5"| Play
  |rowspan="2"| Client
+
  |rowspan="5"| Client
  | World Age
+
  | Entity ID
  | Long
+
  | VarInt
  | In ticks; not changed by server commands
+
| The EID of the thunderbolt
 +
|-
 +
| Type
 +
| Byte Enum
 +
| The global entity type, currently always 1 for thunderbolt
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
  |  
 
  |-
 
  |-
  | Time of day
+
  | Z
  | Long
+
  | Double
  | The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
+
  |  
 
  |}
 
  |}
  
==== Entity Equipment ====
+
==== Spawn Mob ====
 +
 
 +
Sent by the server when a mob entity is spawned.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 279: Line 329:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x04
+
  |rowspan="12"| 0x03
  |rowspan="3"| Play
+
  |rowspan="12"| Play
  |rowspan="3"| Client
+
  |rowspan="12"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Entity's EID
+
|
 +
|-
 +
  | Entity UUID
 +
| UUID
 +
|
 
  |-
 
  |-
  | Slot
+
  | Type
  | Short
+
  | VarInt
  | Equipment slot. 0: held, 1–4: armor slot (1: boots, 2: leggings, 3: chestplate, 4: helmet)
+
  | The type of mob. See [[Entities#Mobs]]
 
  |-
 
  |-
  | Item
+
  | X
  | [[Slot Data|Slot]]
+
  | Double
  | Item in slot format
+
|
  |}
+
|-
 
+
| Y
==== Spawn Position ====
+
| Double
 
+
|
Sent by the server after login to specify the coordinates of the spawn point (the point at which players spawn at, and which the compass points to). It can be sent at any time to update the point compasses point at.
+
|-
 
+
| Z
{| class="wikitable"
+
| Double
  ! Packet ID
+
|
 +
|-
 +
| 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]]
 +
  |}
 +
 
 +
==== Spawn Painting ====
 +
 
 +
This packet shows location, name, and type of painting.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
Line 307: Line 393:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x05
+
  |rowspan="5"| 0x04
  |rowspan="1"| Play
+
  |rowspan="5"| Play
  |rowspan="1"| Client
+
  |rowspan="5"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| Entity UUID
 +
| UUID
 +
|
 +
|-
 +
| Motive
 +
| VarInt
 +
| Panting's ID, see below
 +
|-
 
  | Location
 
  | Location
 
  | Position
 
  | Position
  | Spawn location
+
  | Center coordinates (see below)
 +
|-
 +
| Direction
 +
| Byte Enum
 +
| Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
 
  |}
 
  |}
  
==== Update Health ====
+
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.
 
 
Sent by the server to update/set the health of the player it is sent to.
 
  
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.
+
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
 
  |-
 
  |-
  |rowspan="3"| 0x06
+
  | <code>minecraft:kebab</code>
  |rowspan="3"| Play
+
  | 0
  |rowspan="3"| Client
+
  | 0
  | Health
+
  | 0
  | Float
+
  | 16
  | 0 or less = dead, 20 = full HP
+
  | 16
 
  |-
 
  |-
  | Food
+
  | <code>minecraft:aztec</code>
  | VarInt
+
  | 1
  | 0–20
+
  | 16
  |-
+
  | 0
  | Food Saturation
+
  | 16
  | Float
+
  | 16
| Seems to vary from 0.0 to 5.0 in integer increments
 
|}
 
 
 
==== Respawn ====
 
 
 
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.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x07
+
  | <code>minecraft:alban</code>
  |rowspan="4"| Play
+
  | 2
  |rowspan="4"| Client
+
  | 32
  | Dimension
+
  | 0
  | Int
+
  | 16
  | -1: The Nether, 0: The Overworld, 1: The End
+
  | 16
 
  |-
 
  |-
  | Difficulty
+
  | <code>minecraft:aztec2</code>
  | Unsigned Byte
+
| 3
  | 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
+
  | 48
 +
  | 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Gamemode
+
  | <code>minecraft:bomb</code>
  | Unsigned Byte
+
| 4
  | 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
+
  | 64
 +
  | 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Level Type
+
  | <code>minecraft:plant</code>
| String
+
  | 5
| Same as [[#Join Game|Join Game]]
+
  | 80
|}
+
  | 0
 
+
  | 16
{{Warning|If the Dimension isn't valid then the client will crash}}
+
  | 16
 
 
{{Warning|Avoid changing player's dimension to same dimension they were already in, weird bugs can occur i.e. such player will be unable to attack other players in new world (fixes after their death and respawn)}}
 
 
 
==== Player Position And Look ====
 
 
 
Updates the players position on the server.
 
 
 
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 units will result in the client being kicked for “You moved too quickly :( (Hacking?)”
 
 
 
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”
 
 
 
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
 
 
 
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 
 
 
The yaw of player (in degrees), standing at point (x0, z0) and looking towards point (x, z) one can be calculated with:
 
 
 
  l = x-x0
 
  w = z-z0
 
  c = sqrt( l*l + w*w )
 
  alpha1 = -arcsin(l/c)/PI*180
 
  alpha2 =  arccos(w/c)/PI*180
 
if alpha2 > 90 then
 
    yaw = 180 - alpha1
 
else
 
    yaw = alpha1
 
 
 
You can get a unit vector from a given yaw/pitch via:
 
 
 
x = -cos(pitch) * sin(yaw)
 
y = -sin(pitch)
 
z =  cos(pitch) * cos(yaw)
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x08
+
  | <code>minecraft:wasteland</code>
  |rowspan="6"| Play
+
  | 6
  |rowspan="6"| Client
+
  | 96
  | X
+
  | 0
  | Double
+
  | 16
  | Absolute or relative position, depending on Flags
+
  | 16
 
  |-
 
  |-
  | Y
+
  | <code>minecraft:pool</code>
  | Double
+
  | 7
  | Absolute or relative position, depending on Flags
+
  | 0
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Z
+
  | <code>minecraft:courbet</code>
  | Double
+
  | 8
  | Absolute or relative position, depending on Flags
+
  | 32
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft:sea</code>
  | Float
+
  | 9
  | Absolute or relative rotation on the X Axis, in degrees
+
  | 64
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft:sunset</code>
  | Float
+
  | 10
  | Absolute or relative rotation on the Y Axis, in degrees
+
  | 96
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Flags
+
  | <code>minecraft:creebet</code>
  | Byte
+
  | 11
  | Bit field, see below
+
  | 128
  |}
+
  | 32
 
+
| 32
About the Flags field:
+
  | 16
 
 
  <Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Field
+
  | <code>minecraft:wanderer</code>
  ! Bit
+
  | 12
 +
| 0
 +
| 64
 +
| 16
 +
| 32
 
  |-
 
  |-
  | X
+
  | <code>minecraft:graham</code>
  | 0x01
+
  | 13
 +
| 16
 +
| 64
 +
| 16
 +
| 32
 +
|-
 +
| <code>minecraft:match</code>
 +
| 14
 +
| 0
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Y
+
  | <code>minecraft:bust</code>
  | 0x02
+
  | 15
 +
| 32
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Z
+
  | <code>minecraft:stage</code>
  | 0x04
+
  | 16
 +
| 64
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | Y_ROT
+
  | <code>minecraft:void</code>
  | 0x08
+
  | 17
 +
| 96
 +
| 128
 +
| 32
 +
| 32
 
  |-
 
  |-
  | X_ROT
+
  | <code>skull_and_roses</code>
  | 0x10
+
  | 18
  |}
+
  | 128
 
+
| 128
==== Held Item Change ====
+
  | 32
 
+
  | 32
Sent to change the player's slot selection.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x09
+
  | <code>minecraft:wither</code>
  |rowspan="1"| Play
+
| 19
  |rowspan="1"| Client
+
| 160
  | Slot
+
| 128
  | Byte
+
| 32
  | The slot which the player has selected (0–8)
+
| 32
 +
|-
 +
| <code>minecraft:fighters</code>
 +
| 20
 +
| 0
 +
| 96
 +
| 64
 +
| 32
 +
|-
 +
| <code>minecraft:pointer</code>
 +
| 21
 +
  | 0
 +
| 192
 +
  | 64
 +
| 64
 +
|-
 +
| <code>minecraft:pigscene</code>
 +
| 22
 +
| 64
 +
| 192
 +
| 64
 +
| 64
 +
|-
 +
| <code>minecraft:burning_skull</code>
 +
| 23
 +
| 128
 +
| 192
 +
| 64
 +
| 64
 +
|-
 +
| <code>minecraft:skeleton</code>
 +
| 24
 +
| 192
 +
| 64
 +
| 64
 +
| 48
 +
|-
 +
| <code>minecraft:donkey_kong</code>
 +
| 25
 +
| 192
 +
  | 112
 +
  | 64
 +
  | 48
 
  |}
 
  |}
  
==== Use Bed ====
+
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
  
This packet tells that a player goes to bed.
+
==== Spawn Player ====
  
The client with the matching Entity ID will go into bed mode.
+
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
  
This Packet is sent to all nearby players including the one sent to bed.
+
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"
Line 508: Line 630:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0A
+
  |rowspan="7"| 0x05
  |rowspan="2"| Play
+
  |rowspan="7"| Play
  |rowspan="2"| Client
+
  |rowspan="7"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Sleeping player's EID
+
  | Player's EID
 
  |-
 
  |-
  | Location
+
  | Player UUID
  | Position
+
  | UUID
  | Block location of the head part of the bed
+
  | See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
|}
 
 
 
==== Animation ====
 
 
 
Sent whenever an entity should change animation.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x0B
+
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Yaw
 +
| Angle
 +
|
 +
|-
 +
| Pitch
 +
| Angle
 +
|
 +
|}
 +
 
 +
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs.
 +
 
 +
In offline mode, [[Wikipedia:Universally unique identifier#Versions 3 and 5 (namespace name-based)|UUID v3]] is used with the String <code>OfflinePlayer:&lt;player name&gt;</code>, encoded in UTF-8 (and case-sensitive).
 +
 
 +
For NPCs UUID v2 should be used. Note:
 +
 
 +
<+Grum> i will never confirm this as a feature you know that :)
 +
 
 +
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 +
 
 +
==== Entity Animation (clientbound) ====
 +
 
 +
Sent whenever an entity should change animation.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
  |rowspan="2"| 0x06
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
Line 551: Line 703:
 
  |-
 
  |-
 
  | 0
 
  | 0
  | Swing arm
+
  | Swing main arm
 
  |-
 
  |-
 
  | 1
 
  | 1
Line 560: Line 712:
 
  |-
 
  |-
 
  | 3
 
  | 3
  | Eat food
+
  | Swing offhand
 
  |-
 
  |-
 
  | 4
 
  | 4
Line 569: Line 721:
 
  |}
 
  |}
  
==== Spawn Player ====
+
==== Statistics ====
  
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
+
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1).
  
This packet must be sent after the [[#Player List Item|Player List Item]] ([[#Play|Play]], 0x38, clientbound) packet that adds the player data for the client to use when spawning a player. The tab includes skin/cape data.
+
{| class="wikitable"
 
+
  ! Packet ID
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
 
 
When in online-mode the UUIDs must be valid and have valid skin blobs, in offline-mode UUID v3 is used.
 
 
 
For NPCs UUID v2 should be used. Note:
 
 
 
<+Grum> i will never confirm this as a feature you know that :)
 
 
 
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
 
  ! State
 
  ! State
  ! Bound To
+
  ! Bound To  
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x0C
+
  |rowspan="4"| 0x07
  |rowspan="9"| Play
+
  |rowspan="4"| Play
  |rowspan="9"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  |colspan="2"| Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array
 +
|-
 +
|rowspan="2"| Statistic
 +
| Category ID
 +
|rowspan="2"| Array
 
  | VarInt
 
  | VarInt
  | Player's EID
+
  | See below
 
  |-
 
  |-
  | Player UUID
+
  | Statistic ID
  | UUID
+
  | VarInt
  |  
+
  | See below
 
  |-
 
  |-
  | X
+
  |colspan="2"| Value
  | Int
+
  |colspan="2"| VarInt
  | Player X as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | The amount to set it to
 +
|}
 +
 
 +
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! ID
 +
! Registry
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.mined</code>
  | Int
+
  | 0
  | Player Y as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
| Blocks
 +
|-
 +
| <code>minecraft.crafted</code>
 +
| 1
 +
| Items
 +
  |-
 +
| <code>minecraft.used</code>
 +
| 2
 +
| Items
 +
|-
 +
| <code>minecraft.broken</code>
 +
| 3
 +
| Items
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.picked_up</code>
  | Int
+
  | 4
  | Player Z as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Items
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.dropped</code>
  | Angle
+
  | 5
  |  
+
  | Items
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.killed</code>
  | Angle
+
  | 6
  |  
+
  | Entities
 
  |-
 
  |-
  | Current Item
+
  | <code>minecraft.killed_by</code>
  | Short
+
  | 7
  | The item the player is currently holding. Note that this should be 0 for “no item”, unlike -1 used in other packets.
+
  | Entities
 
  |-
 
  |-
  | Metadata
+
  | <code>minecraft.custom</code>
  | [[Entities#Entity Metadata Format|Metadata]]
+
  | 8
  |  
+
  | Custom
 
  |}
 
  |}
  
{{Warning|A negative Current Item crashes clients}}
+
Blocks, Items, and Entities use block (not block state), item, and entity ids.
 
 
{{Warning|The client will crash if no Metadata is sent}}
 
 
 
==== Collect Item ====
 
  
Sent by the server when someone picks up an item lying on the ground — its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each [[#Player Position|Player Position]] (and [[#Player Position And Look|Player Position And Look]]) packet sent by the client.
+
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
 
  |-
 
  |-
  |rowspan="2"| 0x0D
+
  | <code>minecraft.time_since_death</code>
  |rowspan="2"| Play
+
  | 2
|rowspan="2"| Client
+
  | Time
| Collected Entity ID
+
  |-
| VarInt
+
  | <code>minecraft.sneak_Time</code>
  |  
+
  | 3
  |-  
+
  | Time
  | Collector Entity ID
 
| VarInt
 
  |  
 
  |}
 
 
 
==== Spawn Object ====
 
 
 
Sent by the server when an Object/Vehicle is created.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="8"| 0x0E
+
  | <code>minecraft.walk_one_cm</code>
|rowspan="8"| Play
+
  | 4
|rowspan="8"| Client
+
  | Distance
| Entity ID
 
  | VarInt
 
  | EID of the object
 
 
  |-
 
  |-
  | Type
+
  | <code>minecraft.crouch_one_cm</code>
  | Byte
+
  | 5
  | The type of object (See [[Entities#Objects|Objects]])
+
  | Distance
 
  |-
 
  |-
  | X
+
  | <code>minecraft.sprint_one_cm</code>
  | Int
+
  | 6
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.swim_one_cm</code>
  | Int
+
  | 7
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.fall_one_cm</code>
  | Int
+
  | 8
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.climb_one_cm</code>
  | Angle
+
  | 9
  |  
+
  | Distance
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.fly_one_cm</code>
  | Angle
+
  | 10
  |  
+
  | Distance
 
  |-
 
  |-
  | Data
+
  | <code>minecraft.dive_one_cm</code>
  | [[Object Data]]
+
  | 11
  |  
+
  | Distance
|}
 
 
 
==== Spawn Mob ====
 
 
 
Sent by the server when a Mob Entity is Spawned
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="12"| 0x0F
+
  | <code>minecraft.minecart_one_cm</code>
|rowspan="12"| Play
+
  | 12
  |rowspan="12"| Client
+
  | Distance
| Entity ID
 
| VarInt
 
  |  
 
 
  |-
 
  |-
  | Type
+
  | <code>minecraft.boat_one_cm</code>
  | Unsigned Byte
+
  | 13
  | The type of mob. See [[Entities#Mobs|Mobs]]
+
  | Distance
 
  |-
 
  |-
  | X
+
  | <code>minecraft.pig_one_cm</code>
  | Int
+
  | 14
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.horse_one_cm</code>
  | Int
+
  | 15
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.aviate_one_cm</code>
  | Int
+
  | 16
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.jump</code>
  | Angle
+
  | 17
  |  
+
  | None
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.drop</code>
  | Angle
+
  | 18
  |  
+
  | None
 
  |-
 
  |-
  | Head Pitch
+
  | <code>minecraft.damage_dealt</code>
  | Angle
+
  | 19
  |  
+
  | Damage
 
  |-
 
  |-
  | Velocity X
+
  | <code>minecraft.damage_taken</code>
  | Short
+
  | 20
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | Damage
 
  |-
 
  |-
  | Velocity Y
+
  | <code>minecraft.deaths</code>
  | Short
+
  | 21
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | None
 
  |-
 
  |-
  | Velocity Z
+
  | <code>minecraft.mob_kills</code>
  | Short
+
  | 22
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | None
 
  |-
 
  |-
  | Metadata
+
  | <code>minecraft.animals_bred</code>
| [[Entities#Entity Metadata Format|Metadata]]
+
  | 23
|
+
  | None
|}
 
 
 
==== Spawn Painting ====
 
 
 
This packet shows location, name, and type of painting.
 
 
 
Calculating the center of an image: given a (width x height) grid of cells, with (0, 0) being the top left corner, the center is (max(0, width / 2 - 1), height / 2). E.g.
 
 
 
  2x1 (1, 0)
 
  4x4 (1, 2)
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x10
+
  | <code>minecraft.player_kills</code>
|rowspan="4"| Play
+
  | 24
|rowspan="4"| Client
+
  | None
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Title
+
  | <code>minecraft.fish_caught</code>
  | String
+
  | 25
  | Name of the painting. Max length 13
+
  | None
 
  |-
 
  |-
  | Location
+
  | <code>minecraft.talked_to_villager</code>
  | Position
+
  | 26
  | Center coordinates
+
  | None
 
  |-
 
  |-
  | Direction
+
  | <code>minecraft.traded_with_villager</code>
  | Unsigned Byte
+
| 27
  | Direction the painting faces. 0: north (-z), 1: west (-x), 2: south (+z), 3: east (+x)
+
| None
 +
|-
 +
| <code>minecraft.eat_cake_slice</code>
 +
| 28
 +
| None
 +
|-
 +
| <code>minecraft.fill_cauldron</code>
 +
| 29
 +
| None
 +
|-
 +
| <code>minecraft.use_cauldron</code>
 +
| 30
 +
| None
 +
|-
 +
| <code>minecraft.clean_armor</code>
 +
| 31
 +
| None
 +
|-
 +
| <code>minecraft.clean_banner</code>
 +
| 32
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_brewingstand</code>
 +
| 33
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_beacon</code>
 +
| 34
 +
| None
 +
|-
 +
| <code>minecraft.inspect_dropper</code>
 +
| 35
 +
| None
 +
|-
 +
| <code>minecraft.inspect_hopper</code>
 +
| 36
 +
| None
 +
|-
 +
| <code>minecraft.inspect_dispenser</code>
 +
| 37
 +
| None
 +
|-
 +
| <code>minecraft.play_noteblock</code>
 +
| 38
 +
  | None
 +
  |-
 +
| <code>minecraft.tune_noteblock</code>
 +
| 39
 +
| None
 +
|-
 +
| <code>minecraft.pot_flower</code>
 +
| 40
 +
| None
 +
|-
 +
| <code>minecraft.trigger_trapped_chest</code>
 +
| 41
 +
| None
 +
|-
 +
| <code>minecraft.open_enderchest</code>
 +
| 42
 +
| None
 +
|-
 +
| <code>minecraft.enchant_item</code>
 +
| 43
 +
| None
 +
|-
 +
| <code>minecraft.play_record</code>
 +
| 44
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_furnace</code>
 +
| 45
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_crafting_table</code>
 +
| 46
 +
| None
 +
|-
 +
| <code>minecraft.open_chest</code>
 +
| 47
 +
| None
 +
|-
 +
| <code>minecraft.sleep_in_bed</code>
 +
| 48
 +
| None
 +
|-
 +
| <code>minecraft.open_shulker_box</code>
 +
| 49
 +
| None
 
  |}
 
  |}
  
==== Spawn Experience Orb ====
+
Units:
 +
 
 +
* None: just a normal number (formatted with 0 decimal places)
 +
* Damage: value is 10 times the normal amount
 +
* Distance: a distance in centimeters (hundredths of blocks)
 +
* Time: a time span in ticks
  
Spawns one or more experience orbs.
+
==== Acknowledge Player Digging ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 822: Line 1,026:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x11
+
  |rowspan="4"| 0x08
  |rowspan="5"| Play
+
  |rowspan="4"| Play
  |rowspan="5"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  | Location
 +
| Position
 +
| Position where the digging was happening
 +
|-
 +
| Block
 
  | VarInt
 
  | VarInt
  | Entity's ID
+
  | Block state ID of the block that should be at that position now.
 
  |-
 
  |-
  | X
+
  | Status
  | Int
+
  | VarInt enum
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Same as Player Digging.  Only Started digging (0), Cancelled digging (1), and Finished digging (2) are used.
 
  |-
 
  |-
  | Y
+
  | Successful
  | Int
+
  | Boolean
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | True if the digging succeeded; false if the client should undo any changes it made locally. (How does this work?)
  |-
 
| Z
 
| Int
 
| Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
|-
 
| Count
 
| Short
 
| The amount of experience this orb will reward once collected
 
 
  |}
 
  |}
  
==== Entity Velocity ====
+
==== Block Break Animation ====
 +
 
 +
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 +
 
 +
Block break animations can still be applied on air; the animation will remain visible although there is no block being broken.  However, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency.  (An effect similar to this can be seen in normal gameplay when breaking ice blocks)
  
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).
+
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 858: Line 1,062:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x12
+
  |rowspan="3"| 0x09
  |rowspan="4"| Play
+
  |rowspan="3"| Play
  |rowspan="4"| Client
+
  |rowspan="3"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  |  
+
  | Entity ID of the entity breaking the block
 
  |-
 
  |-
  | Velocity X
+
  | Location
  | Short
+
  | Position
  | Velocity on the X axis
+
  | Block Position
 
  |-
 
  |-
  | Velocity Y
+
  | Destroy Stage
  | Short
+
  | Byte
  | Velocity on the Y axis
+
  | 0–9 to set it, any other value to remove it
|-
 
| Velocity Z
 
| Short
 
| Velocity on the Z axis
 
 
  |}
 
  |}
  
==== Destroy Entities ====
+
==== Update Block Entity ====
  
Sent by the server when a list of entities is to be destroyed on the client.
+
Sets the block entity associated with the block at the given location.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 890: Line 1,090:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x13
+
  |rowspan="3"| 0x0A
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Count
+
  | Location
  | VarInt
+
  | Position
  | Number of elements in the following array
+
  |  
 +
|-
 +
| Action
 +
| Unsigned Byte
 +
| The type of update to perform, see below
 
  |-
 
  |-
  | Entity IDs
+
  | NBT Data
  | Array of VarInt
+
  | [[NBT|NBT Tag]]
  | The list of entities of destroy
+
  | 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)
 
  |}
 
  |}
  
==== Entity ====
+
''Action'' field:
  
Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.
+
* '''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
  
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.
+
==== Block Action ====
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="1"| 0x14
 
|rowspan="1"| Play
 
|rowspan="1"| Client
 
| Entity ID
 
| VarInt
 
|
 
|}
 
  
==== Entity Relative Move ====
+
This packet is used for a number of actions and animations performed by blocks, usually non-persistent.
  
This packet is sent by the server when an entity moves less then 4 blocks; if an entity moves more than 4 blocks [[#Entity Teleport|Entity Teleport]] should be sent instead.
+
See [[Block Actions]] for a list of values.
  
This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.
+
{{Warning2|This packet uses a block ID, not a block state.  Unfortunately, block IDs are not directly included in the output from [[Data Generators]], but can manually be calculated.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 938: Line 1,139:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x15
+
  |rowspan="4"| 0x0B
  |rowspan="5"| Play
+
  |rowspan="4"| Play
  |rowspan="5"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  | Location
  | VarInt
+
  | Position
  |  
+
  | Block coordinates
 
  |-
 
  |-
  | Delta X
+
  | Action ID (Byte 1)
  | Byte
+
  | Unsigned Byte
  | Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Varies depending on block — see [[Block Actions]]
 
  |-
 
  |-
  | Delta Y
+
  | Action Param (Byte 2)
  | Byte
+
  | Unsigned Byte
  | Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Varies depending on block — see [[Block Actions]]
 
  |-
 
  |-
  | Delta Z
+
  | Block Type
  | Byte
+
  | VarInt
  | Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | The block type ID for the block. This must match the block at the given coordinates.
|-
 
| On Ground
 
| Boolean
 
  |
 
 
  |}
 
  |}
  
==== Entity Look ====
+
==== Block Change ====
  
This packet is sent by the server when an entity rotates.
+
Fired whenever a block is changed within the render distance.
 +
 
 +
{{Warning2|Changing a block in a chunk that is not loaded is not a stable action.  The Notchian client currently uses a ''shared'' empty chunk which is modified for all block changes in unloaded chunks; while in 1.9 this chunk never renders in older versions the changed block will appear in all copies of the empty chunk.  Servers should avoid sending block changes in unloaded chunks and clients should ignore such packets.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 974: Line 1,173:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x16
+
  |rowspan="2"| 0x0C
  |rowspan="5"| Play
+
  |rowspan="2"| Play
  |rowspan="5"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Location
 +
| Position
 +
| Block Coordinates
 +
|-
 +
| Block ID
 
  | VarInt
 
  | VarInt
  |  
+
  | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
|-
+
  |}
| Yaw
+
 
| Angle
+
==== Boss Bar ====  
| New angle, not a delta
 
|-
 
| Pitch
 
| Angle
 
| New angle, not a delta
 
|-
 
| On Ground
 
| Boolean
 
|  
 
  |}
 
 
 
==== Entity Look And Relative Move ====
 
 
 
This packet is sent by the server when an entity rotates and moves. Since a byte range is limited from -128 to 127, and movement is offset of fixed-point numbers, this packet allows at most four blocks movement in any direction. (-128/32 == -4)
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,002: Line 1,191:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x17
+
  |rowspan="14"| 0x0D
  |rowspan="7"| Play
+
  |rowspan="14"| Play
  |rowspan="7"| Client
+
  |rowspan="14"| Client
  | Entity ID
+
  |colspan="2"| UUID
  | VarInt
+
| UUID
 +
| Unique ID for this bar
 +
|-
 +
|colspan="2"| Action
 +
  | VarInt Enum
 +
| Determines the layout of the remaining packet
 +
|-
 +
! Action
 +
! Field Name
 +
!
 +
!
 +
|-
 +
|rowspan="5"| 0: add
 +
| Title
 +
| [[Chat]]
 
  |  
 
  |  
 
  |-
 
  |-
  | Delta X
+
  | Health
  | Byte
+
  | Float
  | Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | 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.
 
  |-
 
  |-
  | Delta Y
+
  | Color
  | Byte
+
  | VarInt Enum
  | Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Color ID (see below)
 
  |-
 
  |-
  | Delta Z
+
  | Division
  | Byte
+
  | VarInt Enum
  | Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Type of division (see below)
 
  |-
 
  |-
  | Yaw
+
  | Flags
  | Angle
+
  | Unsigned Byte
  | New angle, not a delta
+
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02)
 
  |-
 
  |-
  | Pitch
+
  | 1: remove
  | Angle
+
  | ''no fields''
  | New angle, not a delta
+
  | ''no fields''
 +
| Removes this boss bar
 +
|-
 +
| 2: update health
 +
| Health
 +
| Float
 +
| as above
 
  |-
 
  |-
  | On Ground
+
  | 3: update title
  | Boolean
+
  | 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
 +
|-
 
  |}
 
  |}
 
==== Entity Teleport ====
 
 
This packet is sent by the server when an entity moves more than 4 blocks.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Color
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x18
+
  | 0
|rowspan="7"| Play
+
  | Pink
|rowspan="7"| Client
 
| Entity ID
 
| VarInt
 
  |  
 
 
  |-
 
  |-
  | X
+
  | 1
  | Int
+
  | Blue
| X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Y
+
  | 2
  | Int
+
  | Red
| Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Z
+
  | 3
  | Int
+
  | Green
| Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Yaw
+
  | 4
  | Angle
+
  | Yellow
  | New angle, not a delta
+
  |-
 +
| 5
 +
| Purple
 +
|-
 +
| 6
 +
| White
 +
|}
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Type of division
 +
|-
 +
| 0
 +
| No division
 +
|-
 +
| 1
 +
| 6 notches
 +
|-
 +
| 2
 +
| 10 notches
 
  |-
 
  |-
  | Pitch
+
  | 3
  | Angle
+
  | 12 notches
| New angle, not a delta
 
 
  |-
 
  |-
  | On Ground
+
  | 4
| Boolean
+
  | 20 notches
  |  
 
 
  |}
 
  |}
  
==== Entity Head Look ====
+
==== Server Difficulty ====
  
Changes the direction an entity's head is facing.
+
Changes the difficulty setting in the client's option menu
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,094: Line 1,321:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x19
+
  |rowspan="2"| 0x0E
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Entity ID
+
  | Difficulty
  | VarInt
+
  | Unsigned Byte
  |  
+
  | 0: peaceful, 1: easy, 2: normal, 3: hard
 
  |-
 
  |-
  | Head Yaw
+
  | Difficulty locked?
  | Angle
+
  | Boolean
  | New angle, not a delta
+
  |
 
  |}
 
  |}
  
==== Entity Status ====
+
==== Chat Message (clientbound) ====  
 +
 
 +
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options.  See [[Chat#Processing chat|processing chat]] for more info about these positions.
 +
 
 +
{{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,116: Line 1,347:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1A
+
  |rowspan="2"| 0x0F
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Entity ID
+
  | JSON Data
  | Int
+
  | [[Chat]]
  |  
+
  | Limited to 32767 bytes
 
  |-
 
  |-
  | Entity Status
+
  | Position
 
  | Byte
 
  | Byte
  | See below
+
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
 
  |}
 
  |}
 +
 +
==== Multi Block Change ====
 +
 +
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
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 
  |-
 
  |-
  ! Entity Status
+
  |rowspan="6"| 0x10
  ! Meaning
+
  |rowspan="6"| Play
 +
|rowspan="6"| Client
 +
|colspan="2"| Chunk X
 +
|colspan="2"| Int
 +
| Chunk X coordinate
 
  |-
 
  |-
  | 1
+
  |colspan="2"| Chunk Z
  | Sent when resetting a mob spawn minecart's timer - appears to be unused by the client
+
|colspan="2"| Int
 +
  | Chunk Z coordinate
 
  |-
 
  |-
  | 2
+
  |colspan="2"| Record Count
  | Living Entity hurt
+
|colspan="2"| VarInt
 +
  | Number of elements in the following array, i.e. the number of blocks affected
 
  |-
 
  |-
  | 3
+
  |rowspan="3"| Record
  | Living Entity dead
+
| Horizontal Position
 +
|rowspan="3"| Array
 +
| Unsigned Byte
 +
  | The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
 
  |-
 
  |-
  | 4
+
  | Y Coordinate
  | Iron Golem throwing up arms
+
  | Unsigned Byte
 +
| Y coordinate of the block
 
  |-
 
  |-
  | 6
+
  | Block ID
  | Wolf/Ocelot/Horse taming — Spawn “heart” particles
+
  | VarInt
  |-
+
  | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
| 7
+
  |}
| Wolf/Ocelot/Horse tamed — Spawn “smoke” particles
+
 
  |-
+
To decode the position into a world position:
| 8
+
 
| Wolf shaking water — Trigger the shaking animation
+
<syntaxhighlight lang="java">
|-
+
worldX = (horizPos >> 4 & 15) + (chunkX * 16);
| 9
+
worldY = vertPos;
| (of self) Eating accepted by server
+
worldZ = (horizPos & 15) + (chunkZ * 16);
|-
+
</syntaxhighlight>
| 10
 
| Sheep eating grass
 
|-
 
| 10
 
| Play TNT ignite sound
 
|-
 
| 11
 
| Iron Golem handing over a rose
 
|-
 
| 12
 
| Villager mating — Spawn “heart” particles
 
|-
 
| 13
 
| Spawn particles indicating that a villager is angry and seeking revenge
 
|-
 
| 14
 
| Spawn happy particles near a villager
 
|-
 
| 15
 
| Witch animation — Spawn “magic” particles
 
|-
 
| 16
 
| Play zombie converting into a villager sound
 
|-
 
| 17
 
| Firework exploding
 
|-
 
| 18
 
| Animal in love (ready to mate) — Spawn “heart” particles
 
|-
 
| 19
 
| Reset squid rotation
 
|-
 
| 20
 
| Spawn explosion particle — works for some living entities
 
|-
 
| 21
 
| Play guardian sound — works for every entity
 
|-
 
| 22
 
| Enables reduced debug for players
 
|-
 
| 23
 
| Disables reduced debug for players
 
|}
 
  
==== Attach Entity ====
+
==== Tab-Complete (clientbound) ====
  
This packet is sent when a player has been attached to an entity (e.g. Minecart).
+
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported. The client sorts these alphabetically before listing them.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,211: Line 1,419:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1B
+
  |rowspan="8"| 0x11
  |rowspan="3"| Play
+
  |rowspan="8"| Play
  |rowspan="3"| Client
+
  |rowspan="8"| Client
  | Entity ID
+
  |-
  | Int
+
|colspan="2"| ID
  | Attached entity's EID. Set to -1 to detach.
+
|colspan="2"| VarInt
 +
| Transaction ID
 +
  |-
 +
|colspan="2"| Start
 +
  |colspan="2"| VarInt
 +
| Start of the text to replace
 +
|-
 +
|colspan="2"| Length
 +
|colspan="2"| VarInt
 +
| Length of the text to replace
 +
|-
 +
|colspan="2"| Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array
 
  |-
 
  |-
  | Vehicle ID
+
  |rowspan="3"| Matches
  | Int
+
  | Match
  | Vechicle's Entity ID
+
  |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.
 
  |-
 
  |-
  | Leash
+
  | Has tooltip
 
  | Boolean
 
  | Boolean
  | If true leashes the entity to the vehicle
+
  | True if the following is present
 +
|-
 +
| Tooltip
 +
| Optional [[Chat]]
 +
| Tooltip to display; only present if previous boolean is true
 
  |}
 
  |}
  
==== Entity Metadata ====
+
==== Declare Commands ====
 +
 
 +
Lists all of the commands on the server, and how they are parsed.
 +
 
 +
This is a directed graph, with one root node.  Each redirect or child node must refer only to nodes that have already been declared.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,241: Line 1,472:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1C
+
  |rowspan="3"| 0x12
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Entity ID
+
  | Count
 
  | VarInt
 
  | VarInt
  |  
+
  | Number of elements in the following array
 +
|-
 +
| Nodes
 +
| Array of [[Command Data|Node]]
 +
| An array of nodes
 
  |-
 
  |-
  | Metadata
+
  | Root index
  | [[Entities#Entity Metadata Format|Metadata]]
+
  | VarInt
  |  
+
  | Index of the <code>root</code> node in the previous array
 
  |}
 
  |}
  
==== Entity Effect ====
+
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"
Line 1,263: Line 1,502:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x1D
+
  |rowspan="3"| 0x13
  |rowspan="5"| Play
+
  |rowspan="3"| Play
  |rowspan="5"| Client
+
  |rowspan="3"| Client
  | Entity ID
+
  | Window ID
| VarInt
 
|
 
|-
 
| Effect ID
 
 
  | Byte
 
  | Byte
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | The ID of the window that the action occurred in
 
  |-
 
  |-
  | Amplifier
+
  | Action Number
  | Byte
+
  | Short
  | Notchian client displays effect level as Amplifier + 1
+
  | 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.
 
  |-
 
  |-
  | Duration
+
  | Accepted
| VarInt
 
| Seconds
 
|-
 
| Hide Particles
 
 
  | Boolean
 
  | Boolean
  |  
+
  | Whether the action was accepted
 
  |}
 
  |}
  
==== Remove Entity Effect ====
+
==== 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"
 
{| class="wikitable"
Line 1,297: Line 1,530:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1E
+
  | 0x14
  |rowspan="2"| Play
+
  | Play
  |rowspan="2"| Client
+
  | Client
  | Entity ID
+
  | Window ID
  | VarInt
+
  | Unsigned Byte
|
+
  | This is the ID of the window that was closed. 0 for inventory.
  |-
 
| Effect ID
 
| Byte
 
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 
 
  |}
 
  |}
  
==== Set Experience ====
+
==== Window Items ====
 +
[[File:Inventory-slots.png|thumb|The inventory slots]]
  
Sent by the server when the client should change experience levels.
+
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"
 
{| class="wikitable"
Line 1,321: Line 1,551:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1F
+
  |rowspan="3"| 0x15
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
 
  |rowspan="3"| Client
 
  |rowspan="3"| Client
  | Experience bar
+
  | Window ID
  | Float
+
  | Unsigned Byte
  | Between 0 and 1
+
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  | Level
+
  | Count
  | VarInt
+
  | Short
 +
| Number of elements in the following array
 +
|-
 +
| Slot Data
 +
| Array of [[Slot Data|Slot]]
 
  |  
 
  |  
|-
 
| Total Experience
 
| VarInt
 
| See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
 
 
  |}
 
  |}
  
==== Entity Properties ====
+
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"
 
{| class="wikitable"
Line 1,343: Line 1,577:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x20
+
  |rowspan="3"| 0x16
  |rowspan="6"| Play
+
  |rowspan="3"| Play
  |rowspan="6"| Client
+
  |rowspan="3"| Client
  |colspan="2"| Entity ID
+
  | Window ID
  |colspan="2"| VarInt
+
  | Unsigned Byte
 
  |  
 
  |  
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | Property
|colspan="2"| Int
+
  | Short
| Number of elements in the following array
+
  | The property to be updated, see below
|-
 
|rowspan="4"| Property
 
  | Key
 
|rowspan="4"| Array
 
| String
 
  | See below
 
 
  |-
 
  |-
 
  | Value
 
  | Value
  | Double
+
  | Short
  | See below
+
  | The new value for the property, see below
|-
 
| Number Of Modifiers
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Modifiers
 
| Array of Modifier Data
 
| See {{Minecraft Wiki|Attribute#Modifiers}}
 
 
  |}
 
  |}
  
Known Key values:
+
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"
 
{| class="wikitable"
 
  |-
 
  |-
  ! Key
+
  ! Window type
  ! Default
+
  ! Property
  ! Min
+
  ! Value
  ! Max
+
  |-
  ! Label
+
|rowspan="4"| Furnace
 +
| 0: Fire icon (fuel left)
 +
  | counting from fuel burn time down to 0 (in-game ticks)
 
  |-
 
  |-
  | generic.maxHealth
+
  | 1: Maximum fuel burn time
  | 20.0
+
  | fuel burn time or 0 (in-game ticks)
| 0.0
 
| Double.MaxValue
 
| Max Health
 
 
  |-
 
  |-
  | generic.followRange
+
  | 2: Progress arrow
  | 32.0
+
  | counting from 0 to maximum progress (in-game ticks)
| 0.0
 
| 2048.0
 
| Follow Range
 
 
  |-
 
  |-
  | generic.knockbackResistance
+
  | 3: Maximum progress
  | 0.0
+
  | always 200 on the notchian server
| 0.0
 
| 1.0
 
| Knockback Resistance
 
 
  |-
 
  |-
  | generic.movementSpeed
+
  |rowspan="10"| Enchantment Table
| 0.699999988079071
+
  | 0: Level requirement for top enchantment slot
  | 0.0
+
  |rowspan="3"| The enchantment's xp level requirement
  | Double.MaxValue
 
| Movement Speed
 
 
  |-
 
  |-
  | generic.attackDamage
+
  | 1: Level requirement for middle enchantment slot
| 2.0
 
| 0.0
 
| Double.MaxValue
 
|
 
 
  |-
 
  |-
  | horse.jumpStrength
+
  | 2: Level requirement for bottom enchantment slot
  | 0.7
+
|-
  | 0.0
+
| 3: The enchantment seed
  | 2.0
+
| 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>).
  | Jump Strength
+
|-
 +
| 4: Enchantment ID shown on mouse hover over top enchantment slot
 +
|rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
 +
|-
 +
| 5: Enchantment ID shown on mouse hover over middle enchantment slot
 +
|-
 +
| 6: Enchantment ID shown on mouse hover over bottom enchantment slot
 +
|-
 +
| 7: Enchantment level shown on mouse hover over the top slot
 +
|rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
 +
|-
 +
| 8: Enchantment level shown on mouse hover over the middle slot
 +
|-
 +
| 9: Enchantment level shown on mouse hover over the bottom slot
 +
|-
 +
|rowspan="3"| Beacon
 +
  | 0: Power level
 +
  | 0-4, controls what effect buttons are enabled
 +
|-
 +
| 1: First potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
 +
|-
 +
| 2: Second potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
 +
|-
 +
| Anvil
 +
| 0: Repair cost
 +
| The repair's cost in xp levels
 +
|-
 +
  |rowspan="2"| Brewing Stand
 +
| 0: Brew time
 +
  | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
 
  |-
 
  |-
  | zombie.spawnReinforcements
+
  | 1: Fuel time
  | 0.0
+
  | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full
| 0.0
 
| 1.0
 
| Spawn Reinforcements Chance
 
 
  |}
 
  |}
  
''Modifier Data'' structure:
+
For an enchanting table, the following numerical IDs are used:
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Numerical ID
 +
! Enchantment ID
 +
! Enchantment Name
 
  |-
 
  |-
  ! Field Name
+
  | 0
  ! Field Type
+
  | minecraft:protection
  ! Notes
+
  | Protection
 +
|-
 +
| 1
 +
| minecraft:fire_protection
 +
| Fire Protection
 
  |-
 
  |-
  | UUID
+
  | 2
  | UUID
+
  | minecraft:feather_falling
  |  
+
  | Feather Falling
 
  |-
 
  |-
  | Amount
+
  | 3
  | Double
+
  | minecraft:blast_protection
  |  
+
  | Blast Protection
 
  |-
 
  |-
  | Operation
+
  | 4
  | Byte
+
  | minecraft:projectile_protection
  |  
+
  | Projectile Protection
  |}
+
  |-
 
+
| 5
==== Chunk Data ====
+
| minecraft:respiration
 
+
  | Respiration
Chunks are not unloaded by the client automatically. To unload chunks, send this packet with Ground-Up Continuous=true and no 16^3 chunks (eg. Primary Bit Mask=0). The server does not send skylight information for nether-chunks, it's up to the client to know if the player is currently in the nether. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent.
+
  |-
 
+
  | 6
See also: [[SMP Map Format]]
+
  | minecraft:aqua_affinity
 
+
  | Aqua Affinity
Changes in 1.8:
 
 
 
* Data value section removed
 
* Extended id section removed
 
* Block id section is now a unsigned short (little endian) per a block
 
* The block id is equal to <code>(id << 4) | data</code>
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
  ! Bound To
 
  ! Field Name
 
  ! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x21
+
  | 7
|rowspan="6"| Play
+
  | minecraft:thorns
|rowspan="6"| Client
+
  | Thorns
| Chunk X
 
  | Int
 
  | Chunk X coordinate
 
 
  |-
 
  |-
  | Chunk Z
+
  | 8
  | Int
+
  | minecraft:depth_strider
  | Chunk Z coordinate
+
  | Depth Strider
 
  |-
 
  |-
  | Ground-Up Continuous
+
  | 9
  | Boolean
+
  | minecraft:frost_walker
  | This is true if the packet represents all sections in this vertical column, where the Primary Bit Mask specifies exactly which sections are included, and which are air
+
  | Frost Walker
 
  |-
 
  |-
  | Primary Bit Mask
+
  | 10
  | Unsigned Short
+
  | minecraft:binding_curse
  | Bitmask with 1 for every 16x16x16 section whose data follows in the compressed data
+
  | Curse of Binding
|-
 
| Size
 
| VarInt
 
| Size of Data
 
 
  |-
 
  |-
  | Data
+
  | 11
| [[SMP Map Format#Data|Chunk]]
+
  | minecraft:sharpness
  |  
+
  | Sharpness
  |}
 
 
 
==== Multi Block Change ====
 
Fired whenever 2 or more blocks are changed within the render distance.
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
!colspan="2"| Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x22
+
  | 12
|rowspan="6"| Play
+
  | minecraft:smite
|rowspan="6"| Client
+
  | Smite
  |colspan="2"| Chunk X
 
|colspan="2"| Int
 
  | Chunk X coordinate
 
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  | 13
  |colspan="2"| Int
+
  | minecraft:bane_of_arthropods
  | Chunk Z coordinate
+
  | Bane of Arthropods
 
  |-
 
  |-
  |colspan="2"| Record Count
+
  | 14
  |colspan="2"| VarInt
+
  | minecraft:knockback
  | Number of elements in the following array, a.k.a. the number of blocks affected
+
  | Knockback
 
  |-
 
  |-
  |rowspan="3"| Record
+
  | 15
| Horizontal Position
+
  | minecraft:fire_aspect
|rowspan="3"| Array
+
  | Fire Aspect
  | 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
+
  | 16
  | Unsigned Byte
+
  | minecraft:looting
  |  
+
  | Looting
 
  |-
 
  |-
  | Block ID
+
  | 17
  | VarInt
+
  | minecraft:sweeping
  | The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
+
  | Sweeping Edge
|}
 
 
 
==== Block Change ====
 
Fired whenever a block is changed within the render distance.
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x23
+
  | 18
  |rowspan="2"| Play
+
| minecraft:efficiency
  |rowspan="2"| Client
+
| Efficiency
  | Location
+
|-
  | Position
+
| 19
  | Block Coordinates
+
| minecraft:silk_touch
 +
| Silk Touch
 +
|-
 +
| 20
 +
| minecraft:unbreaking
 +
| Unbreaking
 +
|-
 +
| 21
 +
| minecraft:fortune
 +
| Fortune
 +
|-
 +
| 22
 +
| minecraft:power
 +
| Power
 +
|-
 +
| 23
 +
| minecraft:punch
 +
| Punch
 +
|-
 +
| 24
 +
| minecraft:flame
 +
| Flame
 +
|-
 +
| 25
 +
| minecraft:infinity
 +
| Infinity
 +
|-
 +
| 26
 +
| minecraft:luck_of_the_sea
 +
| Luck of the Sea
 +
|-
 +
| 27
 +
| minecraft:lure
 +
| Lure
 +
|-
 +
| 28
 +
| minecraft:loyalty
 +
| Loyalty
 +
|-
 +
| 29
 +
| minecraft:impaling
 +
  | Impaling
 +
|-
 +
  | 30
 +
| minecraft:riptide
 +
| Riptide
 +
|-
 +
| 31
 +
| minecraft:channeling
 +
| Channeling
 +
|-
 +
  | 32
 +
  | minecraft:mending
 +
  | Mending
 
  |-
 
  |-
  | Block ID
+
  | 33
  | VarInt
+
  | minecraft:vanishing_curse
  | The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
+
  | Curse of Vanishing
 
  |}
 
  |}
  
==== Block Action ====
+
==== Set Slot ====
  
This packet is used for a number of things:
+
Sent by the server when an item in a slot (in a window) is added/removed.
 
 
* Chests opening and closing
 
* Pistons pushing and pulling
 
* Note blocks playing
 
* Updating beacons
 
 
 
See Also: [[Block Actions]]
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,581: Line 1,821:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x24
+
  |rowspan="3"| 0x17
  |rowspan="4"| Play
+
  |rowspan="3"| Play
  |rowspan="4"| Client
+
  |rowspan="3"| Client
  | Location
+
  | Window ID
  | Position
+
  | Byte
  | Block Coordinates
+
  | 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).
 
  |-
 
  |-
  | Byte 1
+
  | Slot
  | Unsigned Byte
+
  | Short
  | Varies depending on block — see [[Block Actions]]
+
  | The slot that should be updated
 
  |-
 
  |-
  | Byte 2
+
  | Slot Data
  | Unsigned Byte
+
  | [[Slot Data|Slot]]
| Varies depending on block — see [[Block Actions]]
+
  |  
  |-
 
| Block Type
 
| VarInt
 
| The block type for the block
 
 
  |}
 
  |}
  
==== Block Break Animation ====
+
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
  
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
+
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.
  
You can also set an animation to air! The animation will still be visible.
+
==== Set Cooldown ====
  
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
+
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).
 
 
Also if you set the coordinates to a special block like water etc. it won't show the actual break animation but some other interesting effects. (Water will lose it's transparency)
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,619: Line 1,853:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x25
+
  |rowspan="2"| 0x18
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Item ID
 
  | VarInt
 
  | VarInt
  | EID for the animation
+
  | Numeric ID of the item to apply a cooldown to.
 
  |-
 
  |-
  | Location
+
  | Cooldown Ticks
  | Position
+
  | VarInt
  | Block Position
+
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
|-
 
| Destroy Stage
 
| Byte
 
| 0–9 to set it, any other value to remove it
 
 
  |}
 
  |}
  
==== Map Chunk Bulk ====
+
==== Plugin Message (clientbound) ====
 +
 
 +
{{Main|Plugin channels}}
  
1.8 changes at [[#Chunk Data|Chunk Data]]
+
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.
  
To reduce the number of bytes, this packet is used to send chunks together for better compression results.
+
More documentation on this: [http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/]
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,645: Line 1,877:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x26
+
|rowspan="2"| 0x19
  |rowspan="7"| Play
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Channel
 +
| Identifier
 +
| Name of the [[plugin channel]] used to send the data
 +
|-
 +
| Data
 +
| Byte Array
 +
| Any data, depending on the channel. <code>minecraft:</code> channels are documented [[plugin channel|here]].  The length of this array must be inferred from the packet length.
 +
|}
 +
 
 +
==== Named Sound Effect ====
 +
{{See also|#Sound Effect}}
 +
 
 +
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
 +
|-
 +
  |rowspan="7"| 0x1A
 +
  |rowspan="7"| Play
 
  |rowspan="7"| Client
 
  |rowspan="7"| Client
  |colspan="2"| Sky Light Sent
+
  | Sound Name
  |colspan="2"| Boolean
+
| Identifier
  | Whether or not Chunk Data contains light nibble arrays. This is true in the Overworld, false in the End + Nether
+
| All sound effect names as of 1.15.2 can be seen [https://pokechu22.github.io/Burger/1.15.2.html#sounds here].
 +
|-
 +
  | Sound Category
 +
| VarInt Enum
 +
  | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 
  |-
 
  |-
  |colspan="2"| Chunk Column Count
+
  | Effect Position X
  |colspan="2"| VarInt
+
  | Int
  | Number of elements in each of the following arrays
+
  | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  |rowspan="3"| Chunk Meta
+
  | Effect Position Y
| Chunk X
 
|rowspan="3"| Array
 
 
  | Int
 
  | Int
  | The X coordinate of the chunk
+
  | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | Chunk Z
+
  | Effect Position Z
 
  | Int
 
  | Int
  | The Z coordinate of the chunk
+
  | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
  |-
 
  |-
  | Primary Bit Mask
+
  | Volume
  | Unsigned Short
+
  | Float
  | A bit mask which specifies which sections are not empty in this chunk
+
  | 1 is 100%, can be more
 
  |-
 
  |-
  |colspan="2"| Chunk Data
+
  | Pitch
  |colspan="2"| Array of [[SMP Map Format#Data|Chunk]]
+
  | Float
  | Each chunk in this array corresponds to the data at the same position in Chunk Meta
+
  | Float between 0.5 and 2.0 by Notchian clients
 
  |}
 
  |}
  
==== Explosion ====
+
==== Disconnect (play) ====
 
 
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
+
Sent by the server before it disconnects a client. The client assumes that the server has already closed the connection by the time the packet arrives.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,693: Line 1,950:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x27
+
| 0x1B
  |rowspan="9"| Play
+
| Play
  |rowspan="9"| Client
+
| Client
  | X
+
| 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
 +
|-
 +
|rowspan="2"| 0x1C
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| Int
 +
|
 +
|-
 +
| Entity Status
 +
| Byte Enum
 +
| See below
 +
|}
 +
 
 +
See [[Entity statuses]] for a list of which statuses are valid for each type of entity.
 +
 
 +
==== Explosion ====
 +
 
 +
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
 +
 
 +
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
  |rowspan="9"| 0x1D
 +
  |rowspan="9"| Play
 +
  |rowspan="9"| Client
 +
  | X
 
  | Float
 
  | Float
 
  |  
 
  |  
Line 1,708: Line 2,013:
 
  |  
 
  |  
 
  |-
 
  |-
  | Radius
+
  | Strength
 
  | Float
 
  | Float
  | Currently unused in the client
+
  | A strength greater than or equal to 2.0 spawns a <code>minecraft:explosion_emitter</code> particle, while a lesser strength spawns a <code>minecraft:explosion</code> particle.
 
  |-
 
  |-
 
  | Record Count
 
  | Record Count
Line 1,718: Line 2,023:
 
  | Records
 
  | Records
 
  | Array of (Byte, Byte, Byte)
 
  | Array of (Byte, Byte, Byte)
  | Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
+
  | Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks.
 
  |-
 
  |-
 
  | Player Motion X
 
  | Player Motion X
Line 1,733: Line 2,038:
 
  |}
 
  |}
  
==== Effect ====
+
==== Unload Chunk ====
  
Sent when a client is to play a sound or particle effect.
+
Tells the client to unload a chunk column.
 
 
By default, the Minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1013 (mob.wither.spawn), and is ignored for any other value by the client.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,747: Line 2,050:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x28
+
  |rowspan="2"| 0x1E
  |rowspan="4"| Play
+
  |rowspan="2"| Play
  |rowspan="4"| Client
+
  |rowspan="2"| Client
  | Effect ID
+
  | Chunk X
 
  | Int
 
  | Int
  | The ID of the effect, see below
+
  | Block coordinate divided by 16, rounded down
 
  |-
 
  |-
  | Location
+
  | Chunk Z
| Position
 
| The location of the effect
 
|-
 
| Data
 
 
  | Int
 
  | Int
  | Extra data for certain effects, see below
+
  | Block coordinate divided by 16, rounded down
|-
 
| Disable Relative Volume
 
| Boolean
 
| See above
 
 
  |}
 
  |}
  
Effect IDs:
+
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"
 
{| class="wikitable"
  ! ID
+
  ! Packet ID
  ! Name
+
  ! State
  ! Data
+
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
! Notes
 
  |-
 
  |-
  !colspan="3"| Sound
+
  |rowspan="2"| 0x1F
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Reason
 +
| Unsigned Byte
 +
| See below
 
  |-
 
  |-
  | 1000
+
  | Value
  | <code>random.click</code>
+
  | Float
  |  
+
  | Depends on Reason
  |-
+
  |}
  | 1001
+
 
  | <code>random.click</code>
+
''Reason codes'':
  |
+
 
 +
{| class="wikitable"
 +
  ! Reason
 +
  ! Effect
 +
  ! Value
 
  |-
 
  |-
  | 1002
+
  | 0
  | <code>random.bow</code>
+
  | Invalid Bed
  |  
+
  | Would be used to switch between messages, but the only used message is 0 for invalid bed
 
  |-
 
  |-
  | 1003
+
  | 1
  | <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
+
  | End raining
 
  |  
 
  |  
 
  |-
 
  |-
  | 1004
+
  | 2
  | <code>random.fizz</code>
+
  | Begin raining
 
  |  
 
  |  
 
  |-
 
  |-
  | 1005
+
  | 3
  | Play a music disc.
+
  | Change gamemode
  | {{Minecraft Wiki|Music Discs|Record ID}}
+
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 
  |-
 
  |-
  | 1006
+
  | 4
  | ''not assigned''
+
  | 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.
 
  |-
 
  |-
  | 1007
+
  | 5
  | <code>mob.ghast.charge</code>
+
  | Demo message
  |  
+
  | 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control, 104: Tell that the demo is over and print a message about how to take a screenshot
 +
|-
 +
| 6
 +
| Arrow hitting player
 +
| Appears to be played when an arrow strikes another player in Multiplayer
 
  |-
 
  |-
  | 1008
+
  | 7
  | <code>mob.ghast.fireball</code>
+
  | Fade value
  |  
+
  | The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
 
  |-
 
  |-
  | 1009
+
  | 8
  | <code>mob.ghast.fireball</code>, but with a lower volume
+
  | Fade time
  |  
+
  | Time in ticks for the sky to fade
 
  |-
 
  |-
  | 1010
+
  | 9
| <code>mob.zombie.wood</code>
+
  | Play pufferfish sting sound
  |  
 
 
  |-
 
  |-
  | 1011
+
  | 10
  | <code>mob.zombie.metal</code>
+
  | Play elder guardian mob appearance (effect and sound)
 
  |  
 
  |  
 
  |-
 
  |-
  | 1012
+
  | 11
  | <code>mob.zombie.woodbreak</code>
+
  | Enable respawn screen
  |
+
|  0: Enable respawn screen, 1: Immediately respawn (sent when the doImmediateRespawn gamerule changes)
 +
|}
 +
 
 +
==== Open Horse Window ====
 +
 
 +
This packet is used exclusively for opening the horse GUI. [[#Open Window|Open Window]] is used for all other GUIs.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
  ! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1013
+
  |rowspan="3"| 0x20
  | <code>mob.wither.spawn</code>
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Window ID?
 +
  | Byte
 +
  |
 
  |-
 
  |-
  | 1014
+
  | Number of slots?
  | <code>mob.wither.shoot</code>
+
  | VarInt
  |  
+
  |
 
  |-
 
  |-
  | 1015
+
  | Entity ID?
  | <code>mob.bat.takeoff</code>
+
  | Integer
  |
+
|
 +
|}
 +
 
 +
==== Keep Alive (clientbound) ====
 +
 
 +
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
 +
 
 +
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1016
+
  |rowspan="1"| 0x21
  | <code>mob.zombie.infect</code>
+
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Keep Alive ID
 +
  | Long
 
  |  
 
  |  
 +
|}
 +
 +
==== Chunk Data ====
 +
{{Main|Chunk Format}}
 +
{{See also|#Unload Chunk}}
 +
 +
{{Need Info|How do biomes work now?  The biome change happened at the same time as the seed change, but it's not clear how/if biomes could be computed given that it's not the actual seed...  ([https://www.reddit.com/r/Mojira/comments/e5at6i/a_discussion_for_the_changes_to_how_biomes_are/ /r/mojira discussion] which notes that it seems to be some kind of interpolation, and 3D biomes are only used in the nether)}}
 +
 +
The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which 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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 1017
+
  |rowspan="10"| 0x22
  | <code>mob.zombie.unfect</code>
+
|rowspan="10"| Play
  |  
+
|rowspan="10"| Client
 +
| Chunk X
 +
  | Int
 +
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | 1018
+
  | Chunk Z
  | <code>mob.enderdragon.end</code>
+
  | Int
  |  
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 
  |-
 
  |-
  | 1020
+
  | Full chunk
  | <code>random.anvil_break</code>
+
  | Boolean
  |  
+
  | See [[Chunk Format#Full chunk|Chunk Format]]
 
  |-
 
  |-
  | 1021
+
  | Primary Bit Mask
  | <code>random.anvil_use</code>
+
  | 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).
 
  |-
 
  |-
  | 1022
+
  | Heightmaps
  | <code>random.anvil_land</code>
+
  | [[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.
 
  |-
 
  |-
  !colspan="3"| Particle
+
  | Biomes
 +
| Optional array of Integer
 +
| 1024 biome IDs, ordered by x then z then y, in 4&times;4&times;4 blocks.  Not present if full chunk is false.
 +
|-
 +
| Size
 +
| VarInt
 +
| Size of Data in bytes
 
  |-
 
  |-
  | 2000
+
  | Data
  | Spawns 10 smoke particles, e.g. from a fire
+
  | Byte array
  | Direction, see below
+
  | See [[Chunk Format#Data structure|data structure]] in Chunk Format
 
  |-
 
  |-
  | 2001
+
  | Number of block entities
  | Block break
+
  | VarInt
  | {{Minecraft Wiki|Data values|Block ID}}
+
  | Number of elements in the following array
 
  |-
 
  |-
  | 2002
+
  | Block entities
  | Splash potion. Particle effect + glass break sound.
+
  | Array of [[NBT|NBT Tag]]
  | [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
+
| All block entities in the chunk. Use the x, y, and z tags in the NBT to determine their positions.
 +
  |}
 +
 
 +
Note that the Notchian client requires an [[#Update View Position|Update View Position]] packet when it crosses a chunk border, otherwise it'll only display render distance + 2 chunks around the chunk it spawned in.
 +
 
 +
==== Effect ====
 +
 
 +
Sent when a client is to play a sound or particle effect.
 +
 
 +
By default, the Minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1023 (wither spawn) and effect 1028 (enderdragon death); it is ignored on other effects.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="4"| 0x23
 +
|rowspan="4"| Play
 +
|rowspan="4"| Client
 +
| Effect ID
 +
| Int
 +
| The ID of the effect, see below
 
  |-
 
  |-
  | 2003
+
  | Location
  | Eye of Ender entity break animation — particles and sound
+
  | Position
  |  
+
  | The location of the effect
 
  |-
 
  |-
  | 2004
+
  | Data
  | Mob spawn particle effect: smoke + flames
+
  | Int
  |  
+
  | Extra data for certain effects, see below
 
  |-
 
  |-
  | 2005
+
  | Disable Relative Volume
  | Spawn “happy villager” effect (green crosses), used for bonemealing vegetation
+
  | Boolean
  |  
+
  | See above
 
  |}
 
  |}
  
Smoke directions:
+
Effect IDs:
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! ID
 
  ! ID
  ! Direction
+
  ! Name
 +
! Data
 
  |-
 
  |-
  | 0
+
  !colspan="3"| Sound
  | South-East
+
  |-
 +
| 1000
 +
| Dispenser dispenses
 +
|
 +
|-
 +
| 1001
 +
| Dispenser fails to dispense
 +
|
 
  |-
 
  |-
  | 1
+
  | 1002
  | South
+
| Dispenser shoots
 +
  |  
 
  |-
 
  |-
  | 2
+
  | 1003
  | South-West
+
| Ender eye launched
 +
  |  
 
  |-
 
  |-
  | 3
+
  | 1004
  | East
+
| Firework shot
 +
  |  
 
  |-
 
  |-
  | 4
+
  | 1005
  | (Up or middle ?)
+
| Iron door opened
 +
  |  
 
  |-
 
  |-
  | 5
+
  | 1006
  | West
+
| Wooden door opened
 +
  |  
 
  |-
 
  |-
  | 6
+
  | 1007
  | North-East
+
| Wooden trapdoor opened
 +
  |  
 
  |-
 
  |-
  | 7
+
  | 1008
  | North
+
| Fence gate opened
 +
  |  
 
  |-
 
  |-
  | 8
+
  | 1009
  | North-West
+
  | Fire extinguished
  |}
+
  |  
 
 
==== 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
 
 
  |-
 
  |-
  |rowspan="6"| 0x29
+
  | 1010
  |rowspan="6"| Play
+
  | Play record
  |rowspan="6"| Client
+
  | Special case, see below for more info
| Sound name
 
| String
 
| All known sound effect names can be seen [https://github.com/SirCmpwn/Craft.Net/blob/master/source/Craft.Net.Common/SoundEffect.cs here]
 
 
  |-
 
  |-
  | Effect position X
+
  | 1011
  | Int
+
  | Iron door closed
  | Effect X multiplied by 8
+
  |  
 
  |-
 
  |-
  | Effect position Y
+
  | 1012
  | Int
+
  | Wooden door closed
  | Effect Y multiplied by 8
+
  |  
 
  |-
 
  |-
  | Effect position Z
+
  | 1013
  | Int
+
  | Wooden trapdoor closed
  | Effect Z multiplied by 8
+
  |  
 
  |-
 
  |-
  | Volume
+
  | 1014
  | Float
+
  | Fence gate closed
  | 1 is 100%, can be more
+
  |  
 
  |-
 
  |-
  | Pitch
+
  | 1015
  | Unsigned Byte
+
  | Ghast warns
  | 63 is 100%, can be more
+
  |  
|}
 
 
 
==== Particle ====
 
 
 
Displays the named particle
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="11"| 0x2A
+
  | 1016
|rowspan="11"| Play
+
  | Ghast shoots
|rowspan="11"| Client
+
  |  
| Particle ID
 
  | Int
 
  | See below
 
 
  |-
 
  |-
  | Long Distance
+
  | 1017
  | Boolean
+
  | Enderdragon shoots
  | If true, particle distance increases from 256 to 65536
+
  |  
 
  |-
 
  |-
  | X
+
  | 1018
  | Float
+
  | Blaze shoots
  | X position of the particle
+
  |  
 
  |-
 
  |-
  | Y
+
  | 1019
  | Float
+
  | Zombie attacks wood door
  | Y position of the particle
+
  |  
 
  |-
 
  |-
  | Z
+
  | 1020
  | Float
+
  | Zombie attacks iron door
  | Z position of the particle
+
  |  
 
  |-
 
  |-
  | Offset X
+
  | 1021
  | Float
+
  | Zombie breaks wood door
  | This is added to the X position after being multiplied by random.nextGaussian()
+
  |
 
  |-
 
  |-
  | Offset Y
+
  | 1022
  | Float
+
  | Wither breaks block
  | This is added to the Y position after being multiplied by random.nextGaussian()
+
  |
 
  |-
 
  |-
  | Offset Z
+
  | 1023
  | Float
+
  | Wither spawned
  | This is added to the Z position after being multiplied by random.nextGaussian()
+
  |  
 
  |-
 
  |-
  | Particle Data
+
  | 1024
  | Float
+
  | Wither shoots
  | The data of each particle
+
  |
 
  |-
 
  |-
  | Particle Count
+
  | 1025
  | Int
+
  | Bat takes off
  | The number of particles to create
+
  |
 
  |-
 
  |-
  | Data
+
  | 1026
  | Array of VarInt
+
  | Zombie infects
  | Length depends on particle. "iconcrack" has length of 2, "blockcrack", and "blockdust" have lengths of 1, the rest have 0.
+
  |
|}
 
 
 
Particle IDs:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Particle Name
+
  | 1027
  ! Particle ID
+
  | Zombie villager converted
 +
|
 
  |-
 
  |-
  | explode
+
  | 1028
  | 0
+
| Ender dragon death
 +
  |
 
  |-
 
  |-
  | largeexplosion
+
  | 1029
  | 1
+
| Anvil destroyed
 +
  |  
 
  |-
 
  |-
  | hugeexplosion
+
  | 1030
  | 2
+
| Anvil used
 +
  |  
 
  |-
 
  |-
  | fireworksSpark
+
  | 1031
  | 3
+
| Anvil landed
 +
  |
 
  |-
 
  |-
  | bubble
+
  | 1032
  | 4
+
| Portal travel
 +
  |  
 
  |-
 
  |-
  | splash
+
  | 1033
  | 5
+
| Chorus flower grown
 +
  |
 
  |-
 
  |-
  | wake
+
  | 1034
  | 6
+
| Chorus flower died
 +
  |  
 
  |-
 
  |-
  | suspended
+
  | 1035
  | 7
+
| Brewing stand brewed
 +
  |
 
  |-
 
  |-
  | depthsuspend
+
  | 1036
  | 8
+
| Iron trapdoor opened
 +
  |  
 
  |-
 
  |-
  | crit
+
  | 1037
  | 9
+
| Iron trapdoor closed
 +
  |
 
  |-
 
  |-
  | magicCrit
+
  !colspan="3"| Particle
| 10
 
 
  |-
 
  |-
  | smoke
+
  | 2000
  | 11
+
| Spawns 10 smoke particles, e.g. from a fire
 +
  | Direction, see below
 
  |-
 
  |-
  | largesmoke
+
  | 2001
  | 12
+
  | Block break + block break sound
 +
| Block state, as an index into the global palette
 
  |-
 
  |-
  | spell
+
  | 2002
  | 13
+
  | Splash potion. Particle effect + glass break sound.
 +
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
  |-
 
  |-
  | instantSpell
+
  | 2003
  | 14
+
| Eye of Ender entity break animation — particles and sound
 +
  |  
 
  |-
 
  |-
  | mobSpell
+
  | 2004
  | 15
+
| Mob spawn particle effect: smoke + flames
 +
  |  
 
  |-
 
  |-
  | mobSpellAmbient
+
  | 2005
  | 16
+
  | Bonemeal particles
 +
| How many particles to spawn (if set to 0, 15 are spawned)
 
  |-
 
  |-
  | witchMagic
+
  | 2006
  | 17
+
| Dragon breath
 +
  |
 
  |-
 
  |-
  | dripWater
+
  | 2007
  | 18
+
  | Instant splash potion
 +
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
  |-
 
  |-
  | dripLava
+
  | 3000
  | 19
+
| End gateway spawn
 +
  |  
 
  |-
 
  |-
  | angryVillager
+
  | 3001
  | 20
+
  | Enderdragon growl
 +
|
 +
|}
 +
 
 +
Smoke directions:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Direction
 
  |-
 
  |-
  | happyVillager
+
  | 0
  | 21
+
  | South-East
 
  |-
 
  |-
  | townaura
+
  | 1
  | 22
+
  | South
 
  |-
 
  |-
  | note
+
  | 2
  | 23
+
  | South-West
 
  |-
 
  |-
  | portal
+
  | 3
  | 24
+
  | East
 
  |-
 
  |-
  | enchantmenttable
+
  | 4
  | 25
+
  | (Up or middle ?)
 
  |-
 
  |-
  | flame
+
  | 5
  | 26
+
  | West
 
  |-
 
  |-
  | lava
+
  | 6
  | 27
+
  | North-East
 
  |-
 
  |-
  | footstep
+
  | 7
  | 28
+
  | North
 
  |-
 
  |-
  | cloud
+
  | 8
| 29
+
  | North-West
|-
 
| reddust
 
| 30
 
|-
 
| snowballpoof
 
| 31
 
|-
 
| snowshovel
 
| 32
 
|-
 
| slime
 
| 33
 
|-
 
| heart
 
| 34
 
  |-
 
| barrier
 
| 35
 
|-
 
| iconcrack_(id)_(data)
 
| 36
 
|-
 
| blockcrack_(id+(data<<12))
 
| 37
 
|-
 
| blockdust_(id)
 
| 38
 
|-
 
| droplet
 
| 39
 
|-
 
| take
 
| 40
 
|-
 
| mobappearance
 
| 41
 
 
  |}
 
  |}
  
==== Change Game State ====
+
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.
 +
 
 +
==== Particle ====
  
It appears when a bed can't be used as a spawn point and when the rain state changes.
+
Displays the named particle
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,173: Line 2,541:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x2B
+
  |rowspan="11"| 0x24
  |rowspan="2"| Play
+
  |rowspan="11"| Play
  |rowspan="2"| Client
+
  |rowspan="11"| Client
  | Reason
+
  | Particle ID
  | Unsigned Byte
+
  | Int
  | See below
+
  | The particle ID listed in [[#Particle|the particle data type]].
 +
|-
 +
| Long Distance
 +
| Boolean
 +
| If true, particle distance increases from 256 to 65536
 
  |-
 
  |-
  | Value
+
  | X
  | Float
+
  | Double
  | Depends on reason
+
  | X position of the particle
|}
 
 
 
''Reason codes'':
 
 
 
{| class="wikitable"
 
! Code
 
! Effect
 
! Value
 
 
  |-
 
  |-
  | 0
+
  | Y
  | Invalid Bed
+
  | Double
  |  
+
  | Y position of the particle
 
  |-
 
  |-
  | 1
+
  | Z
  | End raining
+
  | Double
  |  
+
  | Z position of the particle
 
  |-
 
  |-
  | 2
+
  | Offset X
  | Begin raining
+
  | Float
  |  
+
  | This is added to the X position after being multiplied by random.nextGaussian()
 
  |-
 
  |-
  | 3
+
  | Offset Y
  | Change game mode
+
  | Float
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
+
  | This is added to the Y position after being multiplied by random.nextGaussian()
 
  |-
 
  |-
  | 4
+
  | Offset Z
  | Enter credits
+
  | Float
  |  
+
  | This is added to the Z position after being multiplied by random.nextGaussian()
 
  |-
 
  |-
  | 5
+
  | Particle Data
  | Demo message
+
  | Float
  | 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
+
  | The data of each particle
|-
 
| 6
 
| Arrow hitting player
 
| Appears to be played when an arrow strikes another player in Multiplayer
 
 
  |-
 
  |-
  | 7
+
  | Particle Count
  | Fade value
+
  | Int
  | The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
+
  | The number of particles to create
 
  |-
 
  |-
  | 8
+
  | Data
  | Fade time
+
  | Varies
  | Time in ticks for the sky to fade
+
  | The variable data listed in [[#Particle|the particle data type]].
|-
 
| 10
 
| Play mob appearance (effect and sound)
 
 
  |}
 
  |}
  
==== Spawn Global Entity ====
+
==== Update Light ====
  
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.
+
Updates light levels for a chunk.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,240: Line 2,597:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x2C
+
  |rowspan="10"| 0x25
  |rowspan="5"| Play
+
  |rowspan="10"| Play
  |rowspan="5"| Client
+
  |rowspan="10"| Client
  | Entity ID
+
  |colspan="2"| Chunk X
  | VarInt
+
  |colspan="2"| VarInt
  | The EID of the thunderbolt
+
  | Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
|colspan="2"| Chunk Z
 +
|colspan="2"| VarInt
 +
| Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
|colspan="2"| Sky Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, with the lowest bit corresponding to chunk section -1 (in the void, y=-16 to y=-1) and the highest bit for chunk section 16 (above the world, y=256 to y=271)
 
  |-
 
  |-
  | Type
+
  |colspan="2"| Block Light Mask
  | Byte
+
  |colspan="2"| VarInt
  | The global entity type, currently always 1 for thunderbolt
+
  | Mask containing 18 bits, with the same order as sky light
 
  |-
 
  |-
  | X
+
  |colspan="2"| Empty Sky Light Mask
  | Int
+
  |colspan="2"| VarInt
  | Thunderbolt X, a [[Data Types#Fixed-point numbers|fixed-point number]]
+
  | 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.
 
  |-
 
  |-
  | Y
+
  |colspan="2"| Empty Block Light Mask
  | Int
+
  |colspan="2"| VarInt
  | Thunderbolt Y, a [[Data Types#Fixed-point numbers|fixed-point number]]
+
  | 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.
 
  |-
 
  |-
  | Z
+
  |rowspan="2"| Sky Light arrays
  | Int
+
| Length
  | Thunderbolt Z, a [[Data Types#Fixed-point numbers|fixed-point number]]
+
|rowspan="2"| Array
  |}
+
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Sky Light array
 +
  | Array of 2048 bytes
 +
  | There is 1 array for each bit set to true in the sky light mask, starting with the lowest value.  Half a byte per light value.
 +
|-
 +
|rowspan="2"| Block Light arrays
 +
| Length
 +
|rowspan="2"| Array
 +
| VarInt
 +
| Length of the following array in bytes (always 2048)
 +
|-
 +
| Block Light array
 +
| Array of 2048 bytes
 +
| There is 1 array for each bit set to true in the block light mask, starting with the lowest value.  Half a byte per light value.
 +
  |}
  
==== Open Window ====
+
Individual block or sky light arrays are is given for each block with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates. Even-indexed items (those with an even x coordinate, starting at 0) are packed into the low bits, odd-indexed into the high bits.
 +
 
 +
==== Join Game ====
  
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.
+
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,280: Line 2,663:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x2D
+
  |rowspan="9"| 0x26
  |rowspan="5"| Play
+
  |rowspan="9"| Play
  |rowspan="5"| Client
+
  |rowspan="9"| Client
  | Window ID
+
  | Entity ID
 +
| Int
 +
| The player's Entity ID (EID)
 +
|-
 +
| Gamemode
 
  | Unsigned Byte
 
  | Unsigned Byte
  | A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
+
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
 
  |-
 
  |-
  | Window Type
+
  | Dimension
  | String
+
  | Int Enum
  | The window type to use for display. See below
+
  | -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
 
  |-
 
  |-
  | Window Title
+
  | Hashed seed
  | [[Chat]]
+
  | Long
  | The title of the window
+
  | First 8 bytes of the SHA-256 hash of the world's seed.
 
  |-
 
  |-
  | Number Of Slots
+
  | Max Players
 
  | Unsigned Byte
 
  | Unsigned Byte
  | Number of slots in the window (excluding the number of slots in the player inventory)
+
  | Was once used by the client to draw the player list, but now is ignored
 +
|-
 +
| Level Type
 +
| String Enum (16)
 +
| default, flat, largeBiomes, amplified, customized, buffet, default_1_1
 
  |-
 
  |-
  | Entity ID
+
  | View Distance
  | Optional Int
+
  | VarInt
  | EntityHorse's EID. Only sent when Window Type is “EntityHorse”
+
  | Render distance (2-32)
 +
|-
 +
| Reduced Debug Info
 +
| Boolean
 +
| If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}. For servers in development, this should almost always be false.
 +
|-
 +
| Enable respawn screen
 +
| Boolean
 +
| Set to false when the doImmediateRespawn gamerule is true
 
  |}
 
  |}
  
See [[Inventory#Windows|inventory windows]] for further information.
+
==== Map Data ====
  
==== Close Window ====
+
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
 
 
This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open.
 
 
 
Note, notchian clients send a close window packet with Window ID 0 to close their inventory even though there is never an [[#Open Window|Open Window]] packet for inventory.  
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,316: Line 2,711:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x2E
+
  |rowspan="17"| 0x27
  |rowspan="1"| Play
+
  |rowspan="17"| Play
  |rowspan="1"| Client
+
  |rowspan="17"| Client
  | Window ID
+
  |colspan="2"| Map ID
| Unsigned Byte
+
  |colspan="2"| VarInt
| This is the ID of the window that was closed. 0 for inventory.
+
  | Map ID of the map being modified
  |}
 
 
 
==== Set Slot ====
 
 
 
Sent by the server when an item in a slot (in a window) is added/removed.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x2F
+
  |colspan="2"| Scale
  |rowspan="3"| Play
+
  |colspan="2"| Byte
  |rowspan="3"| Client
+
| From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
  | Window ID
+
  |-
| Byte
+
|colspan="2"| Tracking Position
  | 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).
+
  |colspan="2"| Boolean
 +
  | Specifies whether player and item frame icons are shown
 
  |-
 
  |-
  | Slot
+
  |colspan="2"| Locked
  | Short
+
|colspan="2"| Boolean
  | The slot that should be updated
+
| 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
 
  |-
 
  |-
  | Slot Data
+
  |rowspan="6"| Icon
  | [[Slot Data|Slot]]
+
| Type
  |  
+
|rowspan="6"| Array
 +
| VarInt enum
 +
| See below
 +
|-
 +
| X
 +
| Byte
 +
| Map coordinates: -128 for furthest left, +127 for furthest right
 +
|-
 +
| Z
 +
| Byte
 +
| Map coordinates: -128 for highest, +127 for lowest
 +
|-
 +
| Direction
 +
| Byte
 +
| 0-15
 +
|-
 +
| Has Display Name
 +
| Boolean
 +
|
 +
|-
 +
| Display Name
 +
  | Optional [[Chat]]
 +
| Only present if previous Boolean is true
 +
|-
 +
|colspan="2"| Columns
 +
|colspan="2"| Unsigned Byte
 +
| Number of columns updated
 +
|-
 +
|colspan="2"| Rows
 +
|colspan="2"| Optional Byte
 +
| Only if Columns is more than 0; number of rows updated
 +
|-
 +
|colspan="2"| X
 +
|colspan="2"| Optional Byte
 +
| Only if Columns is more than 0; x offset of the westernmost column
 +
|-
 +
|colspan="2"| Z
 +
|colspan="2"| Optional Byte
 +
| Only if Columns is more than 0; z offset of the northernmost row
 +
|-
 +
|colspan="2"| Length
 +
|colspan="2"| Optional VarInt
 +
| Only if Columns is more than 0; length of the following array
 +
|-
 +
|colspan="2"| Data
 +
|colspan="2"| Optional Array of Unsigned Byte
 +
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
  |}
 
  |}
  
==== Window Items ====
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
  
[[File:Inventory-slots.png|thumb|The inventory slots]]
+
Types are based off of rows and columns in <code>map_icons.png</code>:
 
 
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"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x30
+
  ! Icon type
|rowspan="3"| Play
+
  ! Result
  |rowspan="3"| Client
+
  |-
  | Window ID
+
  | 0
  | Unsigned Byte
+
  | White arrow (players)
  | The ID of window which items are being sent for. 0 for player inventory.
 
 
  |-
 
  |-
  | Count
+
  | 1
  | Short
+
  | Green arrow (item frames)
| Number of elements in the following array
 
 
  |-
 
  |-
  | Slot Data
+
  | 2
  | Array of [[Slot Data|Slot]]
+
  | Red arrow
|
 
|}
 
 
 
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"| 0x31
+
  | 3
|rowspan="3"| Play
+
  | Blue arrow
|rowspan="3"| Client
 
| Window ID
 
| Unsigned Byte
 
  |  
 
 
  |-
 
  |-
  | Property
+
  | 4
  | Short
+
  | White cross
| The property to be updated, see below
 
 
  |-
 
  |-
  | Value
+
  | 5
  | Short
+
  | Red pointer
  | The new value for the property, see below
+
  |-
  |}
+
  | 6
 
+
| White circle (off-map players)
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.
+
|-
 
+
| 7
{| class="wikitable"
+
| Small white circle (far-off-map players)
 
  |-
 
  |-
  ! Window type
+
  | 8
  ! Property
+
  | Mansion
! Value
 
 
  |-
 
  |-
  |rowspan="2"| Furnace
+
  | 9
| 0: Progress arrow
+
  | Temple
  | 0–200 (presumably in in-game ticks)
 
 
  |-
 
  |-
  | 1: Fire icon (fuel)
+
  | 10
  | 0–200 (presumably in in-game ticks)
+
  | White Banner
 
  |-
 
  |-
  |rowspan="6"| Enchantment Table
+
  | 11
  | 0: Level requirement for top enchantment slot
+
  | Orange Banner
|rowspan="3"| The enchantment's xp level requirement
 
 
  |-
 
  |-
  | 1: Level requirement for middle enchantment slot
+
  | 12
 +
| Magenta Banner
 
  |-
 
  |-
  | 2: Level requirement for bottom enchantment slot
+
  | 13
 +
| Light Blue Banner
 
  |-
 
  |-
  | 3: Xp seed | The seed for generating the enchantments view for the client
+
  | 14
 +
| Yellow Banner
 
  |-
 
  |-
  | 4: tooltip shown on mouse hover over top enchantment slot
+
  | 15
  |rowspan="3"| Unknown (set to -1 to hide it)
+
  | Lime Banner
 
  |-
 
  |-
  | 5: tooltip shown on mouse hover over middle enchantment slot
+
  | 16
 +
| Pink Banner
 
  |-
 
  |-
  | 6: tooltip shown on mouse hover over bottom enchantment slot
+
  | 17
 +
| Gray Banner
 
  |-
 
  |-
  |rowspan="3"| Beacon
+
  | 18
| 0: Power level
+
  | Light Gray Banner
  | Unknown
 
 
  |-
 
  |-
  | 1: First potion effect
+
  | 19
  | Unknown
+
  | Cyan Banner
 
  |-
 
  |-
  | 2: Second potion effect
+
  | 20
  | Unknown
+
  | Purple Banner
 
  |-
 
  |-
  | Anvil
+
  | 21
  | 0: Repair cost
+
  | Blue Banner
| The repair's cost in xp levels
 
 
  |-
 
  |-
  | Brewing Stand
+
  | 22
  | 0: Brew time
+
  | Brown Banner
  | 0–400, with 400 making the arrow empty, and 0 making the arrow full
+
  |-
  |}
+
  | 23
 
+
| Green Banner
==== Confirm Transaction ====
 
 
 
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag). This packet is also sent from the client to the server in response to a server transaction rejection packet.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x32
+
  | 24
|rowspan="3"| Play
+
  | Red Banner
|rowspan="3"| Client
 
| Window ID
 
| Byte
 
  | The ID of the window that the action occurred in
 
 
  |-
 
  |-
  | Action Number
+
  | 25
  | Short
+
  | Black Banner
| Every action that is to be accepted has a unique number. This field corresponds to that number.
 
 
  |-
 
  |-
  | Accepted
+
  | 26
  | Boolean
+
  | Treasure marker
| Whether the action was accepted
 
 
  |}
 
  |}
  
==== Update Sign ====
+
==== Trade List ====
  
This message is sent from the server to the client whenever a sign is discovered or created. This message is NOT sent when a sign is destroyed or unloaded.
+
The list of trades a villager NPC is offering.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,503: Line 2,888:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x33
+
  |rowspan="18"| 0x28
  |rowspan="5"| Play
+
  |rowspan="18"| Play
  |rowspan="5"| Client
+
  |rowspan="18"| Client
  | Location
+
  |-
  | Position
+
  | colspan="2" | Window ID
  |  
+
| colspan="2" | VarInt
 +
  | The ID of the window that is open; this is an int rather than a byte.
 
  |-
 
  |-
  | Line 1
+
  | colspan="2" | Size
  | [[Chat]]
+
  | colspan="2" | Byte
  | First line of text in the sign
+
  | The number of trades in the following array
 
  |-
 
  |-
  | Line 2
+
  | rowspan="11" | Trades
  | [[Chat]]
+
| Input item 1
  | Second line of text in the sign
+
| rowspan="11" | Array
 +
  | [[Slot]]
 +
  | The first item the villager is buying
 
  |-
 
  |-
  | Line 3
+
  | Output item
  | [[Chat]]
+
| [[Slot]]
  | Third line of text in the sign
+
| The item the villager is selling
 +
|-
 +
| Has second item
 +
| Boolean
 +
| Whether there is a second item
 +
|-
 +
| Input item 2
 +
  | Optional [[Slot]]
 +
  | The second item the villager is buying; only present if they have a second item.
 +
|-
 +
| Trade disabled
 +
| Boolean
 +
| True if the trade is disabled; false if the trade is enabled.
 +
|-
 +
| Number of trade uses
 +
| Integer
 +
| Number of times the trade has been used so far
 +
|-
 +
| Maximum number of trade uses
 +
| Integer
 +
| Number of times this trade can be used
 +
|-
 +
| XP
 +
| Integer
 +
|
 +
|-
 +
| Special Price
 +
| Integer
 +
|
 +
|-
 +
| Price Multiplier
 +
| Float
 +
|
 +
|-
 +
| Demand
 +
| Integer
 +
|
 +
|-
 +
|colspan="2"| Villager level
 +
|colspan="2"| VarInt
 +
| Appears on the trade GUI; meaning comes from the translation key <code>merchant.level.</code> + level.
 +
1: Novice, 2: Apprentice, 3: Journeyman, 4: Expert, 5: Master
 +
|-
 +
|colspan="2"| Experience
 +
|colspan="2"| VarInt
 +
| Total experience for this villager (always 0 for the wandering trader)
 +
|-
 +
|colspan="2"| Is regular villager
 +
|colspan="2"| Boolean
 +
| True if this is a regular villager; false for the wandering trader.  When false, hides the villager level and some other GUI elements.
 
  |-
 
  |-
  | Line 4
+
  |colspan="2"| Can restock
  | [[Chat]]
+
  |colspan="2"| Boolean
  | Fourth line of text in the sign
+
  | 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.
 
  |}
 
  |}
  
==== Maps ====
+
[[File:1.14-merchant-slots.png|thumb|The merchant UI, for reference]]
 +
{{-}}
  
Updates a rectangular area on a map.
+
==== Entity Position ====
 +
 
 +
This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Entity Teleport|Entity Teleport]] should be sent instead.
 +
 
 +
This packet allows at most 8 blocks movement in any direction, because short range is from -32768 to 32767. And <code>32768 / (128 * 32)</code> = 8.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,539: Line 2,981:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="12"| 0x34
+
  |rowspan="5"| 0x29
  |rowspan="12"| Play
+
  |rowspan="5"| Play
  |rowspan="12"| Client
+
  |rowspan="5"| Client
  |colspan="2"| Item Damage
+
  | Entity ID
  |colspan="2"| VarInt
+
  | VarInt
  | The damage value (map ID) of the map being modified
+
  |  
 
  |-
 
  |-
  |colspan="2"| Scale
+
  | Delta X
|colspan="2"| Byte
+
  | Short
  |  
+
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
  |-  
 
|colspan="2"| Icon Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  | Delta Y
| Direction And Type
+
  | Short
|rowspan="3"| Array
+
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
  | Byte
 
  | 0xF0 = Direction, 0x0F = Type
 
 
  |-
 
  |-
  | X
+
  | Delta Z
  | Byte
+
  | Short
  |  
+
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 
  |-
 
  |-
  | Z
+
  | On Ground
  | Byte
+
  | Boolean
 
  |  
 
  |  
|-
 
|colspan="2"| Columns
 
|colspan="2"| Byte
 
| Number of columns updated
 
|-
 
|colspan="2"| Rows
 
|colspan="2"| Optional Byte
 
| Only if Columns is more than 0; number of rows updated
 
|-
 
|colspan="2"| X
 
|colspan="2"| Optional Byte
 
| Only if Columns is more than 0; x offset of the westernmost column
 
|-
 
|colspan="2"| Z
 
|colspan="2"| Optional Byte
 
| Only if Columns is more than 0; z offset of the northernmost row
 
|-
 
|colspan="2"| Length
 
|colspan="2"| Optional VarInt
 
| Only if Columns is more than 0; length of the following array
 
|-
 
|colspan="2"| Data
 
|colspan="2"| Optional Array of Unsigned Byte
 
| Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
 
  |}
 
  |}
  
==== Update Block Entity ====
+
==== Entity Position and Rotation ====
  
Essentially a block update on a block entity.
+
This packet is sent by the server when an entity rotates and moves. Since a short range is limited from -32768 to 32767, and movement is offset of fixed-point numbers, this packet allows at most 8 blocks movement in any direction. (<code>-32768 / (32 * 128) == -8</code>)
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,609: Line 3,021:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x35
+
  |rowspan="7"| 0x2A
  |rowspan="3"| Play
+
  |rowspan="7"| Play
  |rowspan="3"| Client
+
  |rowspan="7"| Client
  | Location
+
  | Entity ID
  | Position
+
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Action
+
  | Delta X
  | Unsigned Byte
+
  | Short
  | The type of update to perform, see below
+
  | 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
 
  |-
 
  |-
  | NBT Data
+
  | On Ground
  | Optional [[NBT|NBT Tag]]
+
  | Boolean
  | If not present then it's a TAG_END (0)
+
  |  
 
  |}
 
  |}
  
''Action'' field:
+
==== Entity Rotation ====
  
* '''1''': Set SpawnPotentials of a mob spawner
+
This packet is sent by the server when an entity rotates.
* '''2''': Set command block text (command and last execution status)
 
* '''3''': Set the level, primary, and secondary powers of a beacon
 
* '''4''': Set rotation and skin of mob head
 
* '''5''': Set type of flower in flower pot
 
* '''6''': Set base color and patterns on a banner
 
 
 
==== Sign Editor Open ====
 
 
 
Sent on placement of sign.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,646: Line 3,065:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x36
+
  |rowspan="4"| 0x2B
  |rowspan="1"| Play
+
  |rowspan="4"| Play
  |rowspan="1"| Client
+
  |rowspan="4"| Client
  | Location
+
  | Entity ID
  | Position
+
  | VarInt
 +
|
 +
|-
 +
| Yaw
 +
| Angle
 +
| New angle, not a delta
 +
|-
 +
| Pitch
 +
| Angle
 +
| New angle, not a delta
 +
|-
 +
| On Ground
 +
| Boolean
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Statistics ====
+
==== Entity Movement ====
 +
 
 +
This packet may be used to initialize an entity.
 +
 
 +
For player entities, either this packet or any move/look packet is sent every game tick. So the meaning of this packet is basically that the entity did not move/look since the last such packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
  ! Bound To  
+
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x37
+
  |rowspan="1"| 0x2C
  |rowspan="3"| Play
+
  |rowspan="1"| Play
  |rowspan="3"| Client
+
  |rowspan="1"| Client
  |colspan="2"| Count
+
  | Entity ID
|colspan="2"| VarInt
 
| Number of elements in the following array
 
|-
 
|rowspan="2"| Statistic
 
| Name
 
|rowspan="2"| Array
 
| String
 
| [https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0 https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0]
 
|-
 
| Value
 
 
  | VarInt
 
  | VarInt
  | The amount to set it to
+
  |  
 
  |}
 
  |}
  
==== Player List Item ====
+
==== Vehicle Move (clientbound) ====
  
Sent by the notchian server to update the user list (<tab> in the client).
+
Note that all fields use absolute positioning and do not allow for relative positioning.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,690: Line 3,115:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="4"| Field Name
+
  ! Field Name
  !colspan="3"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="19"| 0x38
+
  |rowspan="5"| 0x2D
  |rowspan="19"| Play
+
  |rowspan="5"| Play
  |rowspan="19"| Client
+
  |rowspan="5"| Client
  |colspan="4"| Action
+
  | X
  |colspan="3"| VarInt
+
  | Double
  | Determines the rest of the Player format after the UUID
+
  | Absolute position (X coordinate)
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  | Y
  |colspan="3"| VarInt
+
  | Double
  | Number of elements in the following array
+
  | Absolute position (Y coordinate)
 
  |-
 
  |-
  |rowspan="17"| Player
+
  | Z
|colspan="3"| UUID
+
  | Double
  |rowspan="17"| Array
+
  | Absolute position (Z coordinate)
|colspan="2"| UUID
 
  |  
 
 
  |-
 
  |-
  ! Action
+
  | Yaw
  !colspan="2"| Field Name
+
  | Float
  !colspan="2"|  
+
  | Absolute rotation on the vertical axis, in degrees
!
 
 
  |-
 
  |-
  |rowspan="10"| 0: add player
+
  | Pitch
|colspan="2"| Name
+
| Float
  |colspan="2"| String
+
| Absolute rotation on the horizontal axis, in degrees
  |
+
|}
 +
 
 +
==== Open Book ====
 +
 
 +
Sent when a player right clicks with a signed book. This tells the client to open the book GUI.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  |rowspan="1"| 0x2E
  |colspan="2"| VarInt
+
  |rowspan="1"| Play
  | Number of elements in the following array
+
|rowspan="1"| Client
 +
| Hand
 +
| VarInt enum
 +
| 0: Main hand, 1: Off hand
 +
  |}
 +
 
 +
==== 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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  |rowspan="4"| Property
+
  |rowspan="3"| 0x2F
  | Name
+
  |rowspan="3"| Play
  |rowspan="4"| Array
+
  |rowspan="3"| Client
  | String
+
| Window ID
  |  
+
  | VarInt
 +
  | A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
  |-
 
  |-
  | Value
+
  | Window Type
  | String
+
  | VarInt
|
+
  | The window type to use for display. Contained in the <code>minecraft:menu</code> regisry; see [[Inventory]] for the different values.
|-
 
| Is Signed
 
| Boolean
 
  |  
 
 
  |-
 
  |-
  | Signature
+
  | Window Title
  | Optional String
+
  | [[Chat]]
| Only if Is Signed is true
+
  | The title of the window
|-
+
  |}
|colspan="2"| Gamemode
+
 
|colspan="2"| VarInt
+
==== Open Sign Editor ====
|
 
|-
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
|
 
|-
 
|colspan="2"| Has Display Name
 
|colspan="2"| Boolean
 
|
 
|-
 
|colspan="2"| Display Name
 
|colspan="2"| Optional [[Chat]]
 
  | Only if Has Display Name is true
 
|-
 
| 1: update gamemode
 
|colspan="2"| Gamemode
 
|colspan="2"| VarInt
 
|
 
|-
 
| 2: update latency
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
|
 
|-
 
|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"|
 
|
 
  |}
 
 
 
==== Player Abilities ====
 
  
The latter 2 floats are used to indicate the walking and flying speeds respectively, while the first byte is used to determine the value of 4 booleans.
+
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.
 
 
The flags are whether damage is disabled (god mode, 8, bit 3), whether the player can fly (4, bit 2), whether the player is flying (2, bit 1), and whether the player is in creative mode (1, bit 0).
 
 
 
To get the values of these booleans, simply AND (&) the byte with 1,2,4 and 8 respectively, to get the 0 or 1 bitwise value. To set them OR (|) them with their repspective masks.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,800: Line 3,203:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x39
+
  |rowspan="1"| 0x30
  |rowspan="3"| Play
+
  |rowspan="1"| Play
  |rowspan="3"| Client
+
  |rowspan="1"| Client
  | Flags
+
  | Location
  | Byte
+
  | Position
| Bit mask, see above
 
|-
 
| Flying Speed
 
| Float
 
|
 
|-
 
| Walking Speed
 
| Float
 
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Tab-Complete ====
+
==== Craft Recipe Response ====
  
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported.
+
Response to the serverbound packet ([[#Craft Recipe Request|Craft Recipe Request]]), with the same recipe ID.  Appears to be used to notify the UI.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,828: Line 3,223:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  |rowspan="2"| 0x31
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Count
+
  | Window ID
  | VarInt
+
  | Byte
  | Number of elements in the following array
+
  |
 
  |-
 
  |-
  | Matches
+
  | Recipe
  | Array of String
+
  | Identifier
  | One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
  | A recipe ID
 
  |}
 
  |}
  
==== 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 2,852: Line 3,247:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x3B
+
  |rowspan="3"| 0x32
  |rowspan="4"| Play
+
  |rowspan="3"| Play
  |rowspan="4"| Client
+
  |rowspan="3"| Client
  | Objective Name
+
  | Flags
| String
 
| 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
+
  | 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
+
  | 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 [[Protocol#Entity_Properties|Entity Properties]] packet, which defaults to 0.1 for players.
 
  |}
 
  |}
  
==== Update Score ====
+
About the flags:
 
 
This is sent to the client when it should update a scoreboard item.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x3C
+
  ! Field
|rowspan="4"| Play
+
  ! Bit
  |rowspan="4"| Client
+
  |-
  | Score Name
+
  | Invulnerable
  | String
+
  | 0x01
  | The name of the score to be updated or removed
 
 
  |-
 
  |-
  | Action
+
  | Flying
  | Byte
+
  | 0x02
| 0 to create/update an item. 1 to remove an item.
 
 
  |-
 
  |-
  | Objective Name
+
  | Allow Flying
  | String
+
  | 0x04
| The name of the objective the score belongs to
 
 
  |-
 
  |-
  | Value
+
  | Creative Mode (Instant Break)
  | Optional VarInt
+
  | 0x08
| The score to be displayed next to the entry. Only sent when Action does not equal 1.
 
 
  |}
 
  |}
  
==== Display Scoreboard ====
+
==== Combat Event ====
 
 
This is sent to the client when it should display a scoreboard.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,912: Line 3,289:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3D
+
  |rowspan="8"| 0x33
  |rowspan="2"| Play
+
  |rowspan="8"| Play
  |rowspan="2"| Client
+
  |rowspan="8"| Client
  | Position
+
  |colspan="2"| Event
  | Byte
+
  | VarInt Enum
  | The position of the scoreboard. 0: list, 1: sidebar, 2: below name.
+
  | Determines the layout of the remaining packet
 +
|-
 +
! Event
 +
! Field Name
 +
!
 +
!
 
  |-
 
  |-
  | Score Name
+
  | 0: enter combat
  | String
+
  | ''no fields''
  | The unique name for the scoreboard to be displayed.
+
| ''no fields''
  |}
+
|
 +
|-
 +
|rowspan="2"| 1: end combat
 +
| Duration
 +
| VarInt
 +
|
 +
|-
 +
| Entity ID
 +
| Int
 +
|
 +
|-
 +
|rowspan="3"| 2: entity dead
 +
| Player ID
 +
| VarInt
 +
|
 +
|-
 +
| Entity ID
 +
| Int
 +
|
 +
|-
 +
| Message
 +
| [[Chat]]
 +
  |  
 +
  |}
  
==== Teams ====
+
==== Player Info ====
  
Creates and updates teams.
+
Sent by the server to update the user list (<tab> in the client).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,936: Line 3,341:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="4"| Field Name
  ! Field Type
+
  !colspan="3"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="10"| 0x3E
+
  |rowspan="19"| 0x34
  |rowspan="10"| Play
+
  |rowspan="19"| Play
  |rowspan="10"| Client
+
  |rowspan="19"| Client
  | Team Name
+
  |colspan="4"| Action
  | String
+
  |colspan="3"| VarInt
  | A unique name for the team. (Shared with scoreboard).
+
  | Determines the rest of the Player format after the UUID
 
  |-
 
  |-
  | Mode
+
  |colspan="4"| Number Of Players
  | Byte
+
  |colspan="3"| VarInt
  | If 0 then the team is created.
+
  | Number of elements in the following array
 
 
If 1 then the team is removed.
 
 
 
If 2 the team team information is updated.
 
 
 
If 3 then new players are added to the team.
 
 
 
If 4 then players are removed from the team.
 
 
  |-
 
  |-
  | Team Display Name
+
  |rowspan="17"| Player
  | Optional String
+
  |colspan="3"| UUID
  | Only if Mode = 0 or 2.
+
  |rowspan="17"| Array
 +
|colspan="2"| UUID
 +
|
 
  |-
 
  |-
  | Team Prefix
+
  ! Action
  | Optional String
+
  !colspan="2"| Field Name
  | Only if Mode = 0 or 2. Displayed before the players' name that are part of this team
+
  !colspan="2"|
 +
!
 
  |-
 
  |-
  | Team Suffix
+
  |rowspan="10"| 0: add player
  | Optional String
+
  |colspan="2"| Name
  | Only if Mode = 0 or 2. Displayed after the players' name that are part of this team
+
  |colspan="2"| String (16)
 +
|
 
  |-
 
  |-
  | Friendly Fire
+
  |colspan="2"| Number Of Properties
  | Optional Byte
+
  |colspan="2"| VarInt
  | Only if Mode = 0 or 2. 0 for off, 1 for on, 3 for seeing friendly invisibles
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Name Tag Visibility
+
|rowspan="4"| Property
  | Optional String
+
  | Name
  | Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never
+
  |rowspan="4"| Array
 +
| String (32767)
 +
|
 +
|-
 +
| Value
 +
| String (32767)
 +
|
 +
|-
 +
| Is Signed
 +
| Boolean
 +
  |  
 
  |-
 
  |-
  | Color
+
  | Signature
  | Optional Byte
+
  | Optional String (32767)
  | Only if Mode = 0 or 2. Same as [[Chat]] colors
+
  | Only if Is Signed is true
 
  |-
 
  |-
  | Player Count
+
  |colspan="2"| Gamemode
  | Optional VarInt
+
  |colspan="2"| VarInt
  | Only if Mode = 0 or 3 or 4. Number of players in the array
+
  |  
 
  |-
 
  |-
  | Players
+
  |colspan="2"| Ping
  | Optional Array of String
+
|colspan="2"| VarInt
  | Only if Mode = 0 or 3 or 4. Players to be added/remove from the team. Max 40 characters so may be uuid's later
+
| Measured in milliseconds
  |}
+
|-
 
+
|colspan="2"| Has Display Name
==== Plugin Message ====
+
|colspan="2"| Boolean
 
+
|
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>.
+
|-
 
+
|colspan="2"| Display Name
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/]
+
  |colspan="2"| Optional [[Chat]]
 +
  | Only if Has Display Name is true
 +
|-
 +
| 1: update gamemode
 +
|colspan="2"| Gamemode
 +
|colspan="2"| VarInt
 +
|
 +
  |-
 +
| 2: update latency
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
| Measured in milliseconds
 +
|-
 +
|rowspan="2"| 3: update display name
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
|colspan="2"| Optional [[Chat]]
 +
| Only send if Has Display Name is true
 +
|-
 +
| 4: remove player
 +
|colspan="2"| ''no fields''
 +
|colspan="2"| ''no fields''
 +
|
 +
|}
 +
 
 +
The Property field looks as in the response of [[Mojang API#UUID -> Profile + Skin/Cape]], except of course using the protocol format instead of JSON. That is, each player will usually have one property with Name “textures” and Value being a base64-encoded JSON string as documented at [[Mojang API#UUID -> Profile + Skin/Cape]]. An empty properties array is also acceptable, and will cause clients to display the player with one of the two default skins depending on UUID.
 +
 
 +
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.
 +
 
 +
==== Face Player ====
 +
 
 +
Used to rotate the client player to face the given location or entity (for <code>/teleport [<targets>] <x> <y> <z> facing</code>).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,006: Line 3,457:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3F
+
  |rowspan="8"| 0x35
  |rowspan="2"| Play
+
  |rowspan="8"| Play
  |rowspan="2"| Client
+
  |rowspan="8"| Client
| Channel
 
| String
 
| Name of the [[plugin channel]] used to send the data
 
 
  |-
 
  |-
  | Data
+
  | Feet/eyes
  | Byte Array
+
  | VarInt enum
  | Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].
+
  | Values are feet=0, eyes=1.  If set to eyes, aims using the head position; otherwise aims using the feet position.
 +
|-
 +
| Target x
 +
| Double
 +
| x coordinate of the point to face towards
 +
|-
 +
| Target y
 +
| Double
 +
| y coordinate of the point to face towards
 +
|-
 +
| Target z
 +
| Double
 +
| z coordinate of the point to face towards
 +
|-
 +
| Is entity
 +
| Boolean
 +
| If true, additional information about an entity is provided.
 +
|-
 +
| Entity ID
 +
| Optional VarInt
 +
| Only if is entity is true &mdash; the entity to face towards
 +
|-
 +
| Entity feet/eyes
 +
| Optional VarInt enum
 +
| Whether to look at the entity's eyes or feet.  Same values and meanings as before, just for the entity's head/feet.
 
  |}
 
  |}
  
==== Disconnect ====
+
If the entity given by entity ID cannot be found, this packet should be treated as if is entity was false.
 +
 
 +
==== Player Position And Look (clientbound) ====  
 +
 
 +
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
  
Sent by the server before it disconnects a client. The server assumes that the sender has already closed the connection by the time the packet arrives.
+
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?)”.
  
{| class="wikitable"
+
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”.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
| 0x40
 
|rowspan="1"| Play
 
|rowspan="1"| Client
 
| Reason
 
| [[Chat]]
 
| Displayed to the client when the connection terminates.
 
|}
 
  
==== Server Difficulty ====
+
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.
  
Changes the difficulty setting in the client's option menu
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,050: Line 3,512:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x41
+
  |rowspan="7"| 0x36
  |rowspan="1"| Play
+
  |rowspan="7"| Play
  |rowspan="1"| Client
+
  |rowspan="7"| Client
  | Difficulty
+
  | X
  | Unsigned Byte
+
  | Double
  | 0: peaceful, 1: easy, 2: normal, 3: hard
+
| Absolute or relative position, depending on Flags
 +
|-
 +
| Y
 +
| Double
 +
  | Absolute or relative position, depending on Flags
 +
|-
 +
| Z
 +
| Double
 +
| Absolute or relative position, depending on Flags
 +
|-
 +
| Yaw
 +
| Float
 +
| Absolute or relative rotation on the X axis, in degrees
 +
|-
 +
| Pitch
 +
| Float
 +
| Absolute or relative rotation on the Y axis, in degrees
 +
|-
 +
| Flags
 +
| Byte
 +
| Bit field, see below
 +
|-
 +
| Teleport ID
 +
| VarInt
 +
| Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
 
  |}
 
  |}
  
==== Combat Event ====
+
About the Flags field:
 +
 
 +
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Field
 +
! Bit
 +
|-
 +
| X
 +
| 0x01
 +
|-
 +
| Y
 +
| 0x02
 +
|-
 +
| Z
 +
| 0x04
 +
|-
 +
| Y_ROT
 +
| 0x08
 +
|-
 +
| X_ROT
 +
| 0x10
 +
|}
 +
 
 +
==== Unlock Recipes ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,068: Line 3,579:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x42
+
  |rowspan="10"| 0x37
  |rowspan="6"| Play
+
  |rowspan="10"| Play
  |rowspan="6"| Client
+
  |rowspan="10"| Client
  | Event
+
  |-
 +
| Action
 +
| VarInt
 +
| 0: init, 1: add, 2: remove
 +
|-
 +
| Crafting Recipe Book Open
 +
| Boolean
 +
| If true, then the crafting recipe book will be open when the player opens its inventory.
 +
|-
 +
| Crafting Recipe Book Filter Active
 +
| Boolean
 +
| If true, then the filtering option is active when the players opens its inventory.
 +
|-
 +
| Smelting Recipe Book Open
 +
| Boolean
 +
| If true, then the smelting recipe book will be open when the player opens its inventory.
 +
|-
 +
| Smelting Recipe Book Filter Active
 +
| Boolean
 +
| If true, then the filtering option is active when the players opens its inventory.
 +
|-
 +
| Array size 1
 
  | VarInt
 
  | VarInt
  | 0: enter combat, 1: end combat, 2: entity dead
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Duration
+
  | Recipe IDs
  | Optional VarInt
+
  | Array of Identifier
  | Only for end combat
+
  |
 
  |-
 
  |-
  | Player ID
+
  | Array size 2
 
  | Optional VarInt
 
  | Optional VarInt
  | Only for entity dead
+
  | Number of elements in the following array, only present if mode is 0 (init)
 
  |-
 
  |-
  | Entity ID
+
  | Recipe IDs
  | Optional Int
+
  | Optional Array of Identifier, only present if mode is 0 (init)
  | Only for end combat and entity dead
+
  |
|-
 
| Message
 
| String
 
| Only for entity dead
 
 
  |}
 
  |}
 +
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.
 +
 +
==== Destroy Entities ====
  
==== Camera ====
+
Sent by the server when a list of entities is to be destroyed on the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,102: Line 3,636:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x43
+
  |rowspan="2"| 0x38
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Camera ID
+
  | Count
 
  | VarInt
 
  | VarInt
  |  
+
  | Number of elements in the following array
 +
|-
 +
| Entity IDs
 +
| Array of VarInt
 +
| The list of entities of destroy
 
  |}
 
  |}
  
==== World Border ====  
+
==== Remove Entity Effect ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,116: Line 3,654:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="18"| 0x44
+
  |rowspan="2"| 0x39
  |rowspan="18"| Play
+
  |rowspan="2"| Play
  |rowspan="18"| Client
+
  |rowspan="2"| Client
  |colspan="2"| Action
+
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Determines the format of the rest of the packet
+
  |  
 
  |-
 
  |-
  ! Action
+
| Effect ID
 +
| Byte
 +
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 +
|}
 +
 
 +
==== Resource Pack Send ====
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 
  ! Field Name
 
  ! Field Name
  !  
+
  ! Field Type
  !  
+
  ! Notes
 
  |-
 
  |-
  | 0: set size
+
  |rowspan="2"| 0x3A
  | Radius
+
|rowspan="2"| Play
  | Double
+
|rowspan="2"| Client
  | meters
+
  | URL
 +
  | String (32767)
 +
  | The URL to the resource pack.
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
  | Hash
  | Old Radius
+
  | String (40)
  | Double
+
  | 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
  | meters
+
  |}
|-
+
 
| New Radius
+
==== Respawn ====
  | Double
+
 
  | meters
+
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.
  |-
+
 
  | Speed
+
{| class="wikitable"
  | VarLong
+
  ! Packet ID
  | number of real-time ticks/seconds (?) until New Radius is reached. From experiments, it appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag
+
  ! State
 +
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 2: set center
+
  |rowspan="4"| 0x3B
  | X
+
|rowspan="4"| Play
  | Double
+
|rowspan="4"| Client
  |  
+
  | Dimension
 +
  | Int Enum
 +
  | -1: The Nether, 0: The Overworld, 1: The End
 
  |-
 
  |-
  | Z
+
  | Hashed seed
  | Double
+
  | Long
  |  
+
  | First 8 bytes of the SHA-256 hash of the world's seed.
 
  |-
 
  |-
  |rowspan="8"| 3: initialize
+
  | Gamemode
  | X
+
  | Unsigned Byte
| Double
+
  | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
  |  
 
 
  |-
 
  |-
  | Z
+
  | Level Type
  | Double
+
  | String (16)
  |  
+
  | Same as [[#Join Game|Join Game]]
  |-
+
  |}
| Old Radius
+
 
  | Double
+
{{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.}}
  | New Radius
+
 
  | Double
+
==== Entity Head Look ====
  |
+
 
 +
Changes the direction an entity's head is facing.
 +
 
 +
While sending the Entity Look packet changes the vertical rotation of the head, sending this packet appears to be necessary to rotate the head horizontally.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
  ! State
 +
  ! Bound To
 +
  ! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Speed
+
  |rowspan="2"| 0x3C
| VarLong
+
  |rowspan="2"| Play
|
+
  |rowspan="2"| Client
|-
+
  | Entity ID
  | Portal Teleport Boundary
 
| VarInt
 
  | Resulting coordinates from a portal teleport are limited to +-value. Usually 29999984.
 
|-
 
  | Warning Time
 
 
  | VarInt
 
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Warning Blocks
+
  | Head Yaw
  | VarInt
+
  | Angle
|
+
  | New angle, not a delta
|-
 
|rowspan="1"| 4: set warning time
 
| Warning Time
 
| VarInt
 
| unit?
 
|-
 
|rowspan="1"| 5: set warning blocks
 
| Warning Blocks
 
| VarInt
 
  |  
 
 
  |}
 
  |}
  
==== Title ====  
+
==== Select Advancement Tab ====
 +
 
 +
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.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,209: Line 3,762:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x45
+
  |rowspan="2"| 0x3D
  |rowspan="9"| Play
+
  |rowspan="2"| Play
  |rowspan="9"| Client
+
  |rowspan="2"| Client
  |colspan="2"| Action
+
  | Has id
  | VarInt
+
  | Boolean
  |  
+
  | Indicates if the next field is present
 
  |-
 
  |-
  ! Action
+
  | Optional Identifier
  ! Field Name
+
| String (32767)
  !
+
  | See below
  !  
+
  |}
 +
 
 +
The Identifier can be one of the following:
 +
 
 +
{| class="wikitable"
 +
  ! Optional Identifier
 
  |-
 
  |-
  | 0: set title
+
  | minecraft:story/root
| Title Text
 
| [[Chat]]
 
|
 
 
  |-
 
  |-
  | 1: set subtitle
+
  | minecraft:nether/root
| Subtitle Text
 
| [[Chat]]
 
|
 
 
  |-
 
  |-
  |rowspan="3"| 2: set times and display
+
  | minecraft:end/root
| Fade In
 
| Int
 
| ticks
 
 
  |-
 
  |-
  | Stay
+
  | minecraft:adventure/root
| Int
 
| ticks
 
|-
 
| Fade Out
 
| Int
 
| ticks
 
 
  |-
 
  |-
  | 3: hide
+
  | minecraft:husbandry/root
| ''no fields''
 
|
 
|
 
|-
 
| 4: reset
 
| ''no fields''
 
|
 
|
 
 
  |}
 
  |}
  
“Hide” makes the title disappear, but if you run times again the same title will appear. “Reset” erases the text.
+
If no or an invalid identifier is sent, the client will switch to the first tab in the GUI.
  
==== Set Compression ====
+
==== World Border ====  
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,267: Line 3,802:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x46
+
  |rowspan="18"| 0x3E
  |rowspan="1"| Play
+
  |rowspan="18"| Play
  |rowspan="1"| Client
+
  |rowspan="18"| Client
  | Threshold
+
  |colspan="2"| Action
  | VarInt
+
  | VarInt Enum
  | Packets of this size or higher may be compressed
+
  | Determines the format of the rest of the packet
  |}
+
  |-
 
+
  ! Action
==== Player List Header/Footer ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
  ! Bound To
 
 
  ! Field Name
 
  ! Field Name
  ! Field Type
+
  !  
  ! Notes
+
  !  
 +
|-
 +
| 0: set size
 +
| Diameter
 +
| Double
 +
| Length of a single side of the world border, in meters
 +
|-
 +
|rowspan="3"| 1: lerp size
 +
| Old Diameter
 +
| Double
 +
| Current length of a single side of the world border, in meters
 +
|-
 +
| New Diameter
 +
| Double
 +
| Target length of a single side of the world border, in meters
 +
|-
 +
| Speed
 +
| VarLong
 +
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 
  |-
 
  |-
  |rowspan="2"| 0x47
+
  |rowspan="2"| 2: set center
|rowspan="2"| Play
+
  | X
|rowspan="2"| Client
+
  | Double
  | Header
 
  | [[Chat]]
 
 
  |  
 
  |  
 
  |-
 
  |-
  | Footer
+
  | Z
  | [[Chat]]
+
  | Double
 
  |  
 
  |  
  |}
+
|-
 
+
|rowspan="8"| 3: initialize
==== Resource Pack Send ====  
+
| X
 
+
| Double
{| class="wikitable"
+
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Old Diameter
 +
| Double
 +
| Current length of a single side of the world border, in meters
 +
|-
 +
| New Diameter
 +
| Double
 +
| Target length of a single side of the world border, in meters
 +
|-
 +
| Speed
 +
| VarLong
 +
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 +
|-
 +
| Portal Teleport Boundary
 +
| VarInt
 +
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 +
|-
 +
| Warning Time
 +
| VarInt
 +
| In seconds as set by <code>/worldborder warning time</code>
 +
|-
 +
| Warning Blocks
 +
| VarInt
 +
| In meters
 +
|-
 +
|rowspan="1"| 4: set warning time
 +
| Warning Time
 +
| VarInt
 +
| In seconds as set by <code>/worldborder warning time</code>
 +
|-
 +
|rowspan="1"| 5: set warning blocks
 +
| Warning Blocks
 +
| VarInt
 +
| In meters
 +
  |}
 +
 
 +
The Notchian client determines how solid to display the warning by comparing to whichever is higher, the warning distance or whichever is lower, the distance from the current diameter to the target diameter or the place the border will be after warningTime seconds. In pseudocode:
 +
 
 +
<syntaxhighlight lang="java">
 +
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 +
if (playerDistance < distance) {
 +
    warning = 1.0 - playerDistance / distance;
 +
} else {
 +
    warning = 0.0;
 +
}
 +
</syntaxhighlight>
 +
 
 +
==== Camera ====
 +
 
 +
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
 +
 
 +
The player's camera will move with the entity and look where it is looking. The entity is often another player, but can be any type of entity.  The player is unable to move this entity (move packets will act as if they are coming from the other entity).
 +
 
 +
If the given entity is not loaded by the player, this packet is ignored.  To return control to the player, send this packet with their entity ID.
 +
 
 +
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"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
Line 3,311: Line 3,918:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x48
+
  |rowspan="1"| 0x3F
  |rowspan="2"| Play
+
  |rowspan="1"| Play
  |rowspan="2"| Client
+
  |rowspan="1"| Client
  | URL
+
  | Camera ID
  | String
+
  | VarInt
  | The URL to the resource pack.
+
  | ID of the entity to set the client's camera to
|-
 
| Hash
 
| String
 
| A 40 character hexadecimal and lowercase [[wikipedia:SHA-1|SHA-1]] hash of the resource pack file. (must be lower case in order to work)<br />If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth — but it will still treat it as a unique id
 
 
  |}
 
  |}
  
==== Update Entity NBT ====  
+
The notchian also loads certain shaders for given entities:
 +
 
 +
* Creeper &rarr; <code>shaders/post/creeper.json</code>
 +
* Spider (and cave spider) &rarr; <code>shaders/post/spider.json</code>
 +
* Enderman &rarr; <code>shaders/post/invert.json</code>
 +
* Anything else &rarr; the current shader is unloaded
 +
 
 +
==== Held Item Change (clientbound) ====
 +
 
 +
Sent to change the player's slot selection.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,333: Line 3,945:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x49
+
  |rowspan="1"| 0x40
  |rowspan="2"| Play
+
  |rowspan="1"| Play
  |rowspan="2"| Client
+
  |rowspan="1"| Client
  | Entity ID
+
  | Slot
  | VarInt
+
  | Byte
|
+
  | The slot which the player has selected (0–8)
|-
 
| Tag
 
| [[NBT|NBT Tag]]
 
  |  
 
 
  |}
 
  |}
  
=== Serverbound ===
+
==== Update View Position ====
 +
 
 +
{{Need Info|Why is this even needed?  Is there a better name for it?  My guess is that it's something to do with logical behavior with latency, but it still seems weird.}}
  
==== Keep Alive ====
+
Updates the client's location.  This is used to determine what chunks should remain loaded and if a chunk load should be ignored; chunks outside of the view distance may be unloaded.
  
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
+
Sent whenever the player moves across a chunk border horizontally, and also (according to testing) for any integer change in the vertical axis, even if it doesn't go across a chunk section border.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,359: Line 3,969:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x00
+
  |rowspan="2"| 0x41
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Server
+
  |rowspan="2"| Client
  | Keep Alive ID
+
  | Chunk X
 +
| VarInt
 +
| Chunk X coordinate of the player's position
 +
|-
 +
| Chunk Z
 
  | VarInt
 
  | VarInt
  |  
+
  | Chunk Z coordinate of the player's position
 
  |}
 
  |}
  
==== Chat Message ====
+
==== Update View Distance ====
  
The default server will check the message to see if it begins with a '/'. If it doesn't, the username of the sender is prepended and sent to all other clients (including the original sender). If it does, the server assumes it to be a command and attempts to process it. A message longer than 100 characters will cause the server to kick the client. This change was initially done by allowing the client to not slice the message up to 119 (the previous limit), without changes to the server. For this reason, the vanilla server kept the code to cut messages at 119, but this isn't a protocol limitation and can be ignored.
+
Sent by the integrated singleplayer server when changing render distance. Does not appear to be used by the dedicated server, as <code>view-distance</code> in server.properties cannot be changed at runtime.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,379: Line 3,993:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x01
+
  |rowspan="1"| 0x42
 
  |rowspan="1"| Play
 
  |rowspan="1"| Play
  |rowspan="1"| Server
+
  |rowspan="1"| Client
  | Message
+
  | View Distance
  | String
+
  | VarInt
  | The client sends the raw input, not [[Chat]]
+
  | Render distance (2-32)
 
  |}
 
  |}
  
====