Difference between revisions of "Protocol"

From wiki.vg
Jump to: navigation, search
(Status: clarified ping/pong payload; formatting)
(Chunk Data: Document my findings/headaches)
 
(342 intermediate revisions by 50 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.14.4, protocol 498]]). 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.14.4.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 498 in Minecraft 1.14.4)
 
  |-
 
  |-
 
  | 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="13"| 0x03
  |rowspan="3"| Play
+
  |rowspan="13"| Play
  |rowspan="3"| Client
+
  |rowspan="13"| 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]]
 +
|-
 +
| Metadata
 +
| [[Entities#Entity Metadata Format|Entity Metadata]]
 +
  |  
 +
  |}
 +
 
 +
==== Spawn Painting ====
 +
 
 +
This packet shows location, name, and type of painting.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
Line 307: Line 397:
 
  ! 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.
+
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):
 
 
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! 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 634:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0A
+
  |rowspan="8"| 0x05
  |rowspan="2"| Play
+
  |rowspan="8"| Play
  |rowspan="2"| Client
+
  |rowspan="8"| 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
 +
|
 +
|-
 +
| Metadata
 +
| [[Entities#Entity Metadata Format|Entity Metadata]]
 +
|
 +
|}
 +
 
 +
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>.
 +
 
 +
==== 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 711:
 
  |-
 
  |-
 
  | 0
 
  | 0
  | Swing arm
+
  | Swing main arm
 
  |-
 
  |-
 
  | 1
 
  | 1
Line 560: Line 720:
 
  |-
 
  |-
 
  | 3
 
  | 3
  | Eat food
+
  | Swing offhand
 
  |-
 
  |-
 
  | 4
 
  | 4
Line 569: Line 729:
 
  |}
 
  |}
  
==== 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.
 
 
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
 
 
When in online-mode the UUIDs must be valid and have valid skin blobs, in offline-mode UUID v3 is used.
 
 
 
For NPCs UUID v2 should be used. Note:
 
 
 
<+Grum> i will never confirm this as a feature you know that :)
 
 
 
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
  ! Bound To
+
  ! Bound To  
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="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
  |-
+
|}
  | Y
+
 
  | Int
+
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
  | Player Y as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
 
 +
{| class="wikitable"
 +
! Name
 +
! ID
 +
! Registry
 +
  |-
 +
| <code>minecraft.mined</code>
 +
| 0
 +
| Blocks
 +
|-
 +
| <code>minecraft.crafted</code>
 +
| 1
 +
| Items
 +
  |-
 +
  | <code>minecraft.used</code>
 +
  | 2
 +
| Items
 +
  |-
 +
| <code>minecraft.broken</code>
 +
| 3
 +
| Items
 
  |-
 
  |-
  | 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}}
+
Custom has the following (unit only matters for clients):
 
 
==== Collect Item ====
 
 
 
Sent by the server when someone picks up an item lying on the ground — its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each [[#Player Position|Player Position]] (and [[#Player Position And Look|Player Position And Look]]) packet sent by the client.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
! ID
  ! Bound To
+
  ! Unit
  ! Field Name
+
  |-
  ! Field Type
+
  | <code>minecraft.leave_game</code>
  ! Notes
+
  | 0
 +
  | None
 
  |-
 
  |-
  |rowspan="2"| 0x0D
+
  | <code>minecraft.play_one_minute</code>
|rowspan="2"| Play
+
  | 1
|rowspan="2"| Client
+
  | Time
| Collected Entity ID
 
| VarInt
 
|
 
|-
 
| 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.time_since_death</code>
|rowspan="8"| Play
+
  | 2
|rowspan="8"| Client
+
  | Time
| Entity ID
 
  | VarInt
 
  | EID of the object
 
 
  |-
 
  |-
  | Type
+
  | <code>minecraft.sneak_Time</code>
  | Byte
+
  | 3
  | The type of object (See [[Entities#Objects|Objects]])
+
  | Time
 
  |-
 
  |-
  | X
+
  | <code>minecraft.walk_one_cm</code>
  | Int
+
  | 4
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.crouch_one_cm</code>
  | Int
+
  | 5
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.sprint_one_cm</code>
  | Int
+
  | 6
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.swim_one_cm</code>
  | Angle
+
  | 7
  |  
+
  | Distance
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.fall_one_cm</code>
  | Angle
+
  | 8
  |  
+
  | Distance
 
  |-
 
  |-
  | Data
+
  | <code>minecraft.climb_one_cm</code>
  | [[Object Data]]
+
  | 9
  |  
+
  | 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.fly_one_cm</code>
|rowspan="12"| Play
+
  | 10
|rowspan="12"| Client
+
  | Distance
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Type
+
  | <code>minecraft.dive_one_cm</code>
  | Unsigned Byte
+
  | 11
  | The type of mob. See [[Entities#Mobs|Mobs]]
+
  | Distance
 
  |-
 
  |-
  | X
+
  | <code>minecraft.minecart_one_cm</code>
  | Int
+
  | 12
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.boat_one_cm</code>
  | Int
+
  | 13
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.pig_one_cm</code>
  | Int
+
  | 14
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.horse_one_cm</code>
  | Angle
+
  | 15
  |  
+
  | Distance
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.aviate_one_cm</code>
  | Angle
+
  | 16
  |  
+
  | Distance
 
  |-
 
  |-
  | Head Pitch
+
  | <code>minecraft.jump</code>
  | Angle
+
  | 17
  |  
+
  | None
 
  |-
 
  |-
  | Velocity X
+
  | <code>minecraft.drop</code>
  | Short
+
  | 18
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | None
 +
|-
 +
| <code>minecraft.damage_dealt</code>
 +
| 19
 +
| Damage
 
  |-
 
  |-
  | Velocity Y
+
  | <code>minecraft.damage_taken</code>
  | Short
+
  | 20
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | Damage
 
  |-
 
  |-
  | Velocity Z
+
  | <code>minecraft.deaths</code>
  | Short
+
  | 21
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | None
 
  |-
 
  |-
  | Metadata
+
  | <code>minecraft.mob_kills</code>
| [[Entities#Entity Metadata Format|Metadata]]
+
  | 22
|
+
  | 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.animals_bred</code>
|rowspan="4"| Play
+
  | 23
|rowspan="4"| Client
+
  | None
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Title
+
  | <code>minecraft.player_kills</code>
  | String
+
  | 24
  | Name of the painting. Max length 13
+
  | None
 
  |-
 
  |-
  | Location
+
  | <code>minecraft.fish_caught</code>
  | Position
+
  | 25
  | Center coordinates
+
  | None
 
  |-
 
  |-
  | Direction
+
  | <code>minecraft.talked_to_villager</code>
  | Unsigned Byte
+
  | 26
  | Direction the painting faces. 0: north (-z), 1: west (-x), 2: south (+z), 3: east (+x)
+
  | None
|}
 
 
 
==== Spawn Experience Orb ====
 
 
 
Spawns one or more experience orbs.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="5"| 0x11
+
  | <code>minecraft.traded_with_villager</code>
|rowspan="5"| Play
+
  | 27
|rowspan="5"| Client
+
  | None
| Entity ID
 
  | VarInt
 
  | Entity's ID
 
 
  |-
 
  |-
  | X
+
  | <code>minecraft.eat_cake_slice</code>
  | Int
+
  | 28
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.fill_cauldron</code>
  | Int
+
  | 29
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.use_cauldron</code>
  | Int
+
  | 30
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Count
+
  | <code>minecraft.clean_armor</code>
  | Short
+
  | 31
  | The amount of experience this orb will reward once collected
+
  | None
|}
 
 
 
==== Entity Velocity ====
 
 
 
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).
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x12
+
  | <code>minecraft.clean_banner</code>
  |rowspan="4"| Play
+
| 32
  |rowspan="4"| Client
+
| None
  | Entity ID
+
|-
  | VarInt
+
| <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
 
  |-
 
  |-
  | Velocity X
+
  | <code>minecraft.open_chest</code>
  | Short
+
  | 47
  | Velocity on the X axis
+
  | None
 
  |-
 
  |-
  | Velocity Y
+
  | <code>minecraft.sleep_in_bed</code>
  | Short
+
  | 48
  | Velocity on the Y axis
+
  | None
 
  |-
 
  |-
  | Velocity Z
+
  | <code>minecraft.open_shulker_box</code>
  | Short
+
  | 49
  | Velocity on the Z axis
+
  | None
 
  |}
 
  |}
  
==== Destroy Entities ====
+
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
  
Sent by the server when a list of entities is to be destroyed on the client.
+
==== Block Break Animation ====
  
{| class="wikitable"
+
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x13
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Entity IDs
 
| Array of VarInt
 
| The list of entities of destroy
 
|}
 
  
==== Entity ====
+
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)
  
Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.
+
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.
 
 
For player entities, either this packet or any move/look packet is sent every game tick. So the meaning of this packet is basically that the entity did not move/look since the last such packet.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 916: Line 1,040:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x14
+
  |rowspan="3"| 0x08
  |rowspan="1"| Play
+
  |rowspan="3"| Play
  |rowspan="1"| Client
+
  |rowspan="3"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  |  
+
  | Entity ID of the entity breaking the block
 +
|-
 +
| Location
 +
| Position
 +
| Block Position
 +
|-
 +
| Destroy Stage
 +
| Byte
 +
| 0–9 to set it, any other value to remove it
 
  |}
 
  |}
  
==== Entity Relative Move ====
+
==== Update Block Entity ====
  
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.
+
Sets the block entity associated with the block at the given location.
 
 
This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 938: Line 1,068:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x15
+
  |rowspan="3"| 0x09
  |rowspan="5"| Play
+
  |rowspan="3"| Play
  |rowspan="5"| Client
+
  |rowspan="3"| Client
  | Entity ID
+
  | Location
  | VarInt
+
  | Position
 
  |  
 
  |  
 
  |-
 
  |-
  | Delta X
+
  | Action
  | Byte
+
  | Unsigned Byte
  | Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | The type of update to perform, see below
 
  |-
 
  |-
  | Delta Y
+
  | NBT Data
  | Byte
+
  | [[NBT|NBT Tag]]
| Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | 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)
  |-
 
  | Delta Z
 
| Byte
 
| Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
|-
 
| On Ground
 
| Boolean
 
|
 
 
  |}
 
  |}
  
==== Entity Look ====
+
''Action'' field:
 +
 
 +
* '''1''': Set data of a mob spawner (everything except for SpawnPotentials: current delay, min/max delay, mob to be spawned, spawn count, spawn range, etc.)
 +
* '''2''': Set command block text (command and last execution status)
 +
* '''3''': Set the level, primary, and secondary powers of a beacon
 +
* '''4''': Set rotation and skin of mob head
 +
* '''5''': Declare a conduit
 +
* '''6''': Set base color and patterns on a banner
 +
* '''7''': Set the data for a Structure tile entity
 +
* '''8''': Set the destination for a end gateway
 +
* '''9''': Set the text on a sign
 +
* '''10''': Unused
 +
* '''11''': Declare a bed
 +
* '''12''': Set data of a jigsaw block
 +
* '''13''': Set items in a campfire
 +
 
 +
==== Block Action ====
 +
 
 +
This packet is used for a number of actions and animations performed by blocks, usually non-persistent.
 +
 
 +
See [[Block Actions]] for a list of values.
  
This packet is sent by the server when an entity rotates.
+
{{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 974: Line 1,116:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x16
+
  |rowspan="4"| 0x0A
  |rowspan="5"| Play
+
  |rowspan="4"| Play
  |rowspan="5"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  | Location
  | VarInt
+
  | Position
  |  
+
  | Block coordinates
 
  |-
 
  |-
  | Yaw
+
  | Action ID (Byte 1)
  | Angle
+
  | Unsigned Byte
  | New angle, not a delta
+
  | Varies depending on block — see [[Block Actions]]
 
  |-
 
  |-
  | Pitch
+
  | Action Param (Byte 2)
  | Angle
+
  | Unsigned Byte
  | New angle, not a delta
+
  | Varies depending on block — see [[Block Actions]]
 
  |-
 
  |-
  | On Ground
+
  | Block Type
  | Boolean
+
  | VarInt
  |  
+
  | The block type ID for the block.  This must match the block at the given coordinates.
 
  |}
 
  |}
  
==== Entity Look And Relative Move ====
+
==== Block Change ====
 +
 
 +
Fired whenever a block is changed within the render distance.
  
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)
+
{{Warning2|Changing a block in a chunk that is not loaded is not a stable action. The Notchian client currently uses a ''shared'' empty chunk which is modified for all block changes in unloaded chunks; while in 1.9 this chunk never renders in older versions the changed block will appear in all copies of the empty chunk.  Servers should avoid sending block changes in unloaded chunks and clients should ignore such packets.}}
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,006: Line 1,150:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x17
+
  |rowspan="2"| 0x0B
  |rowspan="7"| Play
+
  |rowspan="2"| Play
  |rowspan="7"| 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.
 +
|}
 +
 
 +
==== Boss Bar ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | Delta X
+
  |rowspan="14"| 0x0C
  | Byte
+
|rowspan="14"| Play
  | Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
|rowspan="14"| Client
 +
  |colspan="2"| UUID
 +
  | UUID
 +
| Unique ID for this bar
 
  |-
 
  |-
  | Delta Y
+
  |colspan="2"| Action
  | Byte
+
  | VarInt Enum
  | Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Determines the layout of the remaining packet
 
  |-
 
  |-
  | Delta Z
+
  ! Action
  | Byte
+
  ! Field Name
  | Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  !
  |-
+
  !
| Yaw
 
| Angle
 
| New angle, not a delta
 
 
  |-
 
  |-
  | Pitch
+
  |rowspan="5"| 0: add
| Angle
+
  | Title
| New angle, not a delta
+
  | [[Chat]]
|-
 
  | On Ground
 
  | Boolean
 
 
  |  
 
  |  
|}
 
 
==== Entity Teleport ====
 
 
This packet is sent by the server when an entity moves more than 4 blocks.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x18
+
  | Health
|rowspan="7"| Play
+
  | Float
|rowspan="7"| Client
+
  | 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.
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | X
+
  | Color
  | Int
+
  | VarInt Enum
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Color ID (see below)
 
  |-
 
  |-
  | Y
+
  | Division
  | Int
+
  | VarInt Enum
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Type of division (see below)
 
  |-
 
  |-
  | Z
+
  | Flags
  | Int
+
  | Unsigned Byte
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02)
 
  |-
 
  |-
  | Yaw
+
  | 1: remove
  | Angle
+
  | ''no fields''
  | New angle, not a delta
+
  | ''no fields''
 +
| Removes this boss bar
 
  |-
 
  |-
  | Pitch
+
  | 2: update health
  | Angle
+
  | Health
  | New angle, not a delta
+
  | Float
 +
| as above
 
  |-
 
  |-
  | On Ground
+
  | 3: update title
  | Boolean
+
  | Title
 +
| [[Chat]]
 
  |  
 
  |  
|}
 
 
==== Entity Head Look ====
 
 
Changes the direction an entity's head is facing.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x19
+
  |rowspan="2"| 4: update style
  |rowspan="2"| Play
+
  | Color
  |rowspan="2"| Client
+
| VarInt Enum
  | Entity ID
+
  | Color ID (see below)
  | VarInt
+
|-
  |  
+
  | Dividers
 +
  | VarInt Enum
 +
| as above
 +
|-
 +
| 5: update flags
 +
| Flags
 +
| Unsigned Byte
 +
  | as above
 
  |-
 
  |-
| Head Yaw
 
| Angle
 
| New angle, not a delta
 
 
  |}
 
  |}
 
==== Entity Status ====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! ID
  ! State
+
  ! Color
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x1A
+
  | 0
|rowspan="2"| Play
+
  | Pink
|rowspan="2"| Client
 
| Entity ID
 
| Int
 
|
 
|-
 
| Entity Status
 
| Byte
 
| See below
 
|}
 
 
 
{| class="wikitable"
 
  |-
 
! Entity Status
 
! Meaning
 
 
  |-
 
  |-
 
  | 1
 
  | 1
  | Sent when resetting a mob spawn minecart's timer - appears to be unused by the client
+
  | Blue
 
  |-
 
  |-
 
  | 2
 
  | 2
  | Living Entity hurt
+
  | Red
 
  |-
 
  |-
 
  | 3
 
  | 3
  | Living Entity dead
+
  | Green
 
  |-
 
  |-
 
  | 4
 
  | 4
  | Iron Golem throwing up arms
+
  | Yellow
 +
|-
 +
| 5
 +
| Purple
 
  |-
 
  |-
 
  | 6
 
  | 6
  | Wolf/Ocelot/Horse taming — Spawn “heart” particles
+
  | White
 +
|}
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Type of division
 
  |-
 
  |-
  | 7
+
  | 0
  | Wolf/Ocelot/Horse tamed — Spawn “smoke” particles
+
  | No division
 
  |-
 
  |-
  | 8
+
  | 1
  | Wolf shaking water — Trigger the shaking animation
+
  | 6 notches
 
  |-
 
  |-
  | 9
+
  | 2
  | (of self) Eating accepted by server
+
  | 10 notches
 
  |-
 
  |-
  | 10
+
  | 3
  | Sheep eating grass
+
  | 12 notches
 
  |-
 
  |-
  | 10
+
  | 4
  | Play TNT ignite sound
+
  | 20 notches
 +
|}
 +
 
 +
==== Server Difficulty ====
 +
 
 +
Changes the difficulty setting in the client's option menu
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 11
+
  |rowspan="2"| 0x0D
  | Iron Golem handing over a rose
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Difficulty
 +
| Unsigned Byte
 +
  | 0: peaceful, 1: easy, 2: normal, 3: hard
 
  |-
 
  |-
  | 12
+
  | Difficulty locked?
  | Villager mating — Spawn “heart” particles
+
  | Boolean
  |-
+
  |
| 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 ====
+
==== 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.
  
This packet is sent when a player has been attached to an entity (e.g. Minecart).
+
{{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,215: Line 1,324:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1B
+
  |rowspan="2"| 0x0E
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | JSON Data
  | Int
+
  | [[Chat]]
  | Attached entity's EID. Set to -1 to detach.
+
  | Limited to 32767 bytes
 
  |-
 
  |-
  | Vehicle ID
+
  | Position
  | Int
+
  | Byte
  | Vechicle's Entity ID
+
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
|-
 
| Leash
 
| Boolean
 
| If true leashes the entity to the vehicle
 
 
  |}
 
  |}
  
==== Entity Metadata ====
+
==== 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"
Line 1,237: Line 1,346:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1C
+
  |rowspan="6"| 0x0F
  |rowspan="2"| Play
+
  |rowspan="6"| Play
  |rowspan="2"| Client
+
  |rowspan="6"| Client
  | Entity ID
+
|colspan="2"| Chunk X
 +
|colspan="2"| Int
 +
| Chunk X coordinate
 +
|-
 +
|colspan="2"| Chunk Z
 +
|colspan="2"| Int
 +
| Chunk Z coordinate
 +
|-
 +
|colspan="2"| Record Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array, i.e. the number of blocks affected
 +
|-
 +
|rowspan="3"| Record
 +
| Horizontal Position
 +
|rowspan="3"| Array
 +
| Unsigned Byte
 +
| The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
 +
|-
 +
| Y Coordinate
 +
| Unsigned Byte
 +
| Y coordinate of the block
 +
|-
 +
  | Block ID
 
  | VarInt
 
  | 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.
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Metadata]]
 
|  
 
 
  |}
 
  |}
  
==== Entity Effect ====
+
To decode the position into a world position:
 +
 
 +
<syntaxhighlight lang="java">
 +
worldX = (horizPos >> 4 & 15) + (chunkX * 16);
 +
worldY = vertPos;
 +
worldZ = (horizPos & 15) + (chunkZ * 16);
 +
</syntaxhighlight>
 +
 
 +
==== Tab-Complete (clientbound) ====
 +
 
 +
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported. The client sorts these alphabetically before listing them.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,259: Line 1,396:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x1D
+
  |rowspan="8"| 0x10
  |rowspan="5"| Play
+
  |rowspan="8"| Play
  |rowspan="5"| Client
+
  |rowspan="8"| Client
  | Entity ID
+
  |-
  | VarInt
+
|colspan="2"| ID
  |  
+
  |colspan="2"| VarInt
 +
| Transaction ID
 +
|-
 +
|colspan="2"| Start
 +
|colspan="2"| VarInt
 +
  | Start of the text to replace
 
  |-
 
  |-
  | Effect ID
+
  |colspan="2"| Length
  | Byte
+
  |colspan="2"| VarInt
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | Length of the text to replace
 
  |-
 
  |-
  | Amplifier
+
  |colspan="2"| Count
  | Byte
+
  |colspan="2"| VarInt
  | Notchian client displays effect level as Amplifier + 1
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Duration
+
  |rowspan="3"| Matches
  | VarInt
+
  | Match
  | Seconds
+
  |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.
 
  |-
 
  |-
  | Hide Particles
+
  | Has tooltip
 
  | Boolean
 
  | Boolean
  |  
+
  | True if the following is present
 +
|-
 +
| Tooltip
 +
| Optional [[Chat]]
 +
| Tooltip to display; only present if previous boolean is true
 
  |}
 
  |}
  
==== Remove Entity Effect ====
+
==== 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,297: Line 1,449:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1E
+
  |rowspan="3"| 0x11
  |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
 
  |-
 
  |-
  | Effect ID
+
  | Root index
  | Byte
+
  | VarInt
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | Index of the <code>root</code> node in the previous array
 
  |}
 
  |}
  
==== Set Experience ====
+
For more information on this packet, see the [[Command Data]] article.
 +
 
 +
==== Confirm Transaction (clientbound) ====
  
Sent by the server when the client should change experience levels.
+
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag).  If the packet was not accepted, the client must respond with a [[#Confirm Transaction (serverbound)|serverbound confirm transaction]] packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,321: Line 1,479:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1F
+
  |rowspan="3"| 0x12
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
 
  |rowspan="3"| Client
 
  |rowspan="3"| Client
  | Experience bar
+
  | Window ID
  | Float
+
  | Byte
  | Between 0 and 1
+
  | The ID of the window that the action occurred in
 
  |-
 
  |-
  | Level
+
  | Action Number
  | VarInt
+
  | Short
  |  
+
  | Every action that is to be accepted has a unique number. This number is an incrementing integer (starting at 0) with separate counts for each window ID.
 
  |-
 
  |-
  | Total Experience
+
  | Accepted
  | VarInt
+
  | Boolean
  | See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
+
  | Whether the action was accepted
 
  |}
 
  |}
  
==== Entity Properties ====
+
==== 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,343: Line 1,503:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x20
+
  | 0x13
  |rowspan="6"| Play
+
  | Play
  |rowspan="6"| Client
+
  | Client
  |colspan="2"| Entity ID
+
  | Window ID
  |colspan="2"| VarInt
+
  | Unsigned Byte
  |  
+
  | This is the ID of the window that was closed. 0 for inventory.
  |-
+
  |}
|colspan="2"| Number Of Properties
+
 
  |colspan="2"| Int
+
==== Window Items ====
  | Number of elements in the following array
+
[[File:Inventory-slots.png|thumb|The inventory slots]]
 +
 
 +
Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| Property
+
  |rowspan="3"| 0x14
  | Key
+
  |rowspan="3"| Play
  |rowspan="4"| Array
+
  |rowspan="3"| Client
  | String
+
| Window ID
  | See below
+
  | Unsigned Byte
 +
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  | Value
+
  | Count
  | Double
+
  | Short
| See below
 
|-
 
| Number Of Modifiers
 
| VarInt
 
 
  | Number of elements in the following array
 
  | Number of elements in the following array
 
  |-
 
  |-
  | Modifiers
+
  | Slot Data
  | Array of Modifier Data
+
  | Array of [[Slot Data|Slot]]
  | See {{Minecraft Wiki|Attribute#Modifiers}}
+
  |  
 
  |}
 
  |}
  
Known Key values:
+
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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  ! Key
+
  |rowspan="3"| 0x15
! Default
+
  |rowspan="3"| Play
! Min
+
  |rowspan="3"| Client
! Max
+
  | Window ID
! Label
+
  | Unsigned Byte
  |-
+
  |  
  | generic.maxHealth
 
| 20.0
 
  | 0.0
 
  | Double.MaxValue
 
  | Max Health
 
 
  |-
 
  |-
  | generic.followRange
+
  | Property
  | 32.0
+
  | Short
  | 0.0
+
  | The property to be updated, see below
| 2048.0
 
| Follow Range
 
 
  |-
 
  |-
  | generic.knockbackResistance
+
  | Value
  | 0.0
+
  | Short
  | 0.0
+
  | The new value for the property, see below
  | 1.0
+
  |}
| Knockback Resistance
+
 
 +
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"
 
  |-
 
  |-
  | generic.movementSpeed
+
  ! Window type
  | 0.699999988079071
+
  ! Property
  | 0.0
+
  ! Value
| Double.MaxValue
 
| Movement Speed
 
 
  |-
 
  |-
  | generic.attackDamage
+
  |rowspan="4"| Furnace
  | 2.0
+
| 0: Fire icon (fuel left)
  | 0.0
+
| counting from fuel burn time down to 0 (in-game ticks)
  | Double.MaxValue
+
|-
  |  
+
| 1: Maximum fuel burn time
 +
| fuel burn time or 0 (in-game ticks)
 +
|-
 +
| 2: Progress arrow
 +
| counting from 0 to maximum progress (in-game ticks)
 +
|-
 +
| 3: Maximum progress
 +
| always 200 on the notchian server
 +
|-
 +
|rowspan="10"| Enchantment Table
 +
| 0: Level requirement for top enchantment slot
 +
|rowspan="3"| The enchantment's xp level requirement
 +
|-
 +
| 1: Level requirement for middle enchantment slot
 +
|-
 +
| 2: Level requirement for bottom enchantment slot
 +
|-
 +
| 3: The enchantment seed
 +
| Used for drawing the enchantment names (in [[Wikipedia:Standard Galactic Alphabet|SGA]]) clientside.  The same seed ''is'' used to calculate enchantments, but some of the data isn't sent to the client to prevent easily guessing the entire list (the seed value here is the regular seed bitwise and <code>0xFFFFFFF0</code>).
 +
  |-
 +
| 4: Enchantment ID shown on mouse hover over top enchantment slot
 +
|rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
 +
|-
 +
| 5: Enchantment ID shown on mouse hover over middle enchantment slot
 +
|-
 +
| 6: Enchantment ID shown on mouse hover over bottom enchantment slot
 +
|-
 +
| 7: Enchantment level shown on mouse hover over the top slot
 +
|rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
 +
|-
 +
| 8: Enchantment level shown on mouse hover over the middle slot
 +
|-
 +
| 9: Enchantment level shown on mouse hover over the bottom slot
 +
|-
 +
|rowspan="3"| Beacon
 +
| 0: Power level
 +
  | 0-4, controls what effect buttons are enabled
 +
|-
 +
| 1: First potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
 +
|-
 +
| 2: Second potion effect
 +
| {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
 +
|-
 +
| Anvil
 +
  | 0: Repair cost
 +
  | The repair's cost in xp levels
 
  |-
 
  |-
  | horse.jumpStrength
+
  |rowspan="2"| Brewing Stand
  | 0.7
+
  | 0: Brew time
  | 0.0
+
  | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full
| 2.0
 
| Jump Strength
 
 
  |-
 
  |-
  | 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
  |}
 
 
 
==== Chunk Data ====
 
 
 
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.
 
 
 
See also: [[SMP Map Format]]
 
 
 
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
+
  | 5
|rowspan="6"| Play
+
  | minecraft:respiration
|rowspan="6"| Client
+
  | Respiration
| Chunk X
 
  | Int
 
  | Chunk X coordinate
 
 
  |-
 
  |-
  | Chunk Z
+
  | 6
  | Int
+
  | minecraft:aqua_affinity
  | Chunk Z coordinate
+
  | Aqua Affinity
 
  |-
 
  |-
  | Ground-Up Continuous
+
  | 7
  | Boolean
+
  | minecraft:thorns
  | 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
+
  | Thorns
 
  |-
 
  |-
  | Primary Bit Mask
+
  | 8
  | Unsigned Short
+
  | minecraft:depth_strider
  | Bitmask with 1 for every 16x16x16 section whose data follows in the compressed data
+
  | Depth Strider
  |-  
+
  |-
  | Size
+
  | 9
  | VarInt
+
  | minecraft:frost_walker
  | Size of Data
+
  | Frost Walker
 
  |-
 
  |-
  | Data
+
  | 10
| [[SMP Map Format#Data|Chunk]]
+
  | minecraft:binding_curse
  |  
+
  | Curse of Binding
  |}
 
 
 
==== 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
+
  | 11
|rowspan="6"| Play
+
  | minecraft:sharpness
|rowspan="6"| Client
+
  | Sharpness
  |colspan="2"| Chunk X
 
|colspan="2"| Int
 
  | Chunk X coordinate
 
 
  |-
 
  |-
  |colspan="2"| Chunk Z
+
  | 12
  |colspan="2"| Int
+
  | minecraft:smite
  | Chunk Z coordinate
+
  | Smite
 
  |-
 
  |-
  |colspan="2"| Record Count
+
  | 13
  |colspan="2"| VarInt
+
  | minecraft:bane_of_arthropods
  | Number of elements in the following array, a.k.a. the number of blocks affected
+
  | Bane of Arthropods
 
  |-
 
  |-
  |rowspan="3"| Record
+
  | 14
| Horizontal Position
+
  | minecraft:knockback
|rowspan="3"| Array
+
  | Knockback
  | 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
+
  | 15
  | Unsigned Byte
+
  | minecraft:fire_aspect
  |  
+
  | Fire Aspect
 
  |-
 
  |-
  | Block ID
+
  | 16
  | VarInt
+
  | minecraft:looting
  | The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
+
  | Looting
 +
|-
 +
| 17
 +
| minecraft:sweeping
 +
| Sweeping Edge
 +
|-
 +
| 18
 +
| minecraft:efficiency
 +
| Efficiency
 +
|-
 +
| 19
 +
| minecraft:silk_touch
 +
| Silk Touch
 +
|-
 +
| 20
 +
| minecraft:unbreaking
 +
| Unbreaking
 +
|-
 +
| 21
 +
| minecraft:fortune
 +
| Fortune
 +
|-
 +
| 22
 +
| minecraft:power
 +
| Power
 +
|-
 +
| 23
 +
| minecraft:punch
 +
| Punch
 +
|-
 +
| 24
 +
| minecraft:flame
 +
| Flame
 +
|-
 +
| 25
 +
| minecraft:infinity
 +
| Infinity
 +
|-
 +
| 26
 +
| minecraft:luck_of_the_sea
 +
| Luck of the Sea
 +
|-
 +
| 27
 +
| minecraft:lure
 +
| Lure
 +
|-
 +
| 28
 +
| minecraft:loyalty
 +
| Loyalty
 +
|-
 +
| 29
 +
| minecraft:impaling
 +
| Impaling
 +
|-
 +
| 30
 +
| minecraft:riptide
 +
| Riptide
 +
|-
 +
| 31
 +
| minecraft:channeling
 +
| Channeling
 +
|-
 +
| 32
 +
| minecraft:mending
 +
| Mending
 +
|-
 +
| 33
 +
| minecraft:vanishing_curse
 +
| Curse of Vanishing
 
  |}
 
  |}
  
==== Block Change ====
+
==== Set Slot ====
Fired whenever a block is changed within the render distance.
+
 
 +
Sent by the server when an item in a slot (in a window) is added/removed.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
Line 1,550: Line 1,798:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x23
+
  |rowspan="3"| 0x16
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| 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).
 +
|-
 +
| Slot
 +
| Short
 +
| The slot that should be updated
 
  |-
 
  |-
  | Block ID
+
  | Slot Data
  | VarInt
+
  | [[Slot Data|Slot]]
  | The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
+
  |  
 
  |}
 
  |}
  
==== Block Action ====
+
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
  
This packet is used for a number of things:
+
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.
  
* Chests opening and closing
+
==== Set Cooldown ====
* Pistons pushing and pulling
 
* Note blocks playing
 
* Updating beacons
 
  
See Also: [[Block Actions]]
+
Applies a cooldown period to all items with the given type.  Used by the Notchian server with enderpearls.  This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,581: Line 1,830:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x24
+
  |rowspan="2"| 0x17
  |rowspan="4"| Play
+
  |rowspan="2"| Play
  |rowspan="4"| Client
+
  |rowspan="2"| Client
  | Location
+
  | Item ID
  | Position
+
  | VarInt
  | Block Coordinates
+
  | Numeric ID of the item to apply a cooldown to.
|-
 
| Byte 1
 
| Unsigned Byte
 
| Varies depending on block — see [[Block Actions]]
 
 
  |-
 
  |-
  | Byte 2
+
  | Cooldown Ticks
| Unsigned Byte
 
| Varies depending on block — see [[Block Actions]]
 
|-
 
| Block Type
 
 
  | VarInt
 
  | VarInt
  | The block type for the block
+
  | Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
 
  |}
 
  |}
  
==== Block Break Animation ====
+
==== Plugin Message (clientbound) ====
 
 
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 
  
You can also set an animation to air! The animation will still be visible.
+
{{Main|Plugin channels}}
  
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
+
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.
  
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)
+
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,619: Line 1,858:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x25
+
  |rowspan="2"| 0x18
  |rowspan="3"| Play
+
  |rowspan="2"| Play
  |rowspan="3"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Channel
  | VarInt
+
  | Identifier
  | EID for the animation
+
  | Name of the [[plugin channel]] used to send the data
 
  |-
 
  |-
  | Location
+
  | Data
  | Position
+
  | Byte Array
  | Block Position
+
  | 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.
|-
 
| Destroy Stage
 
  | Byte
 
| 0–9 to set it, any other value to remove it
 
 
  |}
 
  |}
  
==== Map Chunk Bulk ====
+
==== Named Sound Effect ====
 
+
{{See also|#Sound Effect}}
1.8 changes at [[#Chunk Data|Chunk Data]]
 
  
To reduce the number of bytes, this packet is used to send chunks together for better compression results.
+
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,645: Line 1,879:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x26
+
  |rowspan="7"| 0x19
 
  |rowspan="7"| Play
 
  |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.14.4 can be seen [https://pokechu22.github.io/Burger/1.14.4.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).
+
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.
 
 
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,693: Line 1,927:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x27
+
| 0x1A
  |rowspan="9"| Play
+
| Play
  |rowspan="9"| Client
+
| Client
  | X
+
| Reason
  | Float
+
| [[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"| 0x1B
 +
|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"| 0x1C
 +
  |rowspan="9"| Play
 +
  |rowspan="9"| Client
 +
  | X
 +
  | Float
 +
  |  
 +
  |-
 
  | Y
 
  | Y
 
  | Float
 
  | Float
Line 1,733: Line 2,015:
 
  |}
 
  |}
  
==== 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,027:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x28
+
  |rowspan="2"| 0x1D
  |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"| 0x1E
 +
|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
 +
|-
 +
| 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)
 
  |  
 
  |  
 +
|}
 +
 +
==== 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
 
  |-
 
  |-
  | 1012
+
  |rowspan="3"| 0x1F
  | <code>mob.zombie.woodbreak</code>
+
|rowspan="3"| Play
  |  
+
|rowspan="3"| Client
 +
| Window ID?
 +
  | Byte
 +
  |
 
  |-
 
  |-
  | 1013
+
  | Number of slots?
  | <code>mob.wither.spawn</code>
+
  | VarInt
  |  
+
  |
 
  |-
 
  |-
  | 1014
+
  | Entity ID?
  | <code>mob.wither.shoot</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
 
  |-
 
  |-
  | 1015
+
  |rowspan="1"| 0x20
  | <code>mob.bat.takeoff</code>
+
  |rowspan="1"| Play
  |  
+
  |rowspan="1"| Client
|-
+
  | Keep Alive ID
  | 1016
+
  | Long
  | <code>mob.zombie.infect</code>
 
 
  |  
 
  |  
 +
|}
 +
 +
==== Chunk Data ====
 +
{{Main|Chunk Format}}
 +
{{See also|#Unload Chunk}}
 +
 +
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="9"| 0x21
  | <code>mob.zombie.unfect</code>
+
|rowspan="9"| Play
  |  
+
|rowspan="9"| 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.
 +
|-
 +
| Size
 +
| VarInt
 +
  | Size of Data in bytes
 
  |-
 
  |-
  !colspan="3"| Particle
+
  | Data
 +
| Byte array
 +
| See [[Chunk Format#Data structure|data structure]] in Chunk Format
 
  |-
 
  |-
  | 2000
+
  | Number of block entities
  | Spawns 10 smoke particles, e.g. from a fire
+
  | VarInt
  | Direction, see below
+
  | Number of elements in the following array
 
  |-
 
  |-
  | 2001
+
  | Block entities
  | Block break
+
  | Array of [[NBT|NBT Tag]]
  | {{Minecraft Wiki|Data values|Block ID}}
+
| All block entities in the chunk.  Use the x, y, and z tags in the NBT to determine their positions.
  |-
+
  |}
  | 2002
+
 
  | Splash potion. Particle effect + glass break sound.
+
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.
  | [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
+
 
 +
==== 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"| 0x22
 +
  |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
 
 
  |-
 
  |-
  | 1
+
  | 1000
  | South
+
| Dispenser dispenses
 +
  |  
 
  |-
 
  |-
  | 2
+
  | 1001
  | South-West
+
| Dispenser fails to dispense
 +
  |  
 
  |-
 
  |-
  | 3
+
  | 1002
  | East
+
| Dispenser shoots
 +
  |  
 
  |-
 
  |-
  | 4
+
  | 1003
  | (Up or middle ?)
+
| Ender eye launched
 +
  |  
 
  |-
 
  |-
  | 5
+
  | 1004
  | West
+
| Firework shot
 +
  |  
 
  |-
 
  |-
  | 6
+
  | 1005
  | North-East
+
| Iron door opened
 +
  |  
 
  |-
 
  |-
  | 7
+
  | 1006
  | North
+
| Wooden door opened
 +
  |  
 
  |-
 
  |-
  | 8
+
  | 1007
  | North-West
+
  | Wooden trapdoor opened
  |}
+
  |  
 
 
==== 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
+
  | 1008
|rowspan="6"| Play
+
  | Fence gate opened
|rowspan="6"| Client
+
  |  
| 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
+
  | 1009
  | Int
+
  | Fire extinguished
  | Effect X multiplied by 8
+
  |  
 
  |-
 
  |-
  | Effect position Y
+
  | 1010
  | Int
+
  | Play record
  | Effect Y multiplied by 8
+
  | Special case, see below for more info
 
  |-
 
  |-
  | Effect position Z
+
  | 1011
  | Int
+
  | Iron door closed
  | Effect Z multiplied by 8
+
  |  
 
  |-
 
  |-
  | Volume
+
  | 1012
  | Float
+
  | Wooden door closed
  | 1 is 100%, can be more
+
  |  
 
  |-
 
  |-
  | Pitch
+
  | 1013
  | Unsigned Byte
+
  | Wooden trapdoor closed
  | 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
+
  | 1014
|rowspan="11"| Play
+
  | Fence gate closed
|rowspan="11"| Client
+
  |  
| Particle ID
 
  | Int
 
  | See below
 
 
  |-
 
  |-
  | Long Distance
+
  | 1015
  | Boolean
+
  | Ghast warns
  | If true, particle distance increases from 256 to 65536
+
  |  
 
  |-
 
  |-
  | X
+
  | 1016
  | Float
+
  | Ghast shoots
  | X position of the particle
+
  |  
 
  |-
 
  |-
  | Y
+
  | 1017
  | Float
+
  | Enderdragon shoots
  | Y position of the particle
+
  |  
 
  |-
 
  |-
  | Z
+
  | 1018
  | Float
+
  | Blaze shoots
  | Z position of the particle
+
  |  
 
  |-
 
  |-
  | Offset X
+
  | 1019
  | Float
+
  | Zombie attacks wood door
  | This is added to the X position after being multiplied by random.nextGaussian()
+
  |  
 
  |-
 
  |-
  | Offset Y
+
  | 1020
  | Float
+
  | Zombie attacks iron door
  | This is added to the Y position after being multiplied by random.nextGaussian()
+
  |  
 
  |-
 
  |-
  | Offset Z
+
  | 1021
  | Float
+
  | Zombie breaks wood door
  | This is added to the Z position after being multiplied by random.nextGaussian()
+
  |
 
  |-
 
  |-
  | Particle Data
+
  | 1022
  | Float
+
  | Wither breaks block
  | The data of each particle
+
  |
 
  |-
 
  |-
  | Particle Count
+
  | 1023
  | Int
+
  | Wither spawned
  | The number of particles to create
+
  |  
 
  |-
 
  |-
  | Data
+
  | 1024
  | Array of VarInt
+
  | Wither shoots
  | 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
+
  | 1025
  ! Particle ID
+
  | Bat takes off
 +
|
 
  |-
 
  |-
  | explode
+
  | 1026
  | 0
+
| Zombie infects
 +
  |
 
  |-
 
  |-
  | largeexplosion
+
  | 1027
  | 1
+
| Zombie villager converted
 +
  |
 
  |-
 
  |-
  | hugeexplosion
+
  | 1028
  | 2
+
| Ender dragon death
 +
  |
 
  |-
 
  |-
  | fireworksSpark
+
  | 1029
  | 3
+
| Anvil destroyed
 +
  |  
 
  |-
 
  |-
  | bubble
+
  | 1030
  | 4
+
| Anvil used
 +
  |  
 
  |-
 
  |-
  | splash
+
  | 1031
  | 5
+
| Anvil landed
 +
  |
 
  |-
 
  |-
  | wake
+
  | 1032
  | 6
+
| Portal travel
 +
  |  
 
  |-
 
  |-
  | suspended
+
  | 1033
  | 7
+
| Chorus flower grown
 +
  |
 
  |-
 
  |-
  | depthsuspend
+
  | 1034
  | 8
+
| Chorus flower died
 +
  |  
 
  |-
 
  |-
  | crit
+
  | 1035
  | 9
+
| Brewing stand brewed
 +
  |
 
  |-
 
  |-
  | magicCrit
+
  | 1036
  | 10
+
| Iron trapdoor opened
 +
  |  
 
  |-
 
  |-
  | smoke
+
  | 1037
  | 11
+
| Iron trapdoor closed
 +
  |
 
  |-
 
  |-
  | largesmoke
+
  !colspan="3"| Particle
| 12
 
 
  |-
 
  |-
  | spell
+
  | 2000
  | 13
+
  | Spawns 10 smoke particles, e.g. from a fire
 +
| Direction, see below
 
  |-
 
  |-
  | instantSpell
+
  | 2001
  | 14
+
  | Block break + block break sound
 +
| Block state, as an index into the global palette
 
  |-
 
  |-
  | mobSpell
+
  | 2002
  | 15
+
  | Splash potion. Particle effect + glass break sound.
 +
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
  |-
 
  |-
  | mobSpellAmbient
+
  | 2003
  | 16
+
| Eye of Ender entity break animation — particles and sound
 +
  |  
 
  |-
 
  |-
  | witchMagic
+
  | 2004
  | 17
+
| Mob spawn particle effect: smoke + flames
 +
  |  
 
  |-
 
  |-
  | dripWater
+
  | 2005
  | 18
+
  | Bonemeal particles
 +
| How many particles to spawn (if set to 0, 15 are spawned)
 
  |-
 
  |-
  | dripLava
+
  | 2006
  | 19
+
| Dragon breath
 +
  |
 
  |-
 
  |-
  | angryVillager
+
  | 2007
  | 20
+
  | Instant splash potion
 +
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
  |-
 
  |-
  | happyVillager
+
  | 3000
  | 21
+
| End gateway spawn
 +
  |  
 
  |-
 
  |-
  | townaura
+
  | 3001
  | 22
+
  | Enderdragon growl
  |-
+
  |
  | note
+
  |}
  | 23
+
 
 +
Smoke directions:
 +
 
 +
{| class="wikitable"
 +
! ID
 +
  ! Direction
 
  |-
 
  |-
  | portal
+
  | 0
  | 24
+
  | South-East
 
  |-
 
  |-
  | enchantmenttable
+
  | 1
  | 25
+
  | South
 
  |-
 
  |-
  | flame
+
  | 2
  | 26
+
  | South-West
 
  |-
 
  |-
  | lava
+
  | 3
  | 27
+
  | East
 
  |-
 
  |-
  | footstep
+
  | 4
  | 28
+
  | (Up or middle ?)
 
  |-
 
  |-
  | cloud
+
  | 5
  | 29
+
  | West
 
  |-
 
  |-
  | reddust
+
  | 6
  | 30
+
  | North-East
 
  |-
 
  |-
  | snowballpoof
+
  | 7
  | 31
+
  | North
 
  |-
 
  |-
  | snowshovel
+
  | 8
| 32
+
  | North-West
  |-
+
  |}
  | slime
+
 
| 33
+
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.
|-
+
 
| heart
+
==== Particle ====
| 34
+
 
|-
+
Displays the named particle
| barrier
 
| 35
 
|-
 
| iconcrack_(id)_(data)
 
  | 36
 
|-
 
| blockcrack_(id+(data<<12))
 
| 37
 
|-
 
| blockdust_(id)
 
| 38
 
|-
 
| droplet
 
| 39
 
|-
 
| take
 
| 40
 
|-
 
| mobappearance
 
| 41
 
|}
 
 
 
==== Change Game State ====
 
 
 
It appears when a bed can't be used as a spawn point and when the rain state changes.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,173: Line 2,508:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x2B
+
  |rowspan="11"| 0x23
  |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
 
  | Float
  | Depends on reason
+
  | X position of the particle
|}
 
 
 
''Reason codes'':
 
 
 
{| class="wikitable"
 
! Code
 
! Effect
 
! Value
 
 
  |-
 
  |-
  | 0
+
  | Y
  | Invalid Bed
+
  | Float
  |  
+
  | Y position of the particle
 
  |-
 
  |-
  | 1
+
  | Z
  | End raining
+
  | Float
  |  
+
  | 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,564:
 
  ! 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"| 0x24
  |rowspan="5"| Play
+
  |rowspan="10"| Play
  |rowspan="5"| Client
+
  |rowspan="10"| Client
  | Entity ID
+
  |colspan="2"| Chunk X
 +
|colspan="2"| VarInt
 +
| Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
|colspan="2"| Chunk Z
 +
|colspan="2"| VarInt
 +
| Chunk coordinate (block coordinate divided by 16, rounded down)
 +
|-
 +
|colspan="2"| Sky Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, with the lowest bit corresponding to chunk section -1 (in the void, y=-16 to y=-1) and the highest bit for chunk section 16 (above the world, y=256 to y=271)
 +
|-
 +
|colspan="2"| Block Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, with the same order as sky light
 +
|-
 +
|colspan="2"| Empty Sky Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, which indicates sections that have 0 for all their sky light values.  If a section is set in both this mask and the main sky light mask, it is ignored for this mask and it is included in the sky light arrays (the notchian server does not create such masks).  If it is only set in this mask, it is not included in the sky light arrays.
 +
|-
 +
|colspan="2"| Empty Block Light Mask
 +
|colspan="2"| VarInt
 +
| Mask containing 18 bits, which indicates sections that have 0 for all their block light values.  If a section is set in both this mask and the main block light mask, it is ignored for this mask and it is included in the block light arrays (the notchian server does not create such masks).  If it is only set in this mask, it is not included in the block light arrays.
 +
|-
 +
|rowspan="2"| Sky Light arrays
 +
| Length
 +
|rowspan="2"| Array
 
  | VarInt
 
  | VarInt
  | The EID of the thunderbolt
+
  | Length of the following array in bytes (always 2048)
 
  |-
 
  |-
  | Type
+
  | Sky Light array
  | Byte
+
  | Array of 2048 bytes
  | The global entity type, currently always 1 for thunderbolt
+
  | 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.
 
  |-
 
  |-
  | X
+
  |rowspan="2"| Block Light arrays
| Int
+
  | Length
  | Thunderbolt X, a [[Data Types#Fixed-point numbers|fixed-point number]]
+
  |rowspan="2"| Array
  |-
+
  | VarInt
| Y
+
  | Length of the following array in bytes (always 2048)
  | Int
 
  | Thunderbolt Y, a [[Data Types#Fixed-point numbers|fixed-point number]]
 
 
  |-
 
  |-
  | Z
+
  | Block Light array
  | Int
+
  | Array of 2048 bytes
  | Thunderbolt Z, a [[Data Types#Fixed-point numbers|fixed-point number]]
+
  | 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.
  
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.
+
==== Join Game ====
 +
 
 +
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,280: Line 2,630:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x2D
+
  |rowspan="7"| 0x25
  |rowspan="5"| Play
+
  |rowspan="7"| Play
  |rowspan="5"| Client
+
  |rowspan="7"| 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.
 +
|-
 +
| Dimension
 +
| Int Enum
 +
| -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
 
  |-
 
  |-
  | Window Type
+
  | Max Players
  | String
+
  | Unsigned Byte
  | The window type to use for display. See below
+
  | Was once used by the client to draw the player list, but now is ignored
 
  |-
 
  |-
  | Window Title
+
  | Level Type
  | [[Chat]]
+
  | String Enum (16)
  | The title of the window
+
  | default, flat, largeBiomes, amplified, customized, buffet, default_1_1
 
  |-
 
  |-
  | Number Of Slots
+
  | View Distance
  | Unsigned Byte
+
  | VarInt
  | Number of slots in the window (excluding the number of slots in the player inventory)
+
  | Render distance (2-32)
 
  |-
 
  |-
  | Entity ID
+
  | Reduced Debug Info
  | Optional Int
+
  | Boolean
  | EntityHorse's EID. Only sent when Window Type is “EntityHorse”
+
  | If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}.  For servers in development, this should almost always be false.
 
  |}
 
  |}
  
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,670:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x2E
+
  |rowspan="17"| 0x26
  |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
  |}
+
|-
 
+
|colspan="2"| Scale
==== Set Slot ====
+
|colspan="2"| Byte
 
+
| From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
Sent by the server when an item in a slot (in a window) is added/removed.
+
  |-
 
+
|colspan="2"| Tracking Position
{| class="wikitable"
+
|colspan="2"| Boolean
  ! Packet ID
+
| Specifies whether player and item frame icons are shown
  ! State
+
|-
  ! Bound To
+
|colspan="2"| Locked
  ! Field Name
+
|colspan="2"| Boolean
  ! Field Type
+
| True if the map has been locked in a cartography table
  ! Notes
+
|-
 +
|colspan="2"| Icon Count
 +
|colspan="2"| VarInt
 +
| Number of elements in the following array
 +
|-
 +
|rowspan="6"| Icon
 +
| Type
 +
|rowspan="6"| Array
 +
| VarInt enum
 +
| See below
 +
|-
 +
  | X
 +
  | Byte
 +
  | Map coordinates: -128 for furthest left, +127 for furthest right
 +
  |-
 +
  | Z
 +
| Byte
 +
  | Map coordinates: -128 for highest, +127 for lowest
 
  |-
 
  |-
  |rowspan="3"| 0x2F
+
  | Direction
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Window ID
 
 
  | Byte
 
  | Byte
  | The window which is being updated. 0 for player inventory. Note that all known window types include the player inventory. This packet will only be sent for the currently opened window while the player is performing actions, even if it affects the player inventory. After the window is closed, a number of these packets are sent to update the player's inventory window (0).
+
  | 0-15
 
  |-
 
  |-
  | Slot
+
  | Has Display Name
  | Short
+
  | Boolean
  | The slot that should be updated
+
  |
 
  |-
 
  |-
  | Slot Data
+
  | Display Name
  | [[Slot Data|Slot]]
+
  | Optional [[Chat]]
  |  
+
  | Only present if previous Boolean is true
  |}
+
  |-
 
+
|colspan="2"| Columns
==== Window Items ====
+
|colspan="2"| Unsigned Byte
 
+
| Number of columns updated
[[File:Inventory-slots.png|thumb|The inventory slots]]
+
|-
 
+
|colspan="2"| Rows
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.
+
  |colspan="2"| Optional Byte
 
+
  | Only if Columns is more than 0; number of rows updated
{| class="wikitable"
+
  |-
  ! Packet ID
+
  |colspan="2"| X
  ! State
+
  |colspan="2"| Optional Byte
  ! Bound To
+
  | Only if Columns is more than 0; x offset of the westernmost column
  ! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x30
+
  |colspan="2"| Z
  |rowspan="3"| Play
+
  |colspan="2"| Optional Byte
|rowspan="3"| Client
+
  | Only if Columns is more than 0; z offset of the northernmost row
| Window ID
 
| Unsigned Byte
 
  | The ID of window which items are being sent for. 0 for player inventory.
 
 
  |-
 
  |-
  | Count
+
  |colspan="2"| Length
  | Short
+
  |colspan="2"| Optional VarInt
  | Number of elements in the following array
+
  | Only if Columns is more than 0; length of the following array
 
  |-
 
  |-
  | Slot Data
+
  |colspan="2"| Data
  | Array of [[Slot Data|Slot]]
+
  |colspan="2"| Optional Array of Unsigned Byte
  |  
+
  | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
  |}
 
  |}
  
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
  
==== Window Property ====
+
Types are based off of rows and columns in <code>map_icons.png</code>:
 
 
This packet is used to inform the client that part of a GUI window should be updated.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x31
+
  ! Icon type
  |rowspan="3"| Play
+
  ! Result
|rowspan="3"| Client
 
| Window ID
 
| Unsigned Byte
 
|
 
 
  |-
 
  |-
  | Property
+
  | 0
  | Short
+
  | White arrow (players)
| The property to be updated, see below
 
 
  |-
 
  |-
  | Value
+
  | 1
  | Short
+
  | Green arrow (item frames)
| The new value for the property, see below
 
|}
 
 
 
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Window type
+
  | 2
  ! Property
+
  | Red arrow
! Value
 
 
  |-
 
  |-
  |rowspan="2"| Furnace
+
  | 3
  | 0: Progress arrow
+
  | Blue arrow
| 0–200 (presumably in in-game ticks)
 
 
  |-
 
  |-
  | 1: Fire icon (fuel)
+
  | 4
  | 0–200 (presumably in in-game ticks)
+
  | White cross
 
  |-
 
  |-
  |rowspan="7"| Enchantment Table
+
  | 5
  | 0: Level requirement for top enchantment slot
+
  | Red pointer
|rowspan="3"| The enchantment's xp level requirement
 
 
  |-
 
  |-
  | 1: Level requirement for middle enchantment slot
+
  | 6
 +
| White circle (off-map players)
 
  |-
 
  |-
  | 2: Level requirement for bottom enchantment slot
+
  | 7
 +
| Small white circle (far-off-map players)
 
  |-
 
  |-
  | 3: The seed for generating the enchantments view for the client
+
  | 8
  | Unknown
+
  | Mansion
 
  |-
 
  |-
  | 4: tooltip shown on mouse hover over top enchantment slot
+
  | 9
  |rowspan="3"| Unknown (set to -1 to hide it)
+
  | Temple
 
  |-
 
  |-
  | 5: tooltip shown on mouse hover over middle enchantment slot
+
  | 10
 +
| White Banner
 
  |-
 
  |-
  | 6: tooltip shown on mouse hover over bottom enchantment slot
+
  | 11
 +
| Orange Banner
 
  |-
 
  |-
  |rowspan="3"| Beacon
+
  | 12
| 0: Power level
+
  | Magenta Banner
  | Unknown
 
 
  |-
 
  |-
  | 1: First potion effect
+
  | 13
  | Unknown
+
  | Light Blue Banner
 +
|-
 +
| 14
 +
| Yellow Banner
 +
|-
 +
| 15
 +
| Lime Banner
 +
|-
 +
| 16
 +
| Pink Banner
 +
|-
 +
| 17
 +
| Gray Banner
 +
|-
 +
| 18
 +
| Light Gray Banner
 +
|-
 +
| 19
 +
| Cyan Banner
 +
|-
 +
| 20
 +
| Purple Banner
 +
|-
 +
| 21
 +
| Blue Banner
 +
|-
 +
| 22
 +
| Brown Banner
 +
|-
 +
| 23
 +
| Green Banner
 
  |-
 
  |-
  | 2: Second potion effect
+
  | 24
  | Unknown
+
  | Red Banner
 
  |-
 
  |-
  | Anvil
+
  | 25
  | 0: Repair cost
+
  | Black Banner
| The repair's cost in xp levels
 
 
  |-
 
  |-
  | Brewing Stand
+
  | 26
  | 0: Brew time
+
  | Treasure marker
| 0–400, with 400 making the arrow empty, and 0 making the arrow full
 
 
  |}
 
  |}
  
==== Confirm Transaction ====
+
==== Trade List ====
  
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag). This packet is also sent from the client to the server in response to a server transaction rejection packet.
+
The list of trades a villager NPC is offering.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,476: Line 2,847:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
  ! Field Type
+
  !colspan="2"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x32
+
  |rowspan="18"| 0x27
  |rowspan="3"| Play
+
  |rowspan="18"| Play
  |rowspan="3"| Client
+
  |rowspan="18"| Client
  | Window ID
+
  |-
  | Byte
+
| colspan="2" | Window ID
  | The ID of the window that the action occurred in
+
  | colspan="2" | VarInt
 +
  | The ID of the window that is open; this is an int rather than a byte.
 
  |-
 
  |-
  | Action Number
+
  | colspan="2" | Size
  | Short
+
  | colspan="2" | Byte
  | Every action that is to be accepted has a unique number. This field corresponds to that number.
+
  | The number of trades in the following array
 
  |-
 
  |-
  | Accepted
+
  | rowspan="11" | Trades
 +
| Input item 1
 +
| rowspan="11" | Array
 +
| [[Slot]]
 +
| The first item the villager is buying
 +
|-
 +
| Output item
 +
| [[Slot]]
 +
| The item the villager is selling
 +
|-
 +
| Has second item
 +
| Boolean
 +
| Whether there is a second item
 +
|-
 +
| Input item 2
 +
| Optional [[Slot]]
 +
| The second item the villager is buying; only present if they have a second item.
 +
|-
 +
| Trade disabled
 
  | Boolean
 
  | Boolean
  | Whether the action was accepted
+
  | True if the trade is disabled; false if the trade is enabled.
 +
|-
 +
| Number of trade uses
 +
| Integer
 +
| Number of times the trade has been used so far
 +
|-
 +
| Maximum number of trade uses
 +
| Integer
 +
| Number of times this trade can be used
 +
|-
 +
| XP
 +
| Integer
 +
|
 +
|-
 +
| Special Price
 +
| Integer
 +
|
 +
|-
 +
| Price Multiplier
 +
| Float
 +
|
 +
|-
 +
| Demand
 +
| Integer
 +
|
 +
|-
 +
|colspan="2"| Villager level
 +
|colspan="2"| VarInt
 +
| Appears on the trade GUI; meaning comes from the translation key <code>merchant.level.</code> + level.
 +
1: Novice, 2: Apprentice, 3: Journeyman, 4: Expert, 5: Master
 +
|-
 +
|colspan="2"| Experience
 +
|colspan="2"| VarInt
 +
| Total experience for this villager (always 0 for the wandering trader)
 +
|-
 +
|colspan="2"| Is regular villager
 +
|colspan="2"| Boolean
 +
| True if this is a regular villager; false for the wandering trader.  When false, hides the villager level and some other GUI elements.
 +
|-
 +
|colspan="2"| Can restock
 +
|colspan="2"| Boolean
 +
| True for regular villagers and false for the wandering trader.  If true, the "Villagers restock up to two times per day." message is displayed when hovering over disabled trades.
 
  |}
 
  |}
  
==== Update Sign ====
+
[[File:1.14-merchant-slots.png|thumb|The merchant UI, for reference]]
 +
{{-}}
 +
 
 +
==== Entity Relative Move ====
 +
 
 +
This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Entity Teleport|Entity Teleport]] should be sent instead.
  
This 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.
+
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,508: Line 2,944:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x33
+
  |rowspan="5"| 0x28
 
  |rowspan="5"| Play
 
  |rowspan="5"| Play
 
  |rowspan="5"| Client
 
  |rowspan="5"| Client
  | Location
+
  | Entity ID
  | Position
+
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Line 1
+
  | Delta X
  | [[Chat]]
+
  | Short
  | First line of text in the sign
+
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
 
  |-
 
  |-
  | Line 2
+
  | Delta Y
  | [[Chat]]
+
  | Short
  | Second line of text in the sign
+
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
 
  |-
 
  |-
  | Line 3
+
  | Delta Z
  | [[Chat]]
+
  | Short
  | Third line of text in the sign
+
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 
  |-
 
  |-
  | Line 4
+
  | On Ground
  | [[Chat]]
+
  | Boolean
  | Fourth line of text in the sign
+
  |  
 
  |}
 
  |}
  
==== Maps ====
+
==== Entity Look And Relative Move ====
  
Updates a rectangular area on a map.
+
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,540: Line 2,976:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
  !colspan="2"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="12"| 0x34
+
  |rowspan="7"| 0x29
  |rowspan="12"| Play
+
  |rowspan="7"| Play
  |rowspan="12"| Client
+
  |rowspan="7"| Client
  |colspan="2"| Item Damage
+
  | Entity ID
  |colspan="2"| VarInt
+
  | VarInt
| The damage value (map ID) of the map being modified
 
|-
 
|colspan="2"| Scale
 
|colspan="2"| Byte
 
 
  |  
 
  |  
|-
 
|colspan="2"| Icon Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  | Delta X
| Direction And Type
+
  | Short
|rowspan="3"| Array
+
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
  | Byte
 
  | 0xF0 = Direction, 0x0F = Type
 
 
  |-
 
  |-
  | X
+
  | Delta Y
  | Byte
+
  | Short
  |  
+
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
 
  |-
 
  |-
  | Z
+
  | Delta Z
  | Byte
+
  | Short
|
+
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
  |-  
 
|colspan="2"| Columns
 
|colspan="2"| Byte
 
| Number of columns updated
 
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | Yaw
  |colspan="2"| Optional Byte
+
  | Angle
  | Only if Columns is more than 0; number of rows updated
+
  | New angle, not a delta
 
  |-
 
  |-
  |colspan="2"| X
+
  | Pitch
  |colspan="2"| Optional Byte
+
  | Angle
  | Only if Columns is more than 0; x offset of the westernmost column
+
  | New angle, not a delta
 
  |-
 
  |-
  |colspan="2"| Z
+
  | On Ground
|colspan="2"| Optional Byte
+
  | Boolean
| 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 Look ====
  
Essentially a block update on a block entity.
+
This packet is sent by the server when an entity rotates.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,610: Line 3,024:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x35
+
  |rowspan="4"| 0x2A
  |rowspan="3"| Play
+
  |rowspan="4"| Play
  |rowspan="3"| Client
+
  |rowspan="4"| Client
  | Location
+
  | Entity ID
  | Position
+
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Action
+
  | Yaw
  | Unsigned Byte
+
  | Angle
  | The type of update to perform, see below
+
  | New angle, not a delta
 
  |-
 
  |-
  | NBT Data
+
  | Pitch
  | Optional [[NBT|NBT Tag]]
+
  | Angle
  | If not present then it's a TAG_END (0)
+
  | New angle, not a delta
  |}
+
|-
 +
| On Ground
 +
| Boolean
 +
|
 +
  |}
  
''Action'' field:
+
==== Entity ====
  
* '''1''': Set SpawnPotentials of a mob spawner
+
This packet may be used to initialize an entity.
* '''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 ====
+
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.
 
 
Sent on placement of sign.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,647: Line 3,058:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x36
+
  |rowspan="1"| 0x2B
 
  |rowspan="1"| Play
 
  |rowspan="1"| Play
 
  |rowspan="1"| Client
 
  |rowspan="1"| Client
  | Location
+
  | Entity ID
  | Position
+
  | VarInt
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Statistics ====
+
==== Vehicle Move (clientbound) ====
 +
 
 +
Note that all fields use absolute positioning and do not allow for relative positioning.
  
 
{| 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="5"| 0x2C
  |rowspan="3"| Play
+
  |rowspan="5"| Play
  |rowspan="3"| Client
+
  |rowspan="5"| Client
  |colspan="2"| Count
+
  | X
  |colspan="2"| VarInt
+
  | Double
  | Number of elements in the following array
+
  | Absolute position (X coordinate)
 
  |-
 
  |-
  |rowspan="2"| Statistic
+
  | Y
| Name
+
  | Double
|rowspan="2"| Array
+
  | Absolute position (Y coordinate)
  | String
 
  | [https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0 https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0]
 
 
  |-
 
  |-
  | Value
+
  | Z
  | VarInt
+
  | Double
  | The amount to set it to
+
  | Absolute position (Z coordinate)
 +
|-
 +
| Yaw
 +
| Float
 +
| Absolute rotation on the vertical axis, in degrees
 +
|-
 +
| Pitch
 +
| Float
 +
| Absolute rotation on the horizontal axis, in degrees
 
  |}
 
  |}
  
==== Player List Item ====
+
==== Open Book ====
  
Sent by the notchian server to update the user list (<tab> in the client).
+
Sent when a player right clicks with a signed book. This tells the client to open the book GUI.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,691: Line 3,110:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="4"| Field Name
+
  ! Field Name
  !colspan="3"| Field Type
+
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="19"| 0x38
+
  |rowspan="1"| 0x2D
  |rowspan="19"| Play
+
  |rowspan="1"| Play
  |rowspan="19"| Client
+
  |rowspan="1"| Client
  |colspan="4"| Action
+
  | Hand
|colspan="3"| VarInt
+
| VarInt enum
  | Determines the rest of the Player format after the UUID
+
| 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
 
  |-
 
  |-
  |colspan="4"| Number Of Players
+
  |rowspan="3"| 0x2E
  |colspan="3"| VarInt
+
  |rowspan="3"| Play
  | Number of elements in the following array
+
|rowspan="3"| Client
 +
| Window ID
 +
| VarInt
 +
  | A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
  |-
 
  |-
  |rowspan="17"| Player
+
  | Window Type
|colspan="3"| UUID
+
  | VarInt
  |rowspan="17"| Array
+
  | The window type to use for display. Contained in the <code>minecraft:menu</code> regisry; see [[Inventory]] for the different values.
|colspan="2"| UUID
 
  |  
 
 
  |-
 
  |-
  ! Action
+
  | Window Title
  !colspan="2"| Field Name
+
| [[Chat]]
  !colspan="2"|
+
| The title of the window
  !  
+
|}
 +
 
 +
==== Open Sign Editor ====
 +
 
 +
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]]. There must already be a sign at the given location (which the client does not do automatically) - send a [[#Block Change|Block Change]] first.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
  ! Field Type
 +
  ! Notes
 
  |-
 
  |-
  |rowspan="10"| 0: add player
+
  |rowspan="1"| 0x2F
  |colspan="2"| Name
+
  |rowspan="1"| Play
  |colspan="2"| String
+
  |rowspan="1"| Client
 +
| Location
 +
| Position
 
  |  
 
  |  
 +
|}
 +
 +
==== Craft Recipe Response ====
 +
 +
Response to the serverbound packet ([[#Craft Recipe Request|Craft Recipe Request]]), with the same recipe ID.  Appears to be used to notify the UI.
 +
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  |rowspan="2"| 0x30
  |colspan="2"| VarInt
+
  |rowspan="2"| Play
  | Number of elements in the following array
+
|rowspan="2"| Client
 +
| Window ID
 +
| Byte
 +
  |
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | Recipe
  | Name
+
| Identifier
  |rowspan="4"| Array
+
  | A recipe ID
  | String
+
  |}
  |
+
 
 +
==== Player Abilities (clientbound) ====
 +
 
 +
The latter 2 floats are used to indicate the field of view and flying speed respectively, while the first byte is used to determine the value of 4 booleans.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
  ! Notes
 
  |-
 
  |-
  | Value
+
  |rowspan="3"| 0x31
  | String
+
  |rowspan="3"| Play
  |  
+
  |rowspan="3"| Client
|-
+
  | Flags
  | Is Signed
+
  | Byte
  | Boolean
+
  | Bit field, see below
  |  
 
 
  |-
 
  |-
  | Signature
+
  | Flying Speed
  | Optional String
+
  | Float
  | Only if Is Signed is true
+
  | 0.05 by default
 
  |-
 
  |-
  |colspan="2"| Gamemode
+
  | Field of View Modifier
  |colspan="2"| VarInt
+
| Float
  |  
+
  | Modifies the field of view, like a speed potion. A Notchian server will use the same value as the movement speed sent in the [[Protocol#Entity_Properties|Entity Properties]] packet, which defaults to 0.1 for players.
 +
  |}
 +
 
 +
About the flags:
 +
 
 +
{| class="wikitable"
 
  |-
 
  |-
  |colspan="2"| Ping
+
  ! Field
  |colspan="2"| VarInt
+
  ! Bit
|
 
 
  |-
 
  |-
  |colspan="2"| Has Display Name
+
  | Invulnerable
|colspan="2"| Boolean
+
  | 0x01
  |  
 
 
  |-
 
  |-
  |colspan="2"| Display Name
+
  | Flying
|colspan="2"| Optional [[Chat]]
+
  | 0x02
  | Only if Has Display Name is true
 
 
  |-
 
  |-
  | 1: update gamemode
+
  | Allow Flying
|colspan="2"| Gamemode
+
  | 0x04
|colspan="2"| VarInt
 
|
 
|-
 
| 2: update latency
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
  |  
 
 
  |-
 
  |-
  |rowspan="2"| 3: update display name
+
  | Creative Mode (Instant Break)
|colspan="2"| Has Display Name
+
  | 0x08
|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 ====
+
==== Combat Event ====
 
 
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.
 
 
 
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,797: Line 3,248:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x39
+
  |rowspan="8"| 0x32
  |rowspan="3"| Play
+
  |rowspan="8"| Play
  |rowspan="3"| Client
+
  |rowspan="8"| Client
  | Flags
+
  |colspan="2"| Event
  | Byte
+
  | VarInt Enum
  | Bit mask, see above
+
  | Determines the layout of the remaining packet
 
  |-
 
  |-
  | Flying Speed
+
! Event
  | Float
+
! Field Name
 +
!
 +
!
 +
|-
 +
| 0: enter combat
 +
| ''no fields''
 +
| ''no fields''
 +
|
 +
|-
 +
|rowspan="2"| 1: end combat
 +
  | Duration
 +
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Walking Speed
+
  | Entity ID
  | Float
+
  | Int
 
  |  
 
  |  
|}
 
 
==== Tab-Complete ====
 
 
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.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  |rowspan="3"| 2: entity dead
|rowspan="2"| Play
+
  | Player ID
|rowspan="2"| Client
 
  | Count
 
 
  | VarInt
 
  | VarInt
  | Number of elements in the following array
+
  |  
 +
|-
 +
| Entity ID
 +
| Int
 +
|
 
  |-
 
  |-
  | Matches
+
  | Message
  | Array of String
+
  | [[Chat]]
  | One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
  |  
 
  |}
 
  |}
  
==== Scoreboard Objective ====
+
==== Player Info ====
  
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
+
Sent by the server to update the user list (<tab> in the client).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,849: Line 3,300:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="4"| Field Name
  ! Field Type
+
  !colspan="3"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x3B
+
  |rowspan="19"| 0x33
  |rowspan="4"| Play
+
  |rowspan="19"| Play
  |rowspan="4"| Client
+
  |rowspan="19"| Client
  | Objective Name
+
  |colspan="4"| Action
  | String
+
  |colspan="3"| VarInt
  | An unique name for the objective
+
  | Determines the rest of the Player format after the UUID
 
  |-
 
  |-
  | Mode
+
  |colspan="4"| Number Of Players
  | Byte
+
  |colspan="3"| VarInt
  | 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Objective Value
+
  |rowspan="17"| Player
  | Optional String
+
|colspan="3"| UUID
  | Only if mode is 0 or 2. The text to be displayed for the score
+
  |rowspan="17"| Array
 +
  |colspan="2"| UUID
 +
|
 
  |-
 
  |-
  | Type
+
  ! Action
  | Optional String
+
  !colspan="2"| Field Name
| Only if mode is 0 or 2. “integer” or “hearts”
+
  !colspan="2"|
|}
+
  !  
 
 
==== Update Score ====
 
 
 
This is sent to the client when it should update a scoreboard item.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x3C
+
  |rowspan="10"| 0: add player
  |rowspan="4"| Play
+
  |colspan="2"| Name
  |rowspan="4"| Client
+
  |colspan="2"| String (16)
| Score Name
+
  |  
| String
 
  | The name of the score to be updated or removed
 
 
  |-
 
  |-
  | Action
+
  |colspan="2"| Number Of Properties
  | Byte
+
  |colspan="2"| VarInt
  | 0 to create/update an item. 1 to remove an item.
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Objective Name
+
  |rowspan="4"| Property
  | String
+
| Name
  | The name of the objective the score belongs to
+
|rowspan="4"| Array
 +
  | String (32767)
 +
  |  
 
  |-
 
  |-
 
  | Value
 
  | Value
  | Optional VarInt
+
  | String (32767)
  | The score to be displayed next to the entry. Only sent when Action does not equal 1.
+
  |  
  |}
+
  |-
 
+
| Is Signed
==== Display Scoreboard ====
+
  | Boolean
 
+
  |
This is sent to the client when it should display a scoreboard.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x3D
+
  | Signature
|rowspan="2"| Play
+
  | Optional String (32767)
|rowspan="2"| Client
+
  | Only if Is Signed is true
| Position
 
  | Byte
 
  | The position of the scoreboard. 0: list, 1: sidebar, 2: below name.
 
 
  |-
 
  |-
  | Score Name
+
  |colspan="2"| Gamemode
  | String
+
|colspan="2"| VarInt
  | The unique name for the scoreboard to be displayed.
+
|
 +
|-
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
| Measured in milliseconds
 +
|-
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
  |colspan="2"| Optional [[Chat]]
 +
| Only if Has Display Name is true
 +
|-
 +
| 1: update gamemode
 +
|colspan="2"| Gamemode
 +
|colspan="2"| VarInt
 +
|
 +
  |-
 +
| 2: update latency
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
| Measured in milliseconds
 +
|-
 +
|rowspan="2"| 3: update display name
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
|colspan="2"| Optional [[Chat]]
 +
| Only send if Has Display Name is true
 +
|-
 +
| 4: remove player
 +
|colspan="2"| ''no fields''
 +
|colspan="2"| ''no fields''
 +
|
 
  |}
 
  |}
  
==== Teams ====
+
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 ====
  
Creates and updates teams.
+
Used to rotate the client player to face the given location or entity (for <code>/teleport [<targets>] <x> <y> <z> facing</code>).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,941: Line 3,416:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="10"| 0x3E
+
  |rowspan="8"| 0x34
  |rowspan="10"| Play
+
  |rowspan="8"| Play
  |rowspan="10"| Client
+
  |rowspan="8"| Client
| Team Name
 
| String
 
| A unique name for the team. (Shared with scoreboard).
 
 
  |-
 
  |-
  | Mode
+
  | Feet/eyes
  | Byte
+
  | VarInt enum
  | If 0 then the team is created.
+
  | Values are feet=0, eyes=1. If set to eyes, aims using the head position; otherwise aims using the feet position.
 
 
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
+
  | Target x
  | Optional String
+
  | Double
  | Only if Mode = 0 or 2.
+
  | x coordinate of the point to face towards
 
  |-
 
  |-
  | Team Prefix
+
  | Target y
  | Optional String
+
  | Double
  | Only if Mode = 0 or 2. Displayed before the players' name that are part of this team
+
  | y coordinate of the point to face towards
 
  |-
 
  |-
  | Team Suffix
+
  | Target z
  | Optional String
+
  | Double
  | Only if Mode = 0 or 2. Displayed after the players' name that are part of this team
+
  | z coordinate of the point to face towards
 
  |-
 
  |-
  | Friendly Fire
+
  | Is entity
  | Optional Byte
+
  | Boolean
  | Only if Mode = 0 or 2. 0 for off, 1 for on, 3 for seeing friendly invisibles
+
  | If true, additional information about an entity is provided.
 
  |-
 
  |-
  | Name Tag Visibility
+
  | Entity ID
| Optional String
 
| Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never
 
|-
 
| Color
 
| Optional Byte
 
| Only if Mode = 0 or 2. Same as [[Chat]] colors
 
|-
 
| Player Count
 
 
  | Optional VarInt
 
  | Optional VarInt
  | Only if Mode = 0 or 3 or 4. Number of players in the array
+
  | Only if is entity is true &mdash; the entity to face towards
 
  |-
 
  |-
  | Players
+
  | Entity feet/eyes
  | Optional Array of String
+
  | Optional VarInt enum
  | 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
+
  | Whether to look at the entity's eyes or feet. Same values and meanings as before, just for the entity's head/feet.
 
  |}
 
  |}
  
==== Plugin Message ====
+
If the entity given by entity ID cannot be found, this packet should be treated as if is entity was false.
  
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>.
+
==== Player Position And Look (clientbound) ====
  
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/]
+
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
 +
 
 +
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
  
{| 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
 
|-
 
|rowspan="2"| 0x3F
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Channel
 
| String
 
| Name of the [[plugin channel]] used to send the data
 
|-
 
| Data
 
| Byte Array
 
| Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].
 
|}
 
  
==== Disconnect ====
+
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.
  
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.
+
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,031: Line 3,471:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x40
+
  |rowspan="7"| 0x35
  |rowspan="1"| Play
+
  |rowspan="7"| Play
  |rowspan="1"| Client
+
  |rowspan="7"| Client
  | Reason
+
  | X
  | [[Chat]]
+
| Double
| Displayed to the client when the connection terminates.
+
| 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
 
  |}
 
  |}
  
==== Server Difficulty ====
+
About the Flags field:
  
Changes the difficulty setting in the client's option menu
+
<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"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x41
+
! Field
  |rowspan="1"| Play
+
! Bit
  |rowspan="1"| Client
+
|-
  | Difficulty
+
| X
  | Unsigned Byte
+
| 0x01
  | 0: peaceful, 1: easy, 2: normal, 3: hard
+
|-
 +
| Y
 +
| 0x02
 +
  |-
 +
| Z
 +
  | 0x04
 +
|-
 +
  | Y_ROT
 +
| 0x08
 +
  |-
 +
  | X_ROT
 +
  | 0x10
 
  |}
 
  |}
  
==== Combat Event ====
+
==== Unlock Recipes ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,069: Line 3,538:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x42
+
  |rowspan="10"| 0x36
  |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
 
| Optional Int
 
| Only for end combat and entity dead
 
 
  |-
 
  |-
  | Message
+
  | Recipe IDs
  | String
+
  | Optional Array of Identifier, only present if mode is 0 (init)
  | 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,103: Line 3,595:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x43
+
  |rowspan="2"| 0x37
  |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,117: Line 3,613:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="18"| 0x44
+
  |rowspan="2"| 0x38
  |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"| 0x39
  | 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
+
|}
 +
 
 +
==== 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
 
  |-
 
  |-
  | New Radius
+
  |rowspan="3"| 0x3A
  | Double
+
|rowspan="3"| Play
  | meters
+
|rowspan="3"| Client
 +
| Dimension
 +
  | Int Enum
 +
  | -1: The Nether, 0: The Overworld, 1: The End
 
  |-
 
  |-
  | Speed
+
  | Gamemode
  | VarLong
+
  | Unsigned Byte
  | 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
+
  | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
 
  |-
 
  |-
  |rowspan="2"| 2: set center
+
  | Level Type
  | X
+
  | String (16)
  | Double
+
  | Same as [[#Join Game|Join Game]]
|  
+
  |}
  |-
+
 
| Z
+
{{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).
| Double
+
 
|
+
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.}}
|-
+
 
|rowspan="8"| 3: initialize
+
==== Entity Head Look ====
| X
+
 
| Double
+
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.
| Z
+
 
| Double
 
|
 
|-
 
| Old Radius
 
| Double
 
|
 
|-
 
| New Radius
 
| Double
 
|
 
|-
 
| Speed
 
| VarLong
 
|
 
|-
 
| Portal Teleport Boundary
 
| VarInt
 
| Resulting coordinates from a portal teleport are limited to +-value. Usually 29999984.
 
|-
 
| Warning Time
 
| VarInt
 
|
 
|-
 
| Warning Blocks
 
| VarInt
 
|
 
|-
 
|rowspan="1"| 4: set warning time
 
| Warning Time
 
| VarInt
 
| unit?
 
|-
 
|rowspan="1"| 5: set warning blocks
 
| Warning Blocks
 
| VarInt
 
|
 
|}
 
 
 
==== Title ====  
 
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x45
+
  |rowspan="2"| 0x3B
  |rowspan="9"| Play
+
  |rowspan="2"| Play
  |rowspan="9"| Client
+
  |rowspan="2"| Client
  |colspan="2"| Action
+
  | Entity ID
 
  | VarInt
 
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
! Action
+
  | Head Yaw
! Field Name
+
  | Angle
!
+
  | New angle, not a delta
!
 
|-
 
| 0: set title
 
| Title Text
 
| [[Chat]]
 
|
 
|-
 
| 1: set subtitle
 
| Subtitle Text
 
| [[Chat]]
 
|
 
|-
 
|rowspan="3"| 2: set times and display
 
| Fade In
 
| Int
 
| ticks
 
|-
 
| Stay
 
| Int
 
| ticks
 
|-
 
| Fade Out
 
| Int
 
| ticks
 
|-
 
| 3: hide
 
| ''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.
+
==== Select Advancement Tab ====
  
==== Set Compression ====
+
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,272: Line 3,721:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x46
+
  |rowspan="2"| 0x3C
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Threshold
+
  | Has id
  | VarInt
+
  | Boolean
  | Packets of this size or higher may be compressed
+
  | Indicates if the next field is present
 +
|-
 +
| Optional Identifier
 +
| String (32767)
 +
| See below
 
  |}
 
  |}
  
==== Player List Header/Footer ====
+
The Identifier can be one of the following:
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Optional Identifier
  ! State
+
  |-
  ! Bound To
+
  | minecraft:story/root
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x47
+
  | minecraft:nether/root
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Header
 
| [[Chat]]
 
|
 
 
  |-
 
  |-
  | Footer
+
  | minecraft:end/root
| [[Chat]]
 
|
 
|}
 
 
 
==== Resource Pack Send ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x48
+
  | minecraft:adventure/root
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| URL
 
| String
 
| The URL to the resource pack.
 
 
  |-
 
  |-
  | Hash
+
  | minecraft:husbandry/root
| 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 ====  
+
If no or an invalid identifier is sent, the client will switch to the first tab in the GUI.
 +
 
 +
==== World Border ====  
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,330: Line 3,757:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x49
+
  |rowspan="18"| 0x3D
  |rowspan="2"| Play
+
  |rowspan="18"| Play
  |rowspan="2"| Client
+
  |rowspan="18"| Client
  | Entity ID
+
  |colspan="2"| Action
  | VarInt
+
  | VarInt Enum
  |  
+
  | Determines the format of the rest of the packet
 
  |-
 
  |-
| Tag
+
  ! Action
| [[NBT|NBT Tag]]
 
|
 
|}
 
 
 
=== Serverbound ===
 
 
 
==== Keep Alive ====
 
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
 
 
 
{| 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="1"| 0x00
+
  |rowspan="2"| 2: set center
  |rowspan="1"| Play
+
  | X
|rowspan="1"| Server
+
  | Double
| Keep Alive ID
 
  | VarInt
 
 
  |  
 
  |  
  |}
+
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
|rowspan="8"| 3: initialize
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Old Diameter
 +
| Double
 +
| Current length of a single side of the world border, in meters
 +
|-
 +
| New Diameter
 +
| Double
 +
| Target length of a single side of the world border, in meters
 +
|-
 +
| Speed
 +
| VarLong
 +
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 +
|-
 +
| Portal Teleport Boundary
 +
| VarInt
 +
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 +
|-
 +
| Warning Time
 +
| VarInt
 +
| In seconds as set by <code>/worldborder warning time</code>
 +
|-
 +
| Warning Blocks
 +
| VarInt
 +
| In meters
 +
|-
 +
|rowspan="1"| 4: set warning time
 +
| Warning Time
 +
| VarInt
 +
| In seconds as set by <code>/worldborder warning time</code>
 +
|-
 +
|rowspan="1"| 5: set warning blocks
 +
| Warning Blocks
 +
| VarInt
 +
| In meters
 +
  |}
 +
 
 +
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>
  
==== Chat Message ====
+
==== Camera ====
  
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.
+
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"
 
{| class="wikitable"
Line 3,380: Line 3,873:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x01
+
  |rowspan="1"| 0x3E
 
  |rowspan="1"| Play
 
  |rowspan="1"| Play
  |rowspan="1"| Server
+
  |rowspan="1"| Client
  | Message
+
  | Camera ID
  | String
+
  | VarInt
  | The client sends the raw input, not [[Chat]]
+
  | ID of the entity to set the client's camera to
 
  |}
 
  |}
  
==== Use Entity ====
+
The notchian also loads certain shaders for given entities:
  
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
+
* 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
  
A Notchian server only accepts this packet if the entity being attacked/used is visible without obstruction and within a 4-unit radius of the player's position.
+
==== Held Item Change (clientbound) ====
  
Note that middle-click in creative mode is interpreted by the client and sent as a [[#Creative Inventory Action|Creative Inventory Action]] packet instead.
+
Sent to change the player's slot selection.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,404: Line 3,900:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x02
+
  |rowspan="1"| 0x3F
  |rowspan="5"| Play
+
  |rowspan="1"| Play
  |rowspan="5"| Server
+
  |rowspan="1"| Client
| Target
+
  | Slot
| VarInt
+
  | Byte
|
+
  | The slot which the player has selected (0–8)
|-
 
| Type
 
| VarInt
 
| 0: interact, 1: attack, 2: interact at
 
|-
 
| Target X
 
| Optional Float
 
| Only if Type is interact at
 
|-
 
| Target Y
 
| Optional Float
 
| Only if Type is interact at
 
|-
 
  | Target Z
 
  | Optional Float
 
  | Only if Type is interact at
 
 
  |}
 
  |}
  
==== Player ====
+
==== 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.}}
  
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
+
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.
  
When dropping from sufficient height, fall damage is applied when this state goes from false to true. The amount of damage applied is based on the point where it last changed from true to false. Note that there are several movement related packets containing this state.
+
Sent 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,442: Line 3,924:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x03
+
  |rowspan="2"| 0x40
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Server
+
  |rowspan="2"| Client
  | On Ground
+
  | Chunk X
  | Boolean
+
  | VarInt
  | True if the client is on the ground, false otherwise
+
  | Chunk X coordinate of the player's position
 +
|-