Difference between revisions of "Protocol"

From wiki.vg
Jump to: navigation, search
(Spawn Object: Specified that Object Data is always an Int, and moved the Type to the Notes page.)
(Change Game State: State 104, added in 18w20b (MC-77856))
 
(316 intermediate revisions by 48 users not shown)
Line 5: Line 5:
 
   |ICON =  
 
   |ICON =  
 
   |HEADING = Heads up!
 
   |HEADING = Heads up!
   |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''computer edition'''. For the computer edition pre-releases, see [[Pre-release protocol]]. For Pocket Edition, see [[Pocket Minecraft Protocol]].
+
   |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 page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''.
 
This page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''.
  
If you're having trouble, check out the [[Protocol FAQ|FAQ]] or ask for help in the IRC channel ([irc://irc.freenode.net/mcdevs #mcdevs on 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 18: Line 18:
 
== Definitions ==
 
== Definitions ==
  
The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] ([[#Handshaking|Handshaking]], 0x00, serverbound) and [[#Login Success|Login Success]] ([[#Login|Login]], 0x02, clientbound).
+
The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] and [[#Login Success|Login Success]].
  
 
=== Data types ===
 
=== Data types ===
Line 41: 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
 
  | 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”.
 
  | 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.
 +
|-
 +
| Notchian
 +
| The official implementation of vanilla Minecraft as developed and released by Mojang.
 
  |}
 
  |}
  
Line 71: 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 91: 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 103: Line 111:
 
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
 
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
  
If compressed, the uncompressed length of (Packet ID + Data) must be equal to or over the threshold set in the packet [[#Set Compression 2|Set Compression]] ([[#Login|Login]], 0x03, clientbound), otherwise the receiving party will disconnect.
+
If compressed, the uncompressed length of (Packet ID + Data) must be equal to or over the threshold set in the packet [[#Set Compression|Set Compression]], otherwise the receiving party will disconnect.
  
Compression can be disabled by sending the packet [[#Set Compression 2|Set Compression]] ([[#Login|Login]], 0x03, clientbound) with a Threshold of -1.
+
Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all.
  
 
== Handshaking ==
 
== Handshaking ==
Line 132: Line 140:
 
  | 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]]
 
  |}
 
  |}
Line 175: Line 183:
 
=== Clientbound ===
 
=== Clientbound ===
  
==== Keep Alive ====
+
==== Spawn Object ====
  
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.
+
Sent by the server when a vehicle or other object is created.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 187: Line 195:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x00
+
  |rowspan="12"| 0x00
  |rowspan="1"| Play
+
  |rowspan="12"| Play
  |rowspan="1"| Client
+
  |rowspan="12"| Client
  | Keep Alive ID
+
  | Entity ID
 
  | VarInt
 
  | VarInt
 +
| EID of the object
 +
|-
 +
| Object UUID
 +
| UUID
 
  |  
 
  |  
|}
 
 
==== Join Game ====
 
 
See [[Protocol Encryption]] for information on logging in.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x01
+
  | Type
  |rowspan="7"| Play
+
  | VarInt
|rowspan="7"| Client
+
  | The type of object (same as in [[#Spawn Mob|Spawn Mob]])
| Entity ID
 
| Int
 
  | The player's Entity ID (EID)
 
 
  |-
 
  |-
  | Gamemode
+
  | X
  | Unsigned Byte
+
  | Double
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
+
  |  
 
  |-
 
  |-
  | Dimension
+
  | Y
  | Byte
+
| Double
  | -1: Nether, 0: Overworld, 1: End
+
|
 +
|-
 +
| 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 253: 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 hotbar
+
  | 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 283: 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
 
  |-
 
  |-
  | Time of day
+
  | X
  | Long
+
  | Double
  | The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
+
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
  |  
 
  |}
 
  |}
  
==== Entity Equipment ====
+
==== Spawn Mob ====
 +
 
 +
Sent by the server when a mob entity is spawned.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 305: 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
+
  |  
 
  |-
 
  |-
  | Slot
+
  | Entity UUID
  | Short
+
  | UUID
  | Equipment slot. 0: held, 1–4: armor slot (1: boots, 2: leggings, 3: chestplate, 4: helmet)
+
  |  
 
  |-
 
  |-
  | Item
+
  | Type
  | [[Slot Data|Slot]]
+
  | VarInt
| Item in slot format
+
  | The type of mob. See [[Entities#Mobs]]
  |}
 
 
 
==== Spawn Position ====
 
 
 
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.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="1"| 0x05
+
  | X
  |rowspan="1"| Play
+
| Double
  |rowspan="1"| Client
+
|
  | Location
+
|-
  | Position
+
| Y
  | Spawn location
+
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Yaw
 +
| Angle
 +
|
 +
|-
 +
| Pitch
 +
| Angle
 +
|
 +
|-
 +
| Head Pitch
 +
| Angle
 +
|
 +
|-
 +
| Velocity X
 +
| Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 +
  |-
 +
| Velocity Y
 +
  | Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 +
|-
 +
  | Velocity Z
 +
  | Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 +
|-
 +
| Metadata
 +
| [[Entities#Entity Metadata Format|Entity Metadata]]
 +
  |  
 
  |}
 
  |}
  
==== Update Health ====
+
==== Spawn Painting ====
  
Sent by the server to update/set the health of the player it is sent to.
+
This packet shows location, name, and type of painting.
 
 
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 355: Line 397:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x06
+
  |rowspan="5"| 0x04
  |rowspan="3"| Play
+
  |rowspan="5"| Play
  |rowspan="3"| Client
+
  |rowspan="5"| Client
  | Health
+
  | Entity ID
  | Float
+
  | VarInt
  | 0 or less = dead, 20 = full HP
+
|
 +
|-
 +
| Entity UUID
 +
| UUID
 +
  |  
 
  |-
 
  |-
  | Food
+
  | Motive
 
  | VarInt
 
  | VarInt
  | 0–20
+
  | Panting's ID, see below
  |-  
+
  |-
  | Food Saturation
+
  | Location
  | Float
+
  | Position
  | Seems to vary from 0.0 to 5.0 in integer increments
+
  | Center coordinates (see below)
 +
|-
 +
| Direction
 +
| Byte Enum
 +
| Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
 
  |}
 
  |}
  
==== Respawn ====
+
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.
  
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.
+
List of paintings by coordinates in <code>paintings_kristoffer_zetterstrand.png</code> (where x and y are in pixels from the top left and width and height are in pixels or 16ths of a block):
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
  ! State
+
  ! ID
  ! Bound To
+
  ! x
  ! Field Name
+
  ! y
  ! Field Type
+
  ! width
  ! Notes
+
  ! height
 
  |-
 
  |-
  |rowspan="4"| 0x07
+
  | <code>minecraft:kebab</code>
  |rowspan="4"| Play
+
  | 0
  |rowspan="4"| Client
+
  | 0
  | Dimension
+
  | 0
  | Int
+
  | 16
  | -1: The Nether, 0: The Overworld, 1: The End
+
  | 16
 
  |-
 
  |-
  | Difficulty
+
  | <code>minecraft:aztec</code>
  | Unsigned Byte
+
| 1
  | 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
+
  | 16
 +
  | 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:alban</code>
 +
| 2
 +
| 32
 +
| 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:aztec2</code>
 +
| 3
 +
| 48
 +
| 0
 +
| 16
 +
| 16
 +
|-
 +
| <code>minecraft:bomb</code>
 +
| 4
 +
| 64
 +
| 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Gamemode
+
  | <code>minecraft:plant</code>
  | Unsigned Byte
+
| 5
  | 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
+
  | 80
 +
  | 0
 +
| 16
 +
| 16
 
  |-
 
  |-
  | Level Type
+
  | <code>minecraft:wasteland</code>
| String
+
  | 6
| Same as [[#Join Game|Join Game]]
+
  | 96
|}
+
  | 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 player's 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 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
 
 
 
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”.
 
 
 
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
 
 
 
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 
 
 
The yaw in degrees of a player standing at point (x0, z0) and looking towards point (x, z) 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:pool</code>
  |rowspan="6"| Play
+
  | 7
  |rowspan="6"| Client
+
  | 0
  | X
+
  | 32
  | Double
+
  | 32
  | Absolute or relative position, depending on Flags
+
  | 16
 
  |-
 
  |-
  | Y
+
  | <code>minecraft:courbet</code>
  | Double
+
  | 8
  | Absolute or relative position, depending on Flags
+
  | 32
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Z
+
  | <code>minecraft:sea</code>
  | Double
+
  | 9
  | Absolute or relative position, depending on Flags
+
  | 64
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft:sunset</code>
  | Float
+
  | 10
  | Absolute or relative rotation on the X Axis, in degrees
+
  | 96
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft:creebet</code>
  | Float
+
  | 11
  | Absolute or relative rotation on the Y Axis, in degrees
+
  | 128
 +
| 32
 +
| 32
 +
| 16
 
  |-
 
  |-
  | Flags
+
  | <code>minecraft:wanderer</code>
  | Byte
+
  | 12
  | Bit field, see below
+
  | 0
  |}
+
  | 64
 
+
| 16
About the Flags field:
+
  | 32
 
 
  <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:graham</code>
  ! Bit
+
  | 13
 +
| 16
 +
| 64
 +
| 16
 +
| 32
 
  |-
 
  |-
  | X
+
  | <code>minecraft:match</code>
  | 0x01
+
  | 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
 +
|-
 +
| <code>minecraft:void</code>
 +
| 17
 +
| 96
 +
| 128
 +
| 32
 +
| 32
 +
|-
 +
| <code>skull_and_roses</code>
 +
| 18
 +
| 128
 +
| 128
 +
| 32
 +
| 32
 +
|-
 +
| <code>minecraft:wither</code>
 +
| 19
 +
| 160
 +
| 128
 +
| 32
 +
| 32
 +
|-
 +
| <code>minecraft:fighters</code>
 +
| 20
 +
| 0
 +
| 96
 +
| 64
 +
| 32
 +
|-
 +
| <code>minecraft:pointer</code>
 +
| 21
 +
| 0
 +
| 192
 +
| 64
 +
| 64
 +
|-
 +
| <code>minecraft:pigscene</code>
 +
| 22
 +
| 64
 +
| 192
 +
| 64
 +
| 64
 +
|-
 +
| <code>minecraft:burning_skull</code>
 +
| 23
 +
| 128
 +
| 192
 +
| 64
 +
| 64
 
  |-
 
  |-
  | Y_ROT
+
  | <code>minecraft:skeleton</code>
  | 0x08
+
  | 24
 +
| 192
 +
| 64
 +
| 64
 +
| 48
 
  |-
 
  |-
  | X_ROT
+
  | <code>minecraft:donkey_kong</code>
  | 0x10
+
  | 25
 +
| 192
 +
| 112
 +
| 64
 +
| 48
 
  |}
 
  |}
  
==== Held Item Change ====
+
The {{Minecraft Wiki|Painting#Canvases|Minecraft Wiki article on paintings}} also provides a list of painting names to the actual images.
 +
 
 +
==== Spawn Player ====
 +
 
 +
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
 +
 
 +
This packet must be sent after the [[#Player Info|Player Info]] packet that adds the player data for the client to use when spawning a player. If the Player Info for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player Info packet includes skin/cape data.
  
Sent to change the player's slot selection.
+
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 510: Line 634:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x09
+
  |rowspan="8"| 0x05
  |rowspan="1"| Play
+
  |rowspan="8"| Play
  |rowspan="1"| Client
+
  |rowspan="8"| Client
  | Slot
+
  | Entity ID
  | Byte
+
  | VarInt
  | The slot which the player has selected (0–8)
+
| Player's EID
 +
|-
 +
| Player UUID
 +
| UUID
 +
| See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
 +
|-
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Y
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
| Yaw
 +
| Angle
 +
|
 +
|-
 +
| Pitch
 +
| Angle
 +
|
 +
|-
 +
| Metadata
 +
| [[Entities#Entity Metadata Format|Entity Metadata]]
 +
  |  
 
  |}
 
  |}
  
==== Use Bed ====
+
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 :)
  
This packet tells that a player goes to bed.
+
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>.
  
The client with the matching Entity ID will go into bed mode.
+
==== Animation (clientbound) ====
  
This Packet is sent to all nearby players including the one sent to bed.
+
Sent whenever an entity should change animation.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 534: Line 692:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x0A
+
  |rowspan="2"| 0x06
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Sleeping player's EID
+
  | Player ID
 
  |-
 
  |-
  | Location
+
  | Animation
  | Position
+
  | Unsigned Byte
  | Block location of the head part of the bed
+
  | Animation ID (see below)
 
  |}
 
  |}
  
==== Animation ====
+
Animation can be one of the following values:
 
 
Sent whenever an entity should change animation.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x0B
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
| Player ID
 
|-
 
| Animation
 
| Unsigned Byte
 
| Animation ID (see below)
 
|}
 
 
 
Animation can be one of the following values:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 577: Line 711:
 
  |-
 
  |-
 
  | 0
 
  | 0
  | Swing arm
+
  | Swing main arm
 
  |-
 
  |-
 
  | 1
 
  | 1
Line 586: Line 720:
 
  |-
 
  |-
 
  | 3
 
  | 3
  | Eat food
+
  | Swing offhand
 
  |-
 
  |-
 
  | 4
 
  | 4
Line 595: Line 729:
 
  |}
 
  |}
  
==== Spawn Player ====
+
==== Statistics ====
 
 
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
 
 
 
This packet must be sent after the [[#Player List Item|Player List Item]] ([[#Play|Play]], 0x38, clientbound) packet that adds the player data for the client to use when spawning a player. If the tab list entry for the UUID included in this packet is not present when this packet arrives, the entity will not be spawned. 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>.
+
Sent as a response to [[#Client_Status|Client Status 0x04]] (id 1).
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
  ! Bound To
+
  ! Bound To  
  ! 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
 +
| See below
 +
|-
 +
| Statistic ID
 
  | VarInt
 
  | VarInt
  | Player's EID
+
  | See below
 
  |-
 
  |-
  | Player UUID
+
  |colspan="2"| Value
  | UUID
+
|colspan="2"| VarInt
  |  
+
  | The amount to set it to
 +
  |}
 +
 
 +
Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>):
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! ID
 +
! Registry
 
  |-
 
  |-
  | X
+
  | <code>minecraft.mined</code>
  | Int
+
  | 0
  | Player X as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Blocks
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.crafted</code>
  | Int
+
  | 1
  | Player Y as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Items
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.used</code>
  | Int
+
  | 2
  | Player Z as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Items
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.broken</code>
  | Angle
+
  | 3
  |  
+
  | Items
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.picked_up</code>
  | Angle
+
  | 4
  |  
+
  | Items
 
  |-
 
  |-
  | Current Item
+
  | <code>minecraft.dropped</code>
  | Short
+
  | 5
  | The item the player is currently holding. Note that this should be 0 for “no item”, unlike -1 used in other packets.
+
  | Items
 
  |-
 
  |-
  | Metadata
+
  | <code>minecraft.killed</code>
  | [[Entities#Entity Metadata Format|Metadata]]
+
  | 6
  |  
+
  | Entities
  |}
+
  |-
 
+
| <code>minecraft.killed_by</code>
{{Warning|A negative Current Item crashes clients}}
+
| 7
 
+
  | Entities
{{Warning|The client will crash if no Metadata is sent}}
 
 
 
==== Collect Item ====
 
 
 
Sent by the server when someone picks up an item lying on the ground — its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each [[#Player Position|Player Position]] (and [[#Player Position And Look|Player Position And Look]]) packet sent by the client.
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="2"| 0x0D
+
  | <code>minecraft.custom</code>
|rowspan="2"| Play
+
  | 8
|rowspan="2"| Client
+
  | Custom
| Collected Entity ID
 
| VarInt
 
|
 
|-
 
| Collector Entity ID
 
  | VarInt
 
  |  
 
 
  |}
 
  |}
  
==== Spawn Object ====
+
Blocks, Items, and Entities use block (not block state), item, and entity ids.
  
Sent by the server when an Object/Vehicle is created.
+
Custom has the following (unit only matters for clients):
  
 
{| class="wikitable"
 
{| class="wikitable"
  ! Packet ID
+
  ! Name
! State
+
  ! ID
! Bound To
+
  ! Unit
! Field Name
 
  ! Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="11"| 0x0E
+
  | <code>minecraft.leave_game</code>
|rowspan="11"| Play
+
  | 0
|rowspan="11"| Client
+
  | None
| Entity ID
 
  | VarInt
 
  | EID of the object
 
 
  |-
 
  |-
  | Type
+
  | <code>minecraft.play_one_minute</code>
  | Byte
+
  | 1
  | The type of object (See [[Entities#Objects|Objects]])
+
  | Time
 
  |-
 
  |-
  | X
+
  | <code>minecraft.time_since_death</code>
  | Int
+
  | 2
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
| Time
 +
  |-
 +
| <code>minecraft.sneak_Time</code>
 +
| 3
 +
| Time
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.walk_one_cm</code>
  | Int
+
  | 4
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.crouch_one_cm</code>
  | Int
+
  | 5
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.sprint_one_cm</code>
  | Angle
+
  | 6
  |  
+
  | Distance
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.swim_one_cm</code>
  | Angle
+
  | 7
  |  
+
  | Distance
 
  |-
 
  |-
  | Data
+
  | <code>minecraft.fall_one_cm</code>
  | Int
+
  | 8
  | [[Object Data]]
+
  | Distance
 
  |-
 
  |-
  | Velocity X
+
  | <code>minecraft.climb_one_cm</code>
  | Short
+
  | 9
  | Same units as [[#Entity Velocity|Entity Velocity]] (If Data > 0)
+
  | Distance
 
  |-
 
  |-
  | Velocity Y
+
  | <code>minecraft.fly_one_cm</code>
  | Short
+
  | 10
  | Same units as [[#Entity Velocity|Entity Velocity]] (If Data > 0)
+
  | Distance
 
  |-
 
  |-
  | Velocity Z
+
  | <code>minecraft.dive_one_cm</code>
  | Short
+
  | 11
  | Same units as [[#Entity Velocity|Entity Velocity]] (If Data > 0)
+
  | Distance
|}
 
 
 
==== Spawn Mob ====
 
 
 
Sent by the server when a Mob Entity is Spawned
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="12"| 0x0F
+
  | <code>minecraft.minecart_one_cm</code>
  |rowspan="12"| Play
+
  | 12
  |rowspan="12"| Client
+
| Distance
  | Entity ID
+
  |-
  | VarInt
+
  | <code>minecraft.boat_one_cm</code>
  |  
+
  | 13
 +
  | Distance
 
  |-
 
  |-
  | Type
+
  | <code>minecraft.pig_one_cm</code>
  | Unsigned Byte
+
  | 14
  | The type of mob. See [[Entities#Mobs|Mobs]]
+
  | Distance
 
  |-
 
  |-
  | X
+
  | <code>minecraft.horse_one_cm</code>
  | Int
+
  | 15
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.aviate_one_cm</code>
  | Int
+
  | 16
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Distance
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.jump</code>
  | Int
+
  | 17
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Yaw
+
  | <code>minecraft.drop</code>
  | Angle
+
  | 18
  |  
+
  | None
 
  |-
 
  |-
  | Pitch
+
  | <code>minecraft.damage_dealt</code>
  | Angle
+
  | 19
  |  
+
  | Damage
 
  |-
 
  |-
  | Head Pitch
+
  | <code>minecraft.damage_taken</code>
  | Angle
+
  | 20
  |  
+
  | Damage
 
  |-
 
  |-
  | Velocity X
+
  | <code>minecraft.deaths</code>
  | Short
+
  | 21
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | None
 
  |-
 
  |-
  | Velocity Y
+
  | <code>minecraft.mob_kills</code>
  | Short
+
  | 22
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | None
 
  |-
 
  |-
  | Velocity Z
+
  | <code>minecraft.animals_bred</code>
  | Short
+
  | 23
  | Same units as [[#Entity Velocity|Entity Velocity]]
+
  | None
 
  |-
 
  |-
  | Metadata
+
  | <code>minecraft.player_kills</code>
  | [[Entities#Entity Metadata Format|Metadata]]
+
  | 24
  |  
+
| None
  |}
+
  |-
 
+
  | <code>minecraft.fish_caught</code>
==== Spawn Painting ====
+
  | 25
 
+
  | None
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.talked_to_villager</code>
|rowspan="4"| Play
+
  | 26
|rowspan="4"| Client
+
  | None
| Entity ID
 
  | VarInt
 
  |  
 
 
  |-
 
  |-
  | Title
+
  | <code>minecraft.traded_with_villager</code>
  | String
+
  | 27
  | Name of the painting. Max length 13
+
  | None
 
  |-
 
  |-
  | Location
+
  | <code>minecraft.eat_cake_slice</code>
  | Position
+
  | 28
  | Center coordinates
+
  | None
 
  |-
 
  |-
  | Direction
+
  | <code>minecraft.fill_cauldron</code>
  | Unsigned Byte
+
  | 29
  | 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.use_cauldron</code>
  |rowspan="5"| Play
+
| 30
  |rowspan="5"| Client
+
| None
  | Entity ID
+
|-
  | VarInt
+
| <code>minecraft.clean_armor</code>
  | Entity's ID
+
| 31
 +
| None
 +
|-
 +
| <code>minecraft.clean_banner</code>
 +
| 32
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_brewingstand</code>
 +
| 33
 +
| None
 +
|-
 +
| <code>minecraft.interact_with_beacon</code>
 +
| 34
 +
| None
 +
|-
 +
| <code>minecraft.inspect_dropper</code>
 +
| 35
 +
| None
 +
|-
 +
| <code>minecraft.inspect_hopper</code>
 +
| 36
 +
| None
 +
|-
 +
| <code>minecraft.inspect_dispenser</code>
 +
| 37
 +
| None
 +
|-
 +
| <code>minecraft.play_noteblock</code>
 +
| 38
 +
| None
 +
|-
 +
| <code>minecraft.tune_noteblock</code>
 +
| 39
 +
| None
 +
|-
 +
| <code>minecraft.pot_flower</code>
 +
| 40
 +
| None
 +
|-
 +
| <code>minecraft.trigger_trapped_chest</code>
 +
| 41
 +
| None
 +
|-
 +
| <code>minecraft.open_enderchest</code>
 +
| 42
 +
| None
 +
  |-
 +
| <code>minecraft.enchant_item</code>
 +
  | 43
 +
| None
 +
|-
 +
| <code>minecraft.play_record</code>
 +
| 44
 +
| None
 +
|-
 +
  | <code>minecraft.interact_with_furnace</code>
 +
  | 45
 +
  | None
 
  |-
 
  |-
  | X
+
  | <code>minecraft.interact_with_crafting_table</code>
  | Int
+
  | 46
  | X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Y
+
  | <code>minecraft.open_chest</code>
  | Int
+
  | 47
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Z
+
  | <code>minecraft.sleep_in_bed</code>
  | Int
+
  | 48
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | None
 
  |-
 
  |-
  | Count
+
  | <code>minecraft.open_shulker_box</code>
  | Short
+
  | 49
  | The amount of experience this orb will reward once collected
+
  | None
 
  |}
 
  |}
  
==== Entity Velocity ====
+
Units:
  
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).
+
* 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
  
{| class="wikitable"
+
==== Block Break Animation ====
  ! Packet ID
+
 
 +
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 +
 
 +
Block break animations can still be applied on air; the animation will remain visible although there is no block being broken.  However, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency.  (An effect similar to this can be seen in normal gameplay when breaking ice blocks)
 +
 
 +
If you need to display several break animations at the same time you have to give each of them a unique Entity ID. The entity ID does not need to correspond to an actual entity on the client. It is valid to use a randomly generated number.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
Line 896: Line 1,040:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="4"| 0x12
+
  |rowspan="3"| 0x08
  |rowspan="4"| Play
+
  |rowspan="3"| Play
  |rowspan="4"| Client
+
  |rowspan="3"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  |  
+
  | Entity ID of the entity breaking the block
 
  |-
 
  |-
  | Velocity X
+
  | Location
  | Short
+
  | Position
  | Velocity on the X axis
+
  | Block Position
 
  |-
 
  |-
  | Velocity Y
+
  | Destroy Stage
  | Short
+
  | Byte
  | Velocity on the Y axis
+
  | 0–9 to set it, any other value to remove it
|-
 
| Velocity Z
 
| Short
 
| Velocity on the Z axis
 
 
  |}
 
  |}
  
==== Destroy Entities ====
+
==== Update Block Entity ====
  
Sent by the server when a list of entities is to be destroyed on the client.
+
Sets the block entity associated with the block at the given location.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 928: Line 1,068:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x13
+
  |rowspan="3"| 0x09
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Count
+
  | Location
  | VarInt
+
  | Position
  | Number of elements in the following array
+
  |  
 
  |-
 
  |-
  | Entity IDs
+
  | Action
  | Array of VarInt
+
  | Unsigned Byte
  | The list of entities of destroy
+
  | The type of update to perform, see below
 +
|-
 +
| NBT Data
 +
| [[NBT|NBT Tag]]
 +
| Data to set.  May be a TAG_END (0), in which case the block entity at the given location is removed (though this is not required since the client will remove the block entity automatically on chunk unload or block removal)
 
  |}
 
  |}
  
==== Entity ====
+
''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.
  
This packet may be used to initialize an entity.
+
See [[Block Actions]] for a list of values.
  
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.
+
{{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 954: Line 1,116:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x14
+
  |rowspan="4"| 0x0A
  |rowspan="1"| Play
+
  |rowspan="4"| Play
  |rowspan="1"| Client
+
  |rowspan="4"| Client
  | Entity ID
+
  | Location
 +
| Position
 +
| Block coordinates
 +
|-
 +
| Action ID (Byte 1)
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]]
 +
|-
 +
| Action Param (Byte 2)
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]]
 +
|-
 +
| Block Type
 
  | VarInt
 
  | VarInt
  |  
+
  | The block type ID for the block.  This must match the block at the given coordinates.
 
  |}
 
  |}
  
==== Entity Relative Move ====
+
==== Block Change ====
  
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.
+
Fired whenever a block is changed within the render distance.
  
This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.
+
{{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 976: Line 1,150:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x15
+
  |rowspan="2"| 0x0B
  |rowspan="5"| Play
+
  |rowspan="2"| Play
  |rowspan="5"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Location
 +
| Position
 +
| Block Coordinates
 +
|-
 +
| Block ID
 
  | VarInt
 
  | VarInt
  |  
+
  | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
|-
 
| Delta X
 
| Byte
 
| Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
|-
 
| Delta Y
 
| Byte
 
| Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
|-
 
| Delta Z
 
| Byte
 
| Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
|-
 
| On Ground
 
| Boolean
 
|  
 
 
  |}
 
  |}
  
==== Entity Look ====
+
==== Boss Bar ====  
 
 
This packet is sent by the server when an entity rotates.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,008: Line 1,168:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="2"| Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x16
+
  |rowspan="14"| 0x0C
  |rowspan="5"| Play
+
  |rowspan="14"| Play
  |rowspan="5"| Client
+
  |rowspan="14"| Client
  | Entity ID
+
  |colspan="2"| UUID
  | VarInt
+
  | UUID
  |  
+
  | Unique ID for this bar
 
  |-
 
  |-
  | Yaw
+
  |colspan="2"| Action
  | Angle
+
  | VarInt Enum
  | New angle, not a delta
+
  | Determines the layout of the remaining packet
 
  |-
 
  |-
  | Pitch
+
  ! Action
  | Angle
+
  ! Field Name
  | New angle, not a delta
+
  !
 +
!
 
  |-
 
  |-
  | On Ground
+
  |rowspan="5"| 0: add
  | Boolean
+
| Title
 +
  | [[Chat]]
 
  |  
 
  |  
|}
 
 
==== Entity Look And Relative Move ====
 
 
This packet is sent by the server when an entity rotates and moves. Since a byte range is limited from -128 to 127, and movement is offset of fixed-point numbers, this packet allows at most four blocks movement in any direction. (-128/32 == -4)
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="7"| 0x17
+
  | 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
 
  |  
 
 
  |-
 
  |-
  | Delta X
+
  | Color
  | Byte
+
  | VarInt Enum
  | Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Color ID (see below)
 
  |-
 
  |-
  | Delta Y
+
  | Division
  | Byte
+
  | VarInt Enum
  | Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
+
  | Type of division (see below)
 
  |-
 
  |-
  | Delta Z
+
  | Flags
  | Byte
+
  | Unsigned Byte
  | Change in 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]]
 
  |  
 
  |  
  |}
+
|-
 +
|rowspan="2"| 4: update style
 +
| Color
 +
| VarInt Enum
 +
| Color ID (see below)
 +
|-
 +
| Dividers
 +
| VarInt Enum
 +
| as above
 +
|-
 +
| 5: update flags
 +
| Flags
 +
| Unsigned Byte
 +
| as above
 +
|-
 +
  |}
  
==== Entity Teleport ====
+
{| class="wikitable"
 +
! ID
 +
! Color
 +
|-
 +
| 0
 +
| Pink
 +
|-
 +
| 1
 +
| Blue
 +
|-
 +
| 2
 +
| Red
 +
|-
 +
| 3
 +
| Green
 +
|-
 +
| 4
 +
| Yellow
 +
|-
 +
| 5
 +
| Purple
 +
|-
 +
| 6
 +
| White
 +
|}
 +
 
 +
{| class="wikitable"
 +
! ID
 +
! Type of division
 +
|-
 +
| 0
 +
| No division
 +
|-
 +
| 1
 +
| 6 notches
 +
|-
 +
| 2
 +
| 10 notches
 +
|-
 +
| 3
 +
| 12 notches
 +
|-
 +
| 4
 +
| 20 notches
 +
|}
  
This packet is sent by the server when an entity moves more than 4 blocks.
+
==== Server Difficulty ====
 +
 
 +
Changes the difficulty setting in the client's option menu
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,088: Line 1,298:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="7"| 0x18
+
  |rowspan="2"| 0x0D
  |rowspan="7"| Play
+
  |rowspan="2"| Play
  |rowspan="7"| Client
+
  |rowspan="2"| Client
  | Entity ID
+
  | Difficulty
  | VarInt
+
  | Unsigned Byte
  |  
+
  | 0: peaceful, 1: easy, 2: normal, 3: hard
|-
 
| X
 
| Int
 
| X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
 
  |-
 
  |-
  | Y
+
  | Difficulty locked?
| Int
 
| Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
|-
 
| Z
 
| Int
 
| Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
|-
 
| Yaw
 
| Angle
 
| New angle, not a delta
 
|-
 
| Pitch
 
| Angle
 
| New angle, not a delta
 
|-
 
| On Ground
 
 
  | Boolean
 
  | Boolean
  |  
+
  |
 
  |}
 
  |}
  
==== Entity Head Look ====
+
==== 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.
  
Changes the direction an entity's head is facing.
+
{{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,132: Line 1,324:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x19
+
  |rowspan="2"| 0x0E
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Entity ID
+
  | JSON Data
  | VarInt
+
  | [[Chat]]
  |  
+
  | Limited to 32767 bytes
 
  |-
 
  |-
  | Head Yaw
+
  | Position
  | Angle
+
  | Byte
  | New angle, not a delta
+
  | 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar).
 
  |}
 
  |}
  
==== Entity Status ====
+
==== 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,150: 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"| 0x1A
+
  |rowspan="6"| 0x0F
  |rowspan="2"| Play
+
  |rowspan="6"| Play
  |rowspan="2"| Client
+
  |rowspan="6"| Client
  | Entity ID
+
|colspan="2"| Chunk X
  | Int
+
|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
 
  |-
 
  |-
  | Entity Status
+
  | Block ID
  | Byte
+
  | VarInt
  | See below
+
  | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information.
 
  |}
 
  |}
 +
 +
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"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 
  |-
 
  |-
  ! Entity Status
+
  |rowspan="8"| 0x10
  ! Meaning
+
  |rowspan="8"| Play
 +
|rowspan="8"| Client
 
  |-
 
  |-
  | 1
+
  |colspan="2"| ID
  | Sent when resetting a mob spawn minecart's timer - appears to be unused by the client
+
|colspan="2"| VarInt
 +
  | Transaction ID
 
  |-
 
  |-
  | 2
+
  |colspan="2"| Start
  | Living Entity hurt
+
|colspan="2"| VarInt
 +
  | Start of the text to replace
 
  |-
 
  |-
  | 3
+
  |colspan="2"| Length
  | Living Entity dead
+
|colspan="2"| VarInt
 +
  | Length of the text to replace
 
  |-
 
  |-
  | 4
+
  |colspan="2"| Count
  | Iron Golem throwing up arms
+
|colspan="2"| VarInt
 +
  | Number of elements in the following array
 
  |-
 
  |-
  | 6
+
  |rowspan="3"| Matches
  | Wolf/Ocelot/Horse taming — Spawn “heart” particles
+
| Match
 +
|rowspan="3"| Array
 +
| String (32767)
 +
  | One eligible value to insert, note that each command is sent separately instead of in a single string, hence the need for Count.  Note that for instance this doesn't include a leading <code>/</code> on commands.
 
  |-
 
  |-
  | 7
+
  | Has tooltip
  | Wolf/Ocelot/Horse tamed — Spawn “smoke” particles
+
  | Boolean
 +
| True if the following is present
 
  |-
 
  |-
  | 8
+
  | Tooltip
  | Wolf shaking water — Trigger the shaking animation
+
  | Optional [[Chat]]
 +
| Tooltip to display; only present if previous boolean is true
 +
|}
 +
 
 +
==== Declare Commands ====
 +
 
 +
Lists all of the commands on the server, and how they are parsed.
 +
 
 +
This is a directed graph, with one root node.  Each redirect or child node must refer only to nodes that have already been declared.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  | 9
+
  |rowspan="3"| 0x11
  | (of self) Eating accepted by server
+
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Count
 +
| VarInt
 +
  | Number of elements in the following array
 
  |-
 
  |-
  | 10
+
  | Nodes
  | Sheep eating grass
+
  | Array of [[Command Data|Node]]
 +
| An array of nodes
 
  |-
 
  |-
  | 10
+
  | Root index
  | Play TNT ignite sound
+
  | VarInt
  |-
+
  | Index of the <code>root</code> node in the previous array
| 11
+
  |}
| Iron Golem handing over a rose
+
 
|-
+
For more information on this packet, see the [[Command Data]] article.
| 12
+
 
| Villager mating — Spawn “heart” particles
+
==== Confirm Transaction (clientbound) ====
|-
+
 
| 13
+
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.
| 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 ====
 
 
 
This packet is sent when a player has been attached to an entity (e.g. Minecart).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,253: Line 1,479:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1B
+
  |rowspan="3"| 0x12
 
  |rowspan="3"| Play
 
  |rowspan="3"| Play
 
  |rowspan="3"| Client
 
  |rowspan="3"| Client
  | Entity ID
+
  | Window ID
  | Int
+
  | Byte
  | Attached entity's EID. Set to -1 to detach.
+
  | The ID of the window that the action occurred in
 
  |-
 
  |-
  | Vehicle ID
+
  | Action Number
  | Int
+
  | Short
  | Vechicle's Entity ID
+
  | 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.
 
  |-
 
  |-
  | Leash
+
  | Accepted
 
  | Boolean
 
  | Boolean
  | If true leashes the entity to the vehicle
+
  | Whether the action was accepted
 
  |}
 
  |}
  
==== Entity Metadata ====
+
==== 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,279: Line 1,507:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1C
+
  | 0x13
  |rowspan="2"| Play
+
  | Play
  |rowspan="2"| Client
+
  | Client
  | Entity ID
+
  | Window ID
  | VarInt
+
  | Unsigned Byte
|
+
  | This is the ID of the window that was closed. 0 for inventory.
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Metadata]]
 
  |  
 
 
  |}
 
  |}
  
==== Entity Effect ====
+
==== Window Items ====
 +
[[File:Inventory-slots.png|thumb|The inventory slots]]
 +
 
 +
Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,301: Line 1,528:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x1D
+
  |rowspan="3"| 0x14
  |rowspan="5"| Play
+
  |rowspan="3"| Play
  |rowspan="5"| Client
+
  |rowspan="3"| Client
  | Entity ID
+
  | Window ID
  | VarInt
+
  | Unsigned Byte
  |  
+
  | The ID of window which items are being sent for. 0 for player inventory.
 
  |-
 
  |-
  | Effect ID
+
  | Count
  | Byte
+
  | Short
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | Number of elements in the following array
 
  |-
 
  |-
  | Amplifier
+
  | Slot Data
  | Byte
+
  | Array of [[Slot Data|Slot]]
| Notchian client displays effect level as Amplifier + 1
 
|-
 
| Duration
 
| VarInt
 
| Seconds
 
|-
 
| Hide Particles
 
| Boolean
 
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Remove Entity Effect ====
+
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 +
 
 +
==== Window Property ====
 +
 
 +
This packet is used to inform the client that part of a GUI window should be updated.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 1,335: Line 1,558:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x1E
+
  |rowspan="3"| 0x15
  |rowspan="2"| Play
+
  |rowspan="3"| Play
  |rowspan="2"| Client
+
  |rowspan="3"| Client
  | Entity ID
+
  | Window ID
  | VarInt
+
  | Unsigned Byte
 
  |  
 
  |  
 
  |-
 
  |-
  | Effect ID
+
  | Property
  | Byte
+
  | Short
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | The property to be updated, see below
 +
|-
 +
| Value
 +
| Short
 +
| The new value for the property, see below
 
  |}
 
  |}
  
==== Set Experience ====
+
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.
 
 
Sent by the server when the client should change experience levels.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x1F
+
! Window type
  |rowspan="3"| Play
+
! Property
  |rowspan="3"| Client
+
! Value
  | Experience bar
+
  |-
  | Float
+
  |rowspan="4"| Furnace
  | Between 0 and 1
+
  | 0: Fire icon (fuel left)
 +
| counting from fuel burn time down to 0 (in-game ticks)
 +
  |-
 +
  | 1: Maximum fuel burn time
 +
  | fuel burn time or 0 (in-game ticks)
 
  |-
 
  |-
  | Level
+
  | 2: Progress arrow
| VarInt
+
  | counting from 0 to maximum progress (in-game ticks)
  |  
 
 
  |-
 
  |-
  | Total Experience
+
  | 3: Maximum progress
  | VarInt
+
  | always 200 on the notchian server
| See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
+
  |-
  |}
+
|rowspan="10"| Enchantment Table
 
+
  | 0: Level requirement for top enchantment slot
==== Entity Properties ====
+
  |rowspan="3"| The enchantment's xp level requirement
 
+
  |-
{| class="wikitable"
+
  | 1: Level requirement for middle enchantment slot
  ! Packet ID
 
  ! State
 
! Bound To
 
!colspan="2"| Field Name
 
  !colspan="2"| Field Type
 
  ! Notes
 
 
  |-
 
  |-
  |rowspan="6"| 0x20
+
  | 2: Level requirement for bottom enchantment slot
|rowspan="6"| Play
 
|rowspan="6"| Client
 
|colspan="2"| Entity ID
 
|colspan="2"| VarInt
 
|
 
 
  |-
 
  |-
  |colspan="2"| Number Of Properties
+
  | 3: The enchantment seed
  |colspan="2"| Int
+
  | 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>).
  | Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="4"| Property
+
  | 4: Enchantment ID shown on mouse hover over top enchantment slot
| Key
+
  |rowspan="3"| The enchantment id (set to -1 to hide it), see below for values
  |rowspan="4"| Array
 
| String
 
| See below
 
 
  |-
 
  |-
  | Value
+
  | 5: Enchantment ID shown on mouse hover over middle enchantment slot
| Double
 
| See below
 
 
  |-
 
  |-
  | Number Of Modifiers
+
  | 6: Enchantment ID shown on mouse hover over bottom enchantment slot
| VarInt
 
| Number of elements in the following array
 
 
  |-
 
  |-
  | Modifiers
+
  | 7: Enchantment level shown on mouse hover over the top slot
  | Array of Modifier Data
+
  |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant
| See {{Minecraft Wiki|Attribute#Modifiers}}
 
|}
 
 
 
Known Key values:
 
 
 
{| class="wikitable"
 
 
  |-
 
  |-
  ! Key
+
  | 8: Enchantment level shown on mouse hover over the middle slot
! Default
 
! Min
 
! Max
 
! Label
 
 
  |-
 
  |-
  | generic.maxHealth
+
  | 9: Enchantment level shown on mouse hover over the bottom slot
| 20.0
 
| 0.0
 
| Double.MaxValue
 
| Max Health
 
 
  |-
 
  |-
  | generic.followRange
+
  |rowspan="3"| Beacon
| 32.0
+
  | 0: Power level
  | 0.0
+
  | 0-4, controls what effect buttons are enabled
  | 2048.0
 
| Follow Range
 
 
  |-
 
  |-
  | generic.knockbackResistance
+
  | 1: First potion effect
  | 0.0
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect
| 0.0
 
| 1.0
 
| Knockback Resistance
 
 
  |-
 
  |-
  | generic.movementSpeed
+
  | 2: Second potion effect
  | 0.699999988079071
+
  | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect
| 0.0
 
| Double.MaxValue
 
| Movement Speed
 
 
  |-
 
  |-
  | generic.attackDamage
+
  | Anvil
  | 2.0
+
  | 0: Repair cost
  | 0.0
+
  | The repair's cost in xp levels
| Double.MaxValue
 
|
 
 
  |-
 
  |-
  | 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,588: 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,619: 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,657: 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,683: 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,731: 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,771: 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,785: 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)
+
  | Begin raining
 
  |  
 
  |  
 
  |-
 
  |-
  | 1004
+
  | 2
  | <code>random.fizz</code>
+
  | End raining
 
  |  
 
  |  
 
  |-
 
  |-
  | 1005
+
  | 3
  | Play a music disc.
+
  | Change gamemode
  | {{Minecraft Wiki|Music Discs|Record ID}}
+
  | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 
  |-
 
  |-
  | 1006
+
  | 4
  | ''not assigned''
+
  | Exit end
  |  
+
  | 0: Immediately send Client Status of respawn without showing end credits; 1: Show end credits and respawn at the end (or when esc is pressed).  1 is sent if the player has not yet received the "The end?" advancement, while if they do have it 0 is used.
 
  |-
 
  |-
  | 1007
+
  | 5
  | <code>mob.ghast.charge</code>
+
  | Demo message
  |  
+
  | 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control, 104: Tell that the demo is over and print a message about how to take a screenshot
 +
|-
 +
| 6
 +
| Arrow hitting player
 +
| Appears to be played when an arrow strikes another player in Multiplayer
 
  |-
 
  |-
  | 1008
+
  | 7
  | <code>mob.ghast.fireball</code>
+
  | Fade value
  |  
+
  | The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
 
  |-
 
  |-
  | 1009
+
  | 8
  | <code>mob.ghast.fireball</code>, but with a lower volume
+
  | Fade time
  |  
+
  | Time in ticks for the sky to fade
 
  |-
 
  |-
  | 1010
+
  | 9
| <code>mob.zombie.wood</code>
+
  | Play pufferfish sting sound
  |  
 
 
  |-
 
  |-
  | 1011
+
  | 10
  | <code>mob.zombie.metal</code>
+
  | Play elder guardian mob appearance (effect and sound)
 
  |  
 
  |  
 +
|}
 +
 +
==== 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,211: 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"
 
! Reason
 
! 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)
 
| Unknown
 
 
  |}
 
  |}
  
==== 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,279: 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
 +
| Length of the following array in bytes (always 2048)
 
  |-
 
  |-
  | Y
+
  | Block Light array
  | Int
+
  | Array of 2048 bytes
  | Thunderbolt Y, 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.
|-
 
  | Z
 
| Int
 
| Thunderbolt Z, a [[Data Types#Fixed-point numbers|fixed-point number]]
 
 
  |}
 
  |}
  
==== 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,319: 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 [[Inventory]] for a list.
+
  | 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]] 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,355: 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
To set the curser (the item currently dragged with the mouse), use -1 as Window ID and as Slot
+
|colspan="2"| Unsigned Byte
 +
| Number of columns updated
 +
|-
 +
|colspan="2"| Rows
 +
|colspan="2"| Optional Byte
 +
| Only if Columns is more than 0; number of rows updated
 +
|-
 +
|colspan="2"| X
 +
|colspan="2"| Optional Byte
 +
| Only if Columns is more than 0; x offset of the westernmost column
 +
|-
 +
|colspan="2"| Z
 +
|colspan="2"| Optional Byte
 +
| Only if Columns is more than 0; z offset of the northernmost row
 +
|-
 +
|colspan="2"| Length
 +
|colspan="2"| Optional VarInt
 +
| Only if Columns is more than 0; length of the following array
 +
|-
 +
|colspan="2"| Data
 +
|colspan="2"| Optional Array of Unsigned Byte
 +
| Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 +
|}
  
==== Window Items ====
+
For icons, a direction of 0 is a vertical icon and increments by 22.5&deg; (360/16).
 
 
[[File:Inventory-slots.png|thumb|The inventory slots]]
 
  
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.
+
Types are based off of rows and columns in <code>map_icons.png</code>:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x30
+
  ! Icon type
|rowspan="3"| Play
+
  ! Result
  |rowspan="3"| Client
+
  |-
  | Window ID
+
  | 0
  | Unsigned Byte
+
  | White arrow (players)
  | The ID of window which items are being sent for. 0 for player inventory.
 
 
  |-
 
  |-
  | Count
+
  | 1
  | Short
+
  | Green arrow (item frames)
| Number of elements in the following array
 
 
  |-
 
  |-
  | Slot Data
+
  | 2
  | Array of [[Slot Data|Slot]]
+
  | Red arrow
|
 
|}
 
 
 
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 
 
 
==== Window Property ====
 
 
 
This packet is used to inform the client that part of a GUI window should be updated.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="3"| 0x31
+
  | 3
|rowspan="3"| Play
+
  | Blue arrow
|rowspan="3"| Client
 
| Window ID
 
| Unsigned Byte
 
  |  
 
 
  |-
 
  |-
  | Property
+
  | 4
  | Short
+
  | White cross
| The property to be updated, see below
 
 
  |-
 
  |-
  | Value
+
  | 5
  | Short
+
  | Red pointer
| The new value for the property, see below
 
|}
 
 
 
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
+
  | 6
  ! Property
+
  | White circle (off-map players)
! Value
 
 
  |-
 
  |-
  |rowspan="2"| Furnace
+
  | 7
  | 0: Progress arrow
+
  | Small white circle (far-off-map players)
| 0–200 (presumably in in-game ticks)
 
 
  |-
 
  |-
  | 1: Fire icon (fuel)
+
  | 8
  | 0–200 (presumably in in-game ticks)
+
  | Mansion
 
  |-
 
  |-
  |rowspan="7"| Enchantment Table
+
  | 9
  | 0: Level requirement for top enchantment slot
+
| Temple
  |rowspan="3"| The enchantment's xp level requirement
+
  |-
 +
  | 10
 +
| White Banner
 +
|-
 +
| 11
 +
| Orange Banner
 +
|-
 +
| 12
 +
| Magenta Banner
 +
|-
 +
| 13
 +
| Light Blue Banner
 +
|-
 +
| 14
 +
| Yellow Banner
 +
|-
 +
| 15
 +
| Lime Banner
 
  |-
 
  |-
  | 1: Level requirement for middle enchantment slot
+
  | 16
 +
| Pink Banner
 
  |-
 
  |-
  | 2: Level requirement for bottom enchantment slot
+
  | 17
 +
| Gray Banner
 
  |-
 
  |-
  | 3: The seed for generating the enchantments view for the client
+
  | 18
  | Unknown
+
  | Light Gray Banner
 
  |-
 
  |-
  | 4: tooltip shown on mouse hover over top enchantment slot
+
  | 19
  |rowspan="3"| Unknown (set to -1 to hide it)
+
  | Cyan Banner
 
  |-
 
  |-
  | 5: tooltip shown on mouse hover over middle enchantment slot
+
  | 20
 +
| Purple Banner
 
  |-
 
  |-
  | 6: tooltip shown on mouse hover over bottom enchantment slot
+
  | 21
 +
| Blue Banner
 
  |-
 
  |-
  |rowspan="3"| Beacon
+
  | 22
| 0: Power level
+
  | Brown Banner
  | Unknown
 
 
  |-
 
  |-
  | 1: First potion effect
+
  | 23
  | Unknown
+
  | 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).
+
The list of trades a villager NPC is offering.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,517: 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.
 +
|-
 +
| colspan="2" | Size
 +
| colspan="2" | Byte
 +
| The number of trades in the following array
 +
|-
 +
| rowspan="11" | Trades
 +
| Input item 1
 +
| rowspan="11" | Array
 +
| [[Slot]]
 +
| The first item the villager is buying
 +
|-
 +
| Output item
 +
| [[Slot]]
 +
| The item the villager is selling
 +
|-
 +
| Has second item
 +
| Boolean
 +
| Whether there is a second item
 
  |-
 
  |-
  | Action Number
+
  | Input item 2
  | Short
+
  | Optional [[Slot]]
  | Every action that is to be accepted has a unique number. This field corresponds to that number.
+
  | The second item the villager is buying; only present if they have a second item.
 
  |-
 
  |-
  | Accepted
+
  | 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,549: 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
+
  |  
 
  |}
 
  |}
  
==== Map ====
+
==== 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,581: 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
+
  | Delta X
|colspan="2"| Byte
+
  | Short
  |  
+
  | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
  |-  
 
|colspan="2"| Icon Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
 
  |-
 
  |-
  |rowspan="3"| Icon
+
  | Delta Y
| Direction And Type
+
  | Short
|rowspan="3"| Array
+
  | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
  | Byte
 
  | 0xF0 = Direction, 0x0F = Type
 
 
  |-
 
  |-
  | X
+
  | Delta Z
  | Byte
+
  | Short
  |  
+
  | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 
  |-
 
  |-
  | Z
+
  | Yaw
  | Byte
+
  | Angle
  |  
+
  | New angle, not a delta
|-
 
|colspan="2"| Columns
 
|colspan="2"| Byte
 
| Number of columns updated
 
 
  |-
 
  |-
  |colspan="2"| Rows
+
  | Pitch
  |colspan="2"| Optional Byte
+
  | Angle
  | Only if Columns is more than 0; number of rows updated
+
  | New angle, not a delta
 
  |-
 
  |-
  |colspan="2"| X
+
  | On Ground
|colspan="2"| Optional Byte
+
  | Boolean
| Only if Columns is more than 0; x offset of the westernmost column
+
  |  
|-
 
  |colspan="2"| Z
 
  |colspan="2"| Optional Byte
 
| Only if Columns is more than 0; z offset of the northernmost row
 
|-
 
|colspan="2"| Length
 
|colspan="2"| Optional VarInt
 
| Only if Columns is more than 0; length of the following array
 
|-
 
|colspan="2"| Data
 
|colspan="2"| Optional Array of Unsigned Byte
 
| Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
 
  |}
 
  |}
  
==== Update Block Entity ====
+
==== Entity 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,651: 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
 +
|-
 +
| Pitch
 +
| Angle
 +
| New angle, not a delta
 
  |-
 
  |-
  | NBT Data
+
  | On Ground
  | Optional [[NBT|NBT Tag]]
+
  | Boolean
  | If not present then it's a TAG_END (0)
+
  |  
 
  |}
 
  |}
  
''Action'' field:
+
==== Entity ====
  
* '''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
 
  
==== Open Sign Editor ====
+
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,688: 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]
+
| Z
 +
| Double
 +
  | Absolute position (Z coordinate)
 +
  |-
 +
| Yaw
 +
  | Float
 +
  | Absolute rotation on the vertical axis, in degrees
 
  |-
 
  |-
  | Value
+
  | Pitch
  | VarInt
+
  | Float
  | The amount to set it to
+
  | 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,732: 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"| ''no fields''
 
  |  
 
 
  |}
 
  |}
  
==== 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,838: 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
 +
|-
 +
! Event
 +
! Field Name
 +
!
 +
!
 +
|-
 +
| 0: enter combat
 +
| ''no fields''
 +
| ''no fields''
 +
|
 +
|-
 +
|rowspan="2"| 1: end combat
 +
| Duration
 +
| VarInt
 +
|
 +
|-
 +
| Entity ID
 +
| Int
 +
|
 +
|-
 +
  |rowspan="3"| 2: entity dead
 +
  | Player ID
 +
  | VarInt
 +
  |  
 
  |-
 
  |-
  | Flying Speed
+
  | Entity ID
  | Float
+
  | Int
 
  |  
 
  |  
 
  |-
 
  |-
  | Walking Speed
+
  | Message
  | Float
+
  | [[Chat]]
 
  |  
 
  |  
 
  |}
 
  |}
  
==== Tab-Complete ====
+
==== Player Info ====
  
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.
+
Sent by the server to update the user list (<tab> in the client).
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,866: Line 3,300:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  ! Field Name
+
  !colspan="4"| Field Name
  ! Field Type
+
  !colspan="3"| Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3A
+
  |rowspan="19"| 0x33
  |rowspan="2"| Play
+
  |rowspan="19"| Play
  |rowspan="2"| Client
+
  |rowspan="19"| Client
  | Count
+
  |colspan="4"| Action
  | VarInt
+
  |colspan="3"| VarInt
  | Number of elements in the following array
+
  | Determines the rest of the Player format after the UUID
 
  |-
 
  |-
  | Matches
+
  |colspan="4"| Number Of Players
  | Array of String
+
  |colspan="3"| VarInt
  | One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
  | Number of elements in the following array
|}
 
 
 
==== Scoreboard Objective ====
 
 
 
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x3B
+
  |rowspan="17"| Player
  |rowspan="4"| Play
+
  |colspan="3"| UUID
  |rowspan="4"| Client
+
  |rowspan="17"| Array
  | Objective Name
+
  |colspan="2"| UUID
| String
+
  |  
  | An unique name for the objective
 
 
  |-
 
  |-
  | Mode
+
  ! Action
  | Byte
+
!colspan="2"| Field Name
  | 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
+
  !colspan="2"|  
 +
  !
 
  |-
 
  |-
  | Objective Value
+
  |rowspan="10"| 0: add player
  | Optional String
+
  |colspan="2"| Name
  | Only if mode is 0 or 2. The text to be displayed for the score
+
|colspan="2"| String (16)
 +
  |  
 
  |-
 
  |-
  | Type
+
  |colspan="2"| Number Of Properties
| Optional String
+
  |colspan="2"| VarInt
  | Only if mode is 0 or 2. “integer” or “hearts”
+
  | Number of elements in the following array
  |}
+
|-
 
+
|rowspan="4"| Property
==== Update Score ====
+
  | Name
 
+
  |rowspan="4"| Array
This is sent to the client when it should update a scoreboard item.
+
  | String (32767)
 
+
  |
{| class="wikitable"
 
  ! Packet ID
 
  ! State
 
  ! Bound To
 
  ! Field Name
 
! Field Type
 
! Notes
 
 
  |-
 
  |-
  |rowspan="4"| 0x3C
+
  | Value
  |rowspan="4"| Play
+
| String (32767)
  |rowspan="4"| Client
+
  |  
  | Score Name
+
  |-
  | String
+
  | Is Signed
  | The name of the score to be updated or removed
+
  | Boolean
 +
  |  
 
  |-
 
  |-
  | Action
+
  | Signature
  | Byte
+
  | Optional String (32767)
  | 0 to create/update an item. 1 to remove an item.
+
  | Only if Is Signed is true
 
  |-
 
  |-
  | Objective Name
+
  |colspan="2"| Gamemode
  | String
+
  |colspan="2"| VarInt
  | The name of the objective the score belongs to
+
  |  
 
  |-
 
  |-
  | Value
+
  |colspan="2"| Ping
  | Optional VarInt
+
|colspan="2"| VarInt
  | The score to be displayed next to the entry. Only sent when Action does not equal 1.
+
| Measured in milliseconds
|}
+
|-
 
+
|colspan="2"| Has Display Name
==== Display Scoreboard ====
+
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
  |colspan="2"| Optional [[Chat]]
 +
| Only if Has Display Name is true
 +
|-
 +
| 1: update gamemode
 +
|colspan="2"| Gamemode
 +
|colspan="2"| VarInt
 +
  |  
 +
|-
 +
| 2: update latency
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
| Measured in milliseconds
 +
|-
 +
|rowspan="2"| 3: update display name
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
|colspan="2"| Optional [[Chat]]
 +
| Only send if Has Display Name is true
 +
|-
 +
| 4: remove player
 +
|colspan="2"| ''no fields''
 +
|colspan="2"| ''no fields''
 +
|
 +
|}
 +
 
 +
The Property field looks as in the response of [[Mojang API#UUID -> Profile + Skin/Cape]], except of course using the protocol format instead of JSON. That is, each player will usually have one property with Name “textures” and Value being a base64-encoded JSON string as documented at [[Mojang API#UUID -> Profile + Skin/Cape]]. An empty properties array is also acceptable, and will cause clients to display the player with one of the two default skins depending on UUID.
 +
 
 +
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 ====
  
This is sent to the client when it should display a scoreboard.
+
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,958: Line 3,416:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3D
+
  |rowspan="8"| 0x34
  |rowspan="2"| Play
+
  |rowspan="8"| Play
  |rowspan="2"| Client
+
  |rowspan="8"| Client
  | Position
+
  |-
  | Byte
+
  | Feet/eyes
  | The position of the scoreboard. 0: list, 1: sidebar, 2: below name.
+
  | VarInt enum
 +
| Values are feet=0, eyes=1.  If set to eyes, aims using the head position; otherwise aims using the feet position.
 +
|-
 +
| Target x
 +
| Double
 +
| x coordinate of the point to face towards
 
  |-
 
  |-
  | Score Name
+
  | Target y
  | String
+
  | Double
  | The unique name for the scoreboard to be displayed.
+
  | y coordinate of the point to face towards
 +
|-
 +
| Target z
 +
| Double
 +
| z coordinate of the point to face towards
 +
|-
 +
| Is entity
 +
| Boolean
 +
| If true, additional information about an entity is provided.
 +
|-
 +
| Entity ID
 +
| Optional VarInt
 +
| Only if is entity is true &mdash; the entity to face towards
 +
|-
 +
| Entity feet/eyes
 +
| Optional VarInt enum
 +
| Whether to look at the entity's eyes or feet.  Same values and meanings as before, just for the entity's head/feet.
 
  |}
 
  |}
  
==== Teams ====
+
If the entity given by entity ID cannot be found, this packet should be treated as if is entity was false.
 +
 
 +
==== Player Position And Look (clientbound) ====  
 +
 
 +
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
 +
 
 +
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
 +
 
 +
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”.
 +
 
 +
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
  
Creates and updates teams.
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 2,982: Line 3,471:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="10"| 0x3E
+
  |rowspan="7"| 0x35
  |rowspan="10"| Play
+
  |rowspan="7"| Play
  |rowspan="10"| Client
+
  |rowspan="7"| Client
  | Team Name
+
  | X
  | String
+
  | Double
  | A unique name for the team. (Shared with scoreboard).
+
  | Absolute or relative position, depending on Flags
 
  |-
 
  |-
  | Mode
+
  | Y
  | Byte
+
  | Double
  | If 0 then the team is created.
+
  | Absolute or relative position, depending on Flags
 
 
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
+
  | Z
  | Optional String
+
  | Double
  | Only if Mode = 0 or 2.
+
  | Absolute or relative position, depending on Flags
 
  |-
 
  |-
  | Team Prefix
+
  | Yaw
  | Optional String
+
  | Float
  | Only if Mode = 0 or 2. Displayed before the players' name that are part of this team
+
  | 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
 
  |-
 
  |-
  | Team Suffix
+
  | Teleport ID
  | Optional String
+
  | VarInt
  | Only if Mode = 0 or 2. Displayed after the players' name that are part of this team
+
  | Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
 +
|}
 +
 
 +
About the Flags field:
 +
 
 +
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Field
 +
! Bit
 
  |-
 
  |-
  | Friendly Fire
+
  | X
  | Optional Byte
+
  | 0x01
| Only if Mode = 0 or 2. 0 for off, 1 for on, 3 for seeing friendly invisibles
 
 
  |-
 
  |-
  | Name Tag Visibility
+
  | Y
  | Optional String
+
  | 0x02
| Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never
 
 
  |-
 
  |-
  | Color
+
  | Z
  | Optional Byte
+
  | 0x04
| Only if Mode = 0 or 2. Same as [[Chat]] colors
 
 
  |-
 
  |-
  | Player Count
+
  | Y_ROT
  | Optional VarInt
+
  | 0x08
| Only if Mode = 0 or 3 or 4. Number of players in the array
 
 
  |-
 
  |-
  | Players
+
  | X_ROT
  | Optional Array of String
+
  | 0x10
| 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
 
 
  |}
 
  |}
  
==== Plugin Message ====
+
==== Unlock Recipes ====
 
 
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>.
 
 
 
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 3,048: Line 3,538:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x3F
+
  |rowspan="10"| 0x36
  |rowspan="2"| Play
+
  |rowspan="10"| Play
  |rowspan="2"| Client
+
  |rowspan="10"| Client
| Channel
 
| String
 
| Name of the [[plugin channel]] used to send the data
 
 
  |-
 
  |-
  | Data
+
  | Action
  | Byte Array
+
  | VarInt
  | Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].
+
| 0: init, 1: add, 2: remove
 +
|-
 +
| Crafting Recipe Book Open
 +
| Boolean
 +
| If true, then the crafting recipe book will be open when the player opens its inventory.
 +
|-
 +
| Crafting Recipe Book Filter Active
 +
| Boolean
 +
  | If true, then the filtering option is active when the players opens its inventory.
 +
|-
 +
| Smelting Recipe Book Open
 +
| Boolean
 +
| If true, then the smelting recipe book will be open when the player opens its inventory.
 +
|-
 +
| Smelting Recipe Book Filter Active
 +
| Boolean
 +
| If true, then the filtering option is active when the players opens its inventory.
 +
|-
 +
| Array size 1
 +
| VarInt
 +
| Number of elements in the following array
 +
|-
 +
| Recipe IDs
 +
| Array of Identifier
 +
|
 +
|-
 +
| Array size 2
 +
| Optional VarInt
 +
| Number of elements in the following array, only present if mode is 0 (init)
 +
|-
 +
| Recipe IDs
 +
| Optional Array of Identifier, only present if mode is 0 (init)
 +
|
 
  |}
 
  |}
 +
Action:
 +
* 0 (init) = All the recipes in the list 2 will added to the recipe book. All the recipes in list 1 will be tagged as displayed, recipes that aren't tagged will be shown in the notification. 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.
  
==== Disconnect ====
+
==== Destroy Entities ====
  
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.
+
Sent by the server when a list of entities is to be destroyed on the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,072: Line 3,595:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  | 0x40
+
  |rowspan="2"| 0x37
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Reason
+
  | Count
  | [[Chat]]
+
  | VarInt
  | Displayed to the client when the connection terminates.
+
  | Number of elements in the following array
 +
|-
 +
| Entity IDs
 +
| Array of VarInt
 +
| The list of entities of destroy
 
  |}
 
  |}
  
==== Server Difficulty ====
+
==== Remove Entity Effect ====
 
 
Changes the difficulty setting in the client's option menu
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,092: Line 3,617:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x41
+
  |rowspan="2"| 0x38
  |rowspan="1"| Play
+
  |rowspan="2"| Play
  |rowspan="1"| Client
+
  |rowspan="2"| Client
  | Difficulty
+
  | Entity ID
  | Unsigned Byte
+
| VarInt
  | 0: peaceful, 1: easy, 2: normal, 3: hard
+
|
 +
|-
 +
| Effect ID
 +
  | Byte
 +
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
 
  |}
 
  |}
  
==== Combat Event ====
+
==== Resource Pack Send ====  
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,110: Line 3,639:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="6"| 0x42
+
  |rowspan="2"| 0x39
  |rowspan="6"| Play
+
  |rowspan="2"| Play
  |rowspan="6"| Client
+
  |rowspan="2"| Client
  | Event
+
  | URL
  | VarInt
+
  | String (32767)
  | 0: enter combat, 1: end combat, 2: entity dead
+
  | The URL to the resource pack.
 
  |-
 
  |-
  | Duration
+
  | Hash
  | Optional VarInt
+
  | String (40)
| Only for end combat
+
  | 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
  |-
 
| Player ID
 
| Optional VarInt
 
| Only for entity dead
 
|-
 
| Entity ID
 
| Optional Int
 
| Only for end combat and entity dead
 
|-
 
| Message
 
| String
 
| Only for entity dead
 
 
  |}
 
  |}
  
==== Camera ====
+
==== 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"
 
{| class="wikitable"
Line 3,144: Line 3,663:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x43
+
  |rowspan="3"| 0x3A
  |rowspan="1"| Play
+
  |rowspan="3"| Play
  |rowspan="1"| Client
+
  |rowspan="3"| Client
  | Camera ID
+
  | Dimension
  | VarInt
+
| Int Enum
  |  
+
| -1: The Nether, 0: The Overworld, 1: The End
  |}
+
|-
 +
| Gamemode
 +
| Unsigned Byte
 +
| 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
 +
|-
 +
  | Level Type
 +
  | String (16)
 +
| Same as [[#Join Game|Join Game]]
 +
  |}
 +
 
 +
{{Warning2|Avoid changing player's dimension to same dimension they were already in unless they are dead. If you change the dimension to one they are already in, weird bugs can occur, such as the player being unable to attack other players in new world (until they die and respawn).
 +
 
 +
If you must respawn a player in the same dimension without killing them, send two respawn packets, one to a different world and then another to the world you want. You do not need to complete the first respawn; it only matters that you send two packets.}}
 +
 
 +
==== Entity Head Look ====
 +
 
 +
Changes the direction an entity's head is facing.
  
==== World Border ====
+
While sending the Entity Look packet changes the vertical rotation of the head, sending this packet appears to be necessary to rotate the head horizontally.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,158: Line 3,693:
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="18"| 0x44
+
  |rowspan="2"| 0x3B
  |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
+
| Head Yaw
 +
| Angle
 +
| New angle, not a delta
 +
|}
 +
 
 +
==== Select Advancement Tab ====
 +
 
 +
Sent by the server to indicate that the client should switch advancement tab. Sent either when the client switches tab in the GUI or when an advancement in another tab is made.
 +
 
 +
{| class="wikitable"
 +
  ! Packet ID
 +
! State
 +
! Bound To
 
  ! Field Name
 
  ! Field Name
  !  
+
  ! Field Type
  !  
+
  ! Notes
 
  |-
 
  |-
  | 0: set size
+
  |rowspan="2"| 0x3C
  | Radius
+
|rowspan="2"| Play
  | Double
+
|rowspan="2"| Client
  | meters
+
  | Has id
 +
  | Boolean
 +
  | Indicates if the next field is present
 
  |-
 
  |-
  |rowspan="3"| 1: lerp size
+
| Optional Identifier
  | Old Radius
+
| String (32767)
 +
| See below
 +
|}
 +
 
 +
The Identifier can be one of the following:
 +
 
 +
{| class="wikitable"
 +
! Optional Identifier
 +
|-
 +
| minecraft:story/root
 +
|-
 +
| minecraft:nether/root
 +
|-
 +
| minecraft:end/root
 +
|-
 +
| minecraft:adventure/root
 +
|-
 +
| minecraft:husbandry/root
 +
|}
 +
 
 +
If no or an invalid identifier is sent, the client will switch to the first tab in the GUI.
 +
 
 +
==== World Border ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="18"| 0x3D
 +
|rowspan="18"| Play
 +
|rowspan="18"| Client
 +
|colspan="2"| Action
 +
| VarInt Enum
 +
| Determines the format of the rest of the packet
 +
|-
 +
! Action
 +
! Field Name
 +
!
 +
!
 +
|-
 +
| 0: set size
 +
| Diameter
 +
| Double
 +
| Length of a single side of the world border, in meters
 +
|-
 +
  |rowspan="3"| 1: lerp size
 +
  | Old Diameter
 
  | Double
 
  | Double
  | meters
+
  | Current length of a single side of the world border, in meters
 
  |-
 
  |-
  | New Radius
+
  | New Diameter
 
  | Double
 
  | Double
  | meters
+
  | Target length of a single side of the world border, in meters
 
  |-
 
  |-
 
  | Speed
 
  | Speed
 
  | VarLong
 
  | VarLong
  | 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
+
  | Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 
  |-
 
  |-
 
  |rowspan="2"| 2: set center
 
  |rowspan="2"| 2: set center
Line 3,210: Line 3,809:
 
  |  
 
  |  
 
  |-
 
  |-
  | Old Radius
+
  | Old Diameter
 
  | Double
 
  | Double
  |  
+
  | Current length of a single side of the world border, in meters
 
  |-
 
  |-
  | New Radius
+
  | New Diameter
 
  | Double
 
  | Double
  |  
+
  | Target length of a single side of the world border, in meters
 
  |-
 
  |-
 
  | Speed
 
  | Speed
 
  | VarLong
 
  | 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
 
  | Portal Teleport Boundary
 
  | VarInt
 
  | VarInt
  | Resulting coordinates from a portal teleport are limited to +-value. Usually 29999984.
+
  | Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 
  |-
 
  |-
 
  | Warning Time
 
  | Warning Time
 
  | VarInt
 
  | VarInt
  |  
+
  | In seconds as set by <code>/worldborder warning time</code>
 
  |-
 
  |-
 
  | Warning Blocks
 
  | Warning Blocks
 
  | VarInt
 
  | VarInt
  |  
+
  | In meters
 
  |-
 
  |-
 
  |rowspan="1"| 4: set warning time
 
  |rowspan="1"| 4: set warning time
 
  | Warning Time
 
  | Warning Time
 
  | VarInt
 
  | VarInt
  | unit?
+
  | In seconds as set by <code>/worldborder warning time</code>
 
  |-
 
  |-
 
  |rowspan="1"| 5: set warning blocks
 
  |rowspan="1"| 5: set warning blocks
 
  | Warning Blocks
 
  | Warning Blocks
 
  | VarInt
 
  | VarInt
  |  
+
  | In meters
 
  |}
 
  |}
  
==== Title ====
+
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:
  
{| class="wikitable"
+
<syntaxhighlight lang="java">
 +
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 +
if (playerDistance < distance) {
 +
    warning = 1.0 - playerDistance / distance;
 +
} else {
 +
    warning = 0.0;
 +
}
 +
</syntaxhighlight>
 +
 
 +
==== Camera ====
 +
 
 +
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
 +
 
 +
The player's camera will move with the entity and look where it is looking. The entity is often another player, but can be any type of entity.  The player is unable to move this entity (move packets will act as if they are coming from the other entity).
 +
 
 +
If the given entity is not loaded by the player, this packet is ignored.  To return control to the player, send this packet with their entity ID.
 +
 
 +
The Notchian server resets this (sends it back to the default entity) whenever the spectated entity is killed or the player sneaks, but only if they were spectating an entity. It also sends this packet whenever the player switches out of spectator mode (even if they weren't spectating an entity).
 +
 
 +
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
 
  ! State
 
  ! State
 
  ! Bound To
 
  ! Bound To
  !colspan="2"| Field Name
+
  ! Field Name
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="9"| 0x45
+
  |rowspan="1"| 0x3E
  |rowspan="9"| Play
+
  |rowspan="1"| Play
  |rowspan="9"| Client
+
  |rowspan="1"| Client
  |colspan="2"| Action
+
  | Camera ID
 
  | VarInt
 
  | VarInt
  |  
+
  | ID of the entity to set the client's camera to
  |-
+
  |}
  ! Action
+
 
 +
The notchian also loads certain shaders for given entities:
 +
 
 +
* Creeper &rarr; <code>shaders/post/creeper.json</code>
 +
* Spider (and cave spider) &rarr; <code>shaders/post/spider.json</code>
 +
* Enderman &rarr; <code>shaders/post/invert.json</code>
 +
* Anything else &rarr; the current shader is unloaded
 +
 
 +
==== Held Item Change (clientbound) ====
 +
 
 +
Sent to change the player's slot selection.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 
  ! Field Name
 
  ! Field Name
  !  
+
  ! Field Type
  !  
+
  ! Notes
 
  |-
 
  |-
  | 0: set title
+
  |rowspan="1"| 0x3F
  | Title Text
+
  |rowspan="1"| Play
  | [[Chat]]
+
  |rowspan="1"| Client
  |  
+
  | Slot
  |-
+
  | Byte
  | 1: set subtitle
+
  | The slot which the player has selected (0–8)
  | Subtitle Text
+
  |}
  | [[Chat]]
+
 
  |
+
==== 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.}}
 +
 
 +
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.
 +
 
 +
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"
 +
! Packet ID
 +
! State
 +
  ! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 
  |-
 
  |-
  |rowspan="3"| 2: set times and display
+
  |rowspan="2"| 0x40
  | Fade In
+
|rowspan="2"| Play
  | Int
+
|rowspan="2"| Client
  | ticks
+
  | Chunk X
 +
  | VarInt
 +
  | Chunk X coordinate of the player's position
 
  |-
 
  |-
  | Stay
+
  | Chunk Z
  | Int
+
  | VarInt
  | ticks
+
  | Chunk Z coordinate of the player's position
|-
 
| Fade Out
 
| Int
 
| ticks
 
|-
 
| 3: hide
 
| ''no fields''
 
| ''no fields''
 
|
 
|-
 
| 4: reset
 
| ''no fields''
 
| ''no fields''
 
|
 
 
  |}
 
  |}
  
“Hide” makes the title disappear, but if you run times again the same title will appear. “Reset” erases the text.
+
==== Update View Distance ====
 
 
==== Set Compression ====
 
  
{{Warning|This packet is completely broken and will be removed in a future 1.9 snapshot, as announced by Grum in #mcdevs on 2015-11-09 20:00:34 UTC. The packet [[#Set Compression 2|Set Compression]] ([[#Login|Login]], 0x03, clientbound) should be used instead.}}
+
Sent by the integrated singleplayer server when changing render distance.  Does not appear to be used by the dedicated server, as <code>view-distance</code> in server.properties cannot be changed at runtime.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,315: Line 3,948:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x46
+
  |rowspan="1"| 0x41
 
  |rowspan="1"| Play
 
  |rowspan="1"| Play
 
  |rowspan="1"| Client
 
  |rowspan="1"| Client
  | Threshold
+
  | View Distance
 
  | VarInt
 
  | VarInt
  | Packets of this size or higher ''may'' be compressed
+
  | Render distance (2-32)
 
  |}
 
  |}
  
==== Player List Header And Footer ====
+
==== Display Scoreboard ====
 +
 
 +
This is sent to the client when it should display a scoreboard.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,333: Line 3,968:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x47
+
  |rowspan="2"| 0x42
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Header
+
  | Position
  | [[Chat]]
+
  | Byte
  |  
+
  | The position of the scoreboard. 0: list, 1: sidebar, 2: below name, 3 - 18: team specific sidebar, indexed as 3 + team color.
 
  |-
 
  |-
  | Footer
+
  | Score Name
  | [[Chat]]
+
  | String (16)
  |  
+
  | The unique name for the scoreboard to be displayed.
 
  |}
 
  |}
  
==== Resource Pack Send ====  
+
==== Entity Metadata ====
 +
 
 +
Updates one or more [[Entities#Entity Metadata Format|metadata]] properties for an existing entity. Any properties not included in the Metadata field are left unchanged.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,355: Line 3,992:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x48
+
  |rowspan="2"| 0x43
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | URL
+
  | Entity ID
  | String
+
  | VarInt
  | The URL to the resource pack.
+
  |  
 
  |-
 
  |-
  | Hash
+
  | Metadata
  | String
+
  | [[Entities#Entity Metadata Format|Entity Metadata]]
| 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 ====  
+
==== Attach Entity ====
 +
 
 +
This packet is sent when an entity has been {{Minecraft Wiki|Lead|leashed}} to another entity.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,377: Line 4,016:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="2"| 0x49
+
  |rowspan="2"| 0x44
 
  |rowspan="2"| Play
 
  |rowspan="2"| Play
 
  |rowspan="2"| Client
 
  |rowspan="2"| Client
  | Entity ID
+
  | Attached Entity ID
  | VarInt
+
  | Int
  |  
+
  | Attached entity's EID
 
  |-
 
  |-
  | Tag
+
  | Holding Entity ID
  | [[NBT|NBT Tag]]
+
  | Int
  |  
+
  | ID of the entity holding the lead. Set to -1 to detach.
 
  |}
 
  |}
  
=== Serverbound ===
+
==== Entity Velocity ====
  
==== Keep Alive ====
+
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).
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,403: Line 4,040:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x00
+
  |rowspan="4"| 0x45
  |rowspan="1"| Play
+
  |rowspan="4"| Play
  |rowspan="1"| Server
+
  |rowspan="4"| Client
  | Keep Alive ID
+
  | Entity ID
 
  | VarInt
 
  | VarInt
 
  |  
 
  |  
 +
|-
 +
| Velocity X
 +
| Short
 +
| Velocity on the X axis
 +
|-
 +
| Velocity Y
 +
| Short
 +
| Velocity on the Y axis
 +
|-
 +
| Velocity Z
 +
| Short
 +
| Velocity on the Z axis
 
  |}
 
  |}
  
==== Chat Message ====
+
==== Entity Equipment ====
 
 
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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,423: Line 4,070:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="1"| 0x01
+
  |rowspan="3"| 0x46
  |rowspan="1"| Play
+
  |rowspan="3"| Play
  |rowspan="1"| Server
+
  |rowspan="3"| Client
  | Message
+
  | Entity ID
  | String
+
  | VarInt
  | The client sends the raw input, not [[Chat]]
+
  | Entity's EID
 +
|-
 +
| Slot
 +
| VarInt Enum
 +
| Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
 +
|-
 +
| Item
 +
| [[Slot Data|Slot]]
 +
|
 
  |}
 
  |}
  
==== Use Entity ====
+
==== Set Experience ====
  
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
+
Sent by the server when the client should change experience levels.
 
 
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.
 
 
 
Note that middle-click in creative mode is interpreted by the client and sent as a [[#Creative Inventory Action|Creative Inventory Action]] packet instead.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,447: Line 4,098:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x02
+
  |rowspan="3"| 0x47
  |rowspan="5"| Play
+
  |rowspan="3"| Play
  |rowspan="5"| Server
+
  |rowspan="3"| Client
  | Target
+
  | Experience bar
 +
| Float
 +
| Between 0 and 1
 +
|-
 +
| Level
 
  | VarInt
 
  | VarInt
 
  |  
 
  |  
 
  |-
 
  |-
  | Type
+
  | Total Experience
 
  | VarInt
 
  | VarInt
  | 0: interact, 1: attack, 2: interact at
+
  | See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
|-
 
| 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 Health ====
  
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
+
Sent by the server to update/set the health of the player it is sent to.
  
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.
+
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 3,485: Line 4,128:
 
  ! Notes