Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
(Merge pre-release protocol)
m (Fix bad html)
Line 1: Line 1:
{{Box
+
This page presents a dissection of the current stable [http://minecraft.net/game/ Minecraft] protocol. The current pre-release protocol is documented [[Pre-release_protocol|elsewhere]]. The protocol for Pocket Minecraft is substantially different, and is documented at [[Pocket Minecraft Protocol]].
  |BORDER = #9999FF
 
  |BACKGROUND = #99CCFF
 
  |WIDTH = 100%
 
  |ICON =
 
  |HEADING = Heads up!
 
  |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''computer edition'''. For the computer edition pre-releases, see [[Pre-release protocol]]. For Pocket Edition, see [[Pocket Edition Protocol Documentation]].
 
}}
 
  
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 ([irc://irc.freenode.net/mcdevs #mcdevs on chat.freenode.net]).
+
'''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.
 +
 
 +
{{Warning|As of 1.7 strings are now UTF-8 (prefixed with a VarInt giving the string's length in bytes) instead of UTF-16.}}
  
'''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.
+
{{Warning|As of 1.7.6 all UUIDs used in the protocol now contain '-'. The session server still returns them without}}
  
The changes between versions may be viewed at [[Protocol History]].
+
The changes between versions may be viewed at [[Protocol History]]
  
 
== 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).
+
=== Data types ===
  
=== Data types ===
+
<!-- Transcluded contents of data types page in here - go to that page if you want to edit it -->
  
{{:Data types}} <!-- Transcluded contents of Data types article in here — go to that page if you want to edit it -->
+
{{:Data Types}}
  
 
=== Other definitions ===
 
=== Other definitions ===
  
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
|-
! Term
+
! Term
! Definition
+
! Definition
|-
+
|-
| Player
+
| Player
| When used in the singular, Player always refers to the client connected to the server.
+
| When used in the singular, Player always refers to the client connected to the server
|-
+
|-
| Entity
+
| Entity
| Entity refers to any item, player, mob, minecart or boat etc. See {{Minecraft Wiki|Entity|the Minecraft Wiki article}} for a full list.
+
| Entity refers to any item, player, mob, minecart or boat in the world. This definition is subject to change as Notch extends the protocol
|-
+
|-
| EID
+
| EID
| An EID or Entity ID is a 4-byte sequence used to identify a specific entity. An entity's EID is unique on the entire server.
+
| An EID - or Entity ID - is a unique 4-byte integer used to identify a specific entity
|-
+
|-
| 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 used by Notch. Y points upwards, X points South, and Z points West.
|-
+
|-
| Meter
+
!colspan="2"|See also: [[Units of Measurement]]
| 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. The block state IDs can be constructed from {{Minecraft Wiki|Data values|this table}} by multiplying what the Minecraft Wiki calls “block IDs” by 16 and adding the metadata/damage value (or in most programming languages <code>block_id &lt;&lt; 4 <nowiki>|</nowiki> metadata</code>).
 
|-
 
| Notchian
 
| The official implementation of vanilla Minecraft as developed and released by Mojang.
 
|}
 
  
== Packet format ==
+
== Packets ==
  
=== Without compression ===
+
=== Protocol Version ===
 +
1.7.2 - 4
  
{| class="wikitable"
+
1.7.6 - 5
! Field Name
 
! Field Type
 
! Notes
 
|-
 
| Length
 
| VarInt
 
| Length of packet data + length of the packet ID
 
|-
 
| Packet ID
 
| VarInt
 
|
 
|-
 
| Data
 
| Byte Array
 
| Depends on the connection state and packet ID, see the sections below
 
|}
 
  
=== With compression ===
+
== Packet format ==
  
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.
+
{| class="wikitable"
 
+
! Field Name !! Field Type !! Notes
{| class=wikitable
+
|-
! Compressed?
+
| Length || VarInt || Length of packet data + length of the packet ID
! Field Name
+
|-
! Field Type
+
| Packet ID || VarInt ||  
! Notes
+
|-
|-
+
| Data || ||  
| No
+
|}
| Packet Length
 
| VarInt
 
| Length of Data Length + compressed length of (Packet ID + Data)
 
|-
 
| No
 
| Data Length
 
| VarInt
 
| Length of uncompressed (Packet ID + Data) or 0
 
|-
 
|rowspan="2"| Yes
 
| Packet ID
 
| Varint
 
| zlib compressed packet ID (see the sections below)
 
|-
 
| Data
 
| Byte Array
 
| zlib compressed packet data (see the sections below)
 
|}
 
 
 
The length given by the Packet Length field is the number of bytes that remain in that packet, including the Data Length field.
 
 
 
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.
 
 
 
Compression can be disabled by sending the packet [[#Set Compression 2|Set Compression]] ([[#Login|Login]], 0x03, clientbound) with a Threshold of -1.
 
  
 
== Handshaking ==
 
== Handshaking ==
 
=== Clientbound ===
 
 
There are no clientbound packets in the Handshaking state, since the protocol immediately switches to a different state after the client sends the first packet.
 
  
 
=== Serverbound ===
 
=== Serverbound ===
  
 
==== Handshake ====
 
==== Handshake ====
 
 
This causes the server to switch into the target state.
 
This causes the server to switch into the target state.
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=4 | 0x00 || rowspan=4 | Handshake || rowspan=4 | Server
! Field Name
+
| Protocol Version || VarInt || (4 as of 1.7.2)
! Field Type
+
|-
! Notes
+
| Server Address (hostname or IP) || String || localhost
|-
+
|-  
|rowspan="4"| 0x00
+
| Server Port || Unsigned Short|| 25565
|rowspan="4"| Handshaking
+
|-
|rowspan="4"| Server
+
| Next state || VarInt || 1 for status, 2 for login
| Protocol Version
+
|}
| VarInt
 
| See [[protocol version numbers]] (currently 110)
 
|-
 
| Server Address
 
| String
 
| Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect.  The Notchian server does not use this information.
 
|-  
 
| Server Port
 
| Unsigned Short
 
| Default is 25565.  The Notchian server does not use this information.
 
|-
 
| Next State
 
| VarInt Enum
 
| 1 for [[#Status|status]], 2 for [[#Login|login]]
 
|}
 
 
 
==== Legacy Server List Ping ====
 
 
 
{{Warning|This packet uses a nonstandard format. It is never length-prefixed, and the packet ID is an Unsigned Byte instead of a VarInt.}}
 
 
 
While not technically part of the current protocol, legacy clients may send this packet to initiate [[Server List Ping]], and modern servers should handle it correctly.
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
| 0xFE
 
| Handshaking
 
| Server
 
| Payload
 
| Unsigned Byte
 
| always 1 (<code>0x01</code>)
 
|}
 
 
 
See [[Server List Ping#1.6]] for the details of the protocol that follows this packet.
 
  
 
== Play ==
 
== Play ==
Line 181: Line 83:
 
=== Clientbound ===
 
=== Clientbound ===
  
==== Spawn Object ====
+
==== Keep Alive ====
  
Sent by the server when a vehicle or other object is created.
+
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Client
! Field Name
+
| Keep Alive ID || Int ||
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="12"| 0x00
 
|rowspan="12"| Play
 
|rowspan="12"| Client
 
| Entity ID
 
| VarInt
 
| EID of the object
 
|-
 
| Object UUID
 
| UUID
 
|
 
|-
 
| Type
 
| Byte
 
| The type of object (see [[Entities#Objects]])
 
|-
 
| X
 
| Double
 
|
 
|-
 
| Y
 
| Double
 
|
 
|-
 
| Z
 
| Double
 
|
 
|-
 
| Pitch
 
| Angle
 
|
 
|-
 
| Yaw
 
| Angle
 
|  
 
|-
 
| Data
 
| Int
 
| Meaning dependent on the value of the Type field, see [[Object Data]] for details.
 
|-
 
| Velocity X
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]].
 
|-
 
| Velocity Y
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]].
 
|-
 
| Velocity Z
 
| Short
 
| Same units as [[#Entity Velocity|Entity Velocity]].
 
|}
 
  
==== Spawn Experience Orb ====
+
==== Join Game ====
 +
See [[Protocol Encryption]] for information on logging in.
  
Spawns one or more experience orbs.
+
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=6 | 0x01 || rowspan=6 | Play || rowspan=6 | Client
 +
| Entity ID || Int || The player's Entity ID
 +
|-
 +
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. Bit 3 (0x8) is the hardcore flag
 +
|-
 +
| Dimension || Byte || -1: nether, 0: overworld, 1: end
 +
|-
 +
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard
 +
|-
 +
| Max Players || Unsigned Byte || Used by the client to draw the player list
 +
|-
 +
| Level Type || String || default, flat, largeBiomes, amplified, default_1_1
 +
|}
 +
{{Warning|If the Dimension isn't valid then the client will crash}}
  
 +
==== Chat Message ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x02 || rowspan=1 | Play || rowspan=1 | Client
! Field Name
+
| JSON Data || String || [[Chat]], Limited to 32767 bytes
! Field Type
+
|}
! Notes
+
{{Warning|Malformed JSON will disconnect the client}}
|-
 
|rowspan="5"| 0x01
 
|rowspan="5"| Play
 
|rowspan="5"| Client
 
| Entity ID
 
| VarInt
 
|  
 
|-
 
| X
 
| Double
 
|  
 
|-
 
| Y
 
| Double
 
|
 
|-
 
| Z
 
| Double
 
|
 
|-
 
| Count
 
| Short
 
| The amount of experience this orb will reward once collected
 
|}
 
  
==== 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.
  
{| class="wikitable"
+
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="5"| 0x02
 
|rowspan="5"| Play
 
|rowspan="5"| Client
 
| Entity ID
 
| VarInt
 
| The EID of the thunderbolt
 
|-
 
| Type
 
| Byte Enum
 
| The global entity type, currently always 1 for thunderbolt
 
|-
 
| X
 
| Double
 
|
 
|-
 
| Y
 
| Double
 
|
 
|-
 
| Z
 
| Double
 
|
 
|}
 
  
==== Spawn Mob ====
+
The default SMP server increments the time by <code>20</code> every second.
  
Sent by the server when a mob entity is spawned.
+
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=2 | 0x03 || rowspan=2 | Play || rowspan=2 | Client
 +
| Age of the world || Long || In ticks; not changed by server commands
 +
|-
 +
| Time of day || Long || The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
 +
|}
  
 +
==== Entity Equipment ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=3 | 0x04 || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| EntityID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| Slot || Short || Equipment slot: 0=held, 1-4=armor slot (1 - boots, 2 - leggings, 3 - chestplate, 4 - helmet)
|-
+
|-
|rowspan="13"| 0x03
+
| Item || [[Slot_Data|Slot]] || Item in slot format
|rowspan="13"| Play
+
|}
|rowspan="13"| Client
 
| Entity ID
 
| VarInt
 
|  
 
|-
 
| Entity UUID
 
| UUID
 
|
 
|-
 
| Type
 
| Unsigned Byte
 
| The type of mob. See [[Entities#Mobs]]
 
|-
 
| X
 
| Double
 
|
 
|-
 
| Y
 
| 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]]
 
|  
 
|}
 
  
==== Spawn Painting ====
+
==== Spawn Position ====
  
This packet shows location, name, and type of painting.
+
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"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=3 | 0x05 || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| X || Int || Spawn X in block coordinates
! Field Type
+
|-
! Notes
+
| Y || Int || Spawn Y in block coordinates
|-
+
|-
|rowspan="5"| 0x04
+
| Z || Int || Spawn Z in block coordinates
|rowspan="5"| Play
+
|}
|rowspan="5"| Client
 
| Entity ID
 
| VarInt
 
|  
 
|-
 
| Entity UUID
 
| UUID
 
|  
 
|-
 
| Title
 
| String
 
| Name of the painting. Max length 13
 
|-
 
| Location
 
| Position
 
| Center coordinates (see below)
 
|-
 
| Direction
 
| Byte Enum
 
| Direction the painting faces (North = 2, South = 0, West = 1, East = 3)
 
|}
 
  
Calculating the center of an image: given a (width × height) grid of cells, with <code>(0, 0)</code> being the top left corner, the center is <code>(max(0, width / 2 - 1), height / 2)</code>. E.g. <code>(1, 0)</code> for a 2×1 painting, or <code>(1, 2)</code> for a 4×4 painting.
+
==== Update Health ====
  
==== Spawn Player ====
+
Sent by the server to update/set the health of the player it is sent to.
 
 
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
 
  
This packet must be sent after the [[#Player List Item|Player List Item]] ([[#Play|Play]], 0x38, clientbound) packet that adds the player data for the client to use when spawning a player. If the Player List Item for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player List Item packet includes skin/cape data.
+
Food 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.
 
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=3 | 0x06 || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| Health || Float || 0 or less = dead, 20 = full HP
! Field Type
+
|-
! Notes
+
| Food || Short || 0 - 20
|-
+
|-  
|rowspan="8"| 0x05
+
| Food Saturation || Float || Seems to vary from 0.0 to 5.0 in integer increments
|rowspan="8"| Play
+
|}
|rowspan="8"| Client
 
| Entity ID
 
| VarInt
 
| Player's EID
 
|-
 
| Player UUID
 
| UUID
 
| See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs
 
|-
 
| X
 
| Double
 
|
 
|-
 
| Y
 
| Double
 
|  
 
|-
 
| Z
 
| Double
 
|
 
|-
 
| Yaw
 
| Angle
 
|
 
|-
 
| Pitch
 
| Angle
 
|  
 
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Entity Metadata]]
 
|  
 
|}
 
  
When in {{Minecraft Wiki|Serve.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs. In offline mode, UUID v3 is used.
+
==== Respawn ====
 
 
For NPCs UUID v2 should be used. Note:
 
  
<+Grum> i will never confirm this as a feature you know that :)
+
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.
 
 
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 
 
 
==== Animation (clientbound) ====
 
 
 
Sent whenever an entity should change animation.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=4 | 0x07 || rowspan=4 | Play || rowspan=4 | Client
! Field Name
+
| Dimension || Int || -1: The Nether, 0: The Overworld, 1: The End
! Field Type
+
|-
! Notes
+
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard.
|-
+
|-
|rowspan="2"| 0x06
+
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
|rowspan="2"| Play
+
|-
|rowspan="2"| Client
+
| Level Type || String || Same as [[Protocol#Join_Game|Join Game]]
| Entity ID
+
|}
| VarInt
+
{{Warning|If the Dimension isn't valid then the client will crash}}
| Player ID
 
|-
 
| Animation
 
| Unsigned Byte
 
| Animation ID (see below)
 
|}
 
  
Animation can be one of the following values:
+
{{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)}}
  
{| class="wikitable"
+
==== Player Position And Look ====
! ID
 
! Animation
 
|-
 
| 0
 
| Swing main arm
 
|-
 
| 1
 
| Take damage
 
|-
 
| 2
 
| Leave bed
 
|-
 
| 3
 
| Swing offhand
 
|-
 
| 4
 
| Critical effect
 
|-
 
| 5
 
| Magic critical effect
 
|}
 
  
==== Statistics ====
+
Updates the players position on the server.
 +
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 units will result in the client being kicked for "You moved too quickly :( (Hacking?)"
 +
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for "Illegal position"
  
{| class="wikitable"
+
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.
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
!colspan="2"| Field Type
 
! Notes
 
|-
 
|rowspan="3"| 0x07
 
|rowspan="3"| Play
 
|rowspan="3"| Client
 
|colspan="2"| Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
|-
 
|rowspan="2"| Statistic
 
| Name
 
|rowspan="2"| Array
 
| String
 
| [https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0 https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0]
 
|-
 
| Value
 
| VarInt
 
| The amount to set it to
 
|}
 
  
==== Block Break Animation ====
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
+
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
 +
  l = x-x0
 +
  w = z-z0
 +
  c = sqrt( l*l + w*w )
 +
  alpha1 = -arcsin(l/c)/PI*180
 +
  alpha2 =  arccos(w/c)/PI*180
 +
  if alpha2 > 90 then
 +
    yaw = 180 - alpha1
 +
  else
 +
    yaw = alpha1
  
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)
+
You can get a unit vector from a given yaw/pitch via:
 
+
  x = -cos(pitch) * sin(yaw)
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
+
  y = -sin(pitch)
 +
  z =  cos(pitch) * cos(yaw)
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=6| 0x08 || rowspan=6 | Play || rowspan=6 | Client
! Field Name
+
| X || Double || Absolute position
! Field Type
+
|-
! Notes
+
| Y || Double || Absolute position (eyes pos)
|-
+
|-
|rowspan="3"| 0x08
+
| Z || Double || Absolute position
|rowspan="3"| Play
+
|-
|rowspan="3"| Client
+
| Yaw || Float || Absolute rotation on the X Axis, in degrees
| Entity ID
+
|-
| VarInt
+
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
| Entity ID of the entity breaking the block
+
|-
|-
+
| On Ground || Bool || True if the client is on the ground, False otherwise
| Location
+
|}
| Position
 
| Block Position
 
|-
 
| Destroy Stage
 
| Byte
 
| 0–9 to set it, any other value to remove it
 
|}
 
  
==== Update Block Entity ====
+
==== Held Item Change ====
  
Sets tile entity associated with the block at the given location.
+
Sent to change the player's slot selection
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x09 || rowspan=1 | Play || rowspan=1 | Client
! Field Name
+
| Slot || Byte || The slot which the player has selected (0-8)
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="3"| 0x09
 
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Location
 
| Position
 
|  
 
|-
 
| Action
 
| Unsigned Byte
 
| 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)
 
|}
 
  
''Action'' field:
+
==== Use Bed ====
  
* '''1''': Set SpawnPotentials of a mob spawner
+
This packet tells that a player goes to bed.
* '''2''': Set command block text (command and last execution status)
 
* '''3''': Set the level, primary, and secondary powers of a beacon
 
* '''4''': Set rotation and skin of mob head
 
* '''5''': Set type of flower in flower pot
 
* '''6''': Set base color and patterns on a banner
 
* '''7''': Set the data for a Structure tile entity
 
* '''8''': Set the destination for a end gateway
 
* '''9''': Set the text on a sign
 
  
==== Block Action ====
+
The client with the matching  Entity ID will go into bed mode.
  
This packet is used for a number of things:
+
This Packet is sent to all nearby players including the one sent to bed.
 
 
* Chests opening and closing
 
* Pistons pushing and pulling
 
* Note blocks playing
 
* Updating beacons
 
 
 
See also: [[Block Actions]]
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=4 | 0x0A || rowspan=4 | Play || rowspan=4 | Client
! Field Name
+
| Entity ID || Int || Player ID
! Field Type
+
|-
! Notes
+
| X || Int || Bed headboard X as block coordinate
|-
+
|-
|rowspan="4"| 0x0A
+
| Y || Unsigned Byte || Bed headboard Y as block coordinate
|rowspan="4"| Play
+
|-
|rowspan="4"| Client
+
| Z || Int || Bed headboard Z as block coordinate
| Location
+
|}
| Position
 
| Block coordinates
 
|-
 
| Byte 1
 
| Unsigned Byte
 
| Varies depending on block — see [[Block Actions]]
 
|-
 
| Byte 2
 
| Unsigned Byte
 
| Varies depending on block — see [[Block Actions]]
 
|-
 
| Block Type
 
| VarInt
 
| The block type ID for the block, not including metadata/damage value
 
|}
 
  
==== Block Change ====
+
==== Animation ====
  
Fired whenever a block is changed within the render distance.
+
Sent whenever an entity should change animation.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x0B || rowspan=2 | Play || rowspan=2 | Client
! Field Name
+
| Entity ID || VarInt || Player ID
! Field Type
+
|-
! Notes
+
| Animation || Unsigned Byte || Animation ID
|-
+
|}
|rowspan="2"| 0x0B
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Location
 
| Position
 
| Block Coordinates
 
|-
 
| Block ID
 
| VarInt
 
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (When reading data: <code>type = id &gt;&gt; 4</code>, <code>meta = id & 15</code>, when writing data: <code>id = type &lt;&lt; 4 &#124; (meta &amp; 15)</code>)
 
|}
 
  
==== Boss Bar ====
+
Animation can be one of the following values:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! ID !! Animation
! State
+
|-
! Bound To
+
| 0 || Swing arm
!colspan="2"| Field Name
+
|-
! Field Type
+
| 1 || Damage animation
! Notes
+
|-
|-
+
| 2 || Leave bed
|rowspan="15"| 0x0C
+
|-
|rowspan="15"| Play
+
| 3 || Eat food
|rowspan="15"| Client
+
|-
|colspan="2"| UUID
+
| 4 || Critical effect
| UUID
+
|-
| Unique ID for this bar
+
| 5 || Magic critical effect
|-
+
|-
|colspan="2"| Action
+
| 102 || (unknown)
| VarInt Enum
+
|-
| Determines the layout of the remaining packet
+
| 104 || Crouch
|-
+
|-
! Action
+
| 105 || Uncrouch
! Field Name
+
|}
!
 
!
 
|-
 
|rowspan="5"| 0: add
 
| Title
 
| [[Chat]]
 
|  
 
|-
 
| Health
 
| Float
 
| From 0 to 1. Values greater than 1 do not crash a Notchian client, and start [https://i.johni0702.de/nA.png rendering part of a second health bar] at around 1.5.
 
|-
 
| Color
 
| VarInt Enum
 
| Color ID (see below)
 
|-
 
| Division
 
| VarInt Enum
 
| Type of division (see below)
 
|-
 
| Flags
 
| Unsigned Byte
 
| Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music)
 
|-
 
| 1: remove
 
| ''no fields''
 
| ''no fields''
 
| Removes this boss bar
 
|-
 
| 2: update health
 
| Health
 
| Float
 
| as above
 
|-
 
| 3: update title
 
| Title
 
| [[Chat]]
 
|  
 
|-
 
|rowspan="2"| 4: update style
 
| Color
 
| VarInt Enum
 
| Color ID (see below)
 
|-
 
| Dividers
 
| VarInt Enum
 
| as above
 
|-
 
| 5: update flags
 
| Flags
 
| Unsigned Byte
 
| as above
 
|-
 
|}
 
  
{| class="wikitable"
+
==== Spawn Player ====
! ID
+
 
! Color
+
This packet is sent by the server when a player comes into visible range, '''not''' when a player joins.
|-
 
| 0
 
| Pink
 
|-
 
| 1
 
| Blue
 
|-
 
| 2
 
| Red
 
|-
 
| 3
 
| Green
 
|-
 
| 4
 
| Yellow
 
|-
 
| 5
 
| Purple
 
|-
 
| 6
 
| White
 
|}
 
  
{| class="wikitable"
+
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
! ID
 
! Type of division
 
|-
 
| 0
 
| No division
 
|-
 
| 1
 
| 6 notches
 
|-
 
| 2
 
| 10 notches
 
|-
 
| 3
 
| 12 notches
 
|-
 
| 4
 
| 20 notches
 
|}
 
  
==== Server Difficulty ====
+
When in online-mode the uuids must be valid and have valid skin blobs, in offline-mode uuid v3 is used.
  
Changes the difficulty setting in the client's option menu
+
For NPCs UUID v2 should be used. Note:
 +
  <+Grum> i will never confirm this as a feature you know that :)
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=14 | 0x0C || rowspan=14 | Play || rowspan=14 | Client
! Field Name
+
| colspan=2 | Entity ID || VarInt || Player's Entity ID
! Field Type
+
|-
! Notes
+
| colspan=2 | Player UUID || String || Player's UUID
|-
+
|-
|rowspan="1"| 0x0D
+
| colspan=2 | Player Name || String || Player's Name
|rowspan="1"| Play
+
|-
|rowspan="1"| Client
+
| colspan=2 | Data count || VarInt ||
| Difficulty
+
|-
| Unsigned Byte
+
| rowspan=3 | Data
| 0: peaceful, 1: easy, 2: normal, 3: hard
+
| Name || String || Name of the property as return by the session server's /hasJoined. E.g: textures
|}
+
|-
 +
| Value || String || Value of the property (base64) as return by the session server's /hasJoined
 +
|-
 +
| Signature || String || Signature of the property (base64) as return by the session server's /hasJoined.
 +
|-
 +
| colspan=2 | X || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| colspan=2 | Y || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| colspan=2 | Z || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| colspan=2 | Yaw || Byte || Player rotation as a packed byte
 +
|-
 +
| colspan=2 | Pitch || Byte || Player rotation as a packet byte
 +
|-
 +
| colspan=2 | Current Item || Short || The item the player is currently holding. Note that this should be 0 for "no item", unlike -1 used in other packets. A negative value crashes clients.
 +
|-
 +
| colspan=2 | Metadata || [[Entities#Entity_Metadata_Format|Metadata]] || The client will crash if no metadata is sent
 +
|}
 +
{{Warning|The client will crash if no metadata is sent}}
 +
{{Warning|The client will disconnect if both UUID and Name are empty}}
  
==== Tab-Complete (clientbound) ====
+
==== Collect Item ====
  
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 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 and [Player Position & Look packet sent by the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x0D || rowspan=2 | Play || rowspan=2 | Client
! Field Name
+
| Collected Entity ID || Int ||
! Field Type
+
|-  
! Notes
+
| Collector Entity ID || Int ||
|-
+
|}
|rowspan="2"| 0x0E
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Matches
 
| Array of String
 
| One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
 
|}
 
  
==== Chat Message (clientbound) ====  
+
==== Spawn Object ====
  
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
+
Sent by the server when an Object/Vehicle is created.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=8| 0x0E || rowspan=8 | Play || rowspan=8 | Client
! Field Name
+
| Entity ID || VarInt || Entity ID of the object
! Field Type
+
|-
! Notes
+
| Type || Byte || The type of object (See [[Entities#Objects|Objects]])
|-
+
|-
|rowspan="2"| 0x0F
+
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|rowspan="2"| Play
+
|-
|rowspan="2"| Client
+
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]  
| JSON Data
+
|-
| [[Chat]]
+
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
| Limited to 32767 bytes
+
|-
|-
+
| Pitch || Byte || The pitch in steps of 2p/256
| Position
+
|-
| Byte
+
| Yaw || Byte || The yaw in steps of 2p/256
| 0: chat (chat box), 1: system message (chat box), 2: above hotbar
+
|-
|}
+
| Data || [[Object_Data|Object Data]] ||
 +
|}
  
==== Multi Block Change ====
+
==== Spawn Mob ====
  
Fired whenever 2 or more blocks are changed within the same chunk on the same tick.
+
Sent by the server when a Mob Entity is Spawned
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=12 | 0x0F || rowspan=12 | Play || rowspan=12 | Client
!colspan="2"| Field Name
+
| Entity ID || VarInt || Entity's ID
!colspan="2"| Field Type
+
|-
! Notes
+
| Type || Unsigned Byte || The type of mob. See [[Entities#Mobs|Mobs]]
|-
+
|-
|rowspan="6"| 0x10
+
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|rowspan="6"| Play
+
|-
|rowspan="6"| Client
+
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|colspan="2"| Chunk X
+
|-
|colspan="2"| Int
+
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
| Chunk X coordinate
+
|-
|-
+
| Yaw || Byte || The yaw in steps of 2p/256
|colspan="2"| Chunk Z
+
|-
|colspan="2"| Int
+
| Pitch || Byte || The pitch in steps of 2p/256
| Chunk Z coordinate
+
|-
|-
+
| Head Pitch || Byte || The pitch in steps of 2p/256
|colspan="2"| Record Count
+
|-
|colspan="2"| VarInt
+
| Velocity X || Short ||
| Number of elements in the following array, i.e. the number of blocks affected
+
|-
|-
+
| Velocity Y || Short ||
|rowspan="3"| Record
+
|-
| Horizontal Position
+
| Velocity Z || Short ||
|rowspan="3"| Array
+
|-
| Unsigned Byte
+
| Metadata || [[Entities#Entity_Metadata_Format|Metadata]] ||
| The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
+
|}
|-
 
| Y Coordinate
 
| Unsigned Byte
 
| Y coordinate of the block
 
|-
 
| Block ID
 
| VarInt
 
| The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}} (When reading data: <code>type = id &gt;&gt; 4</code>, <code>meta = id & 15</code>, when writing data: <code>id = type &lt;&lt; 4 &#124; (meta &amp; 15)</code>)
 
|}
 
  
To decode the position into a world position:
+
==== Spawn Painting ====
  
<syntaxhighlight lang="java">
+
This packet shows location, name, and type of painting.
worldX = (horizPos >> 4 & 15) + (chunkX * 16);
 
worldY = vertPos;
 
worldZ = (horizPos & 15) + (chunkZ * 16);
 
</syntaxhighlight>
 
  
==== Confirm Transaction (clientbound) ====
+
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)
  
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=6 | 0x10 || rowspan=6 | Play || rowspan=6 | Client
! Field Name
+
| Entity ID || VarInt || Entity's ID
! Field Type
+
|-
! Notes
+
| Title || String || Name of the painting. Max length 13
|-
+
|-
|rowspan="3"| 0x11
+
| X || Int || Center X coordinate
|rowspan="3"| Play
+
|-
|rowspan="3"| Client
+
| Y || Int || Center Y coordinate
| Window ID
+
|-
| Byte
+
| Z || Int || Center Z coordinate
| The ID of the window that the action occurred in
+
|-
|-
+
| Direction || Int || Direction the painting faces (0 -z, 1 -x, 2 +z, 3 +x)
| Action Number
+
|}
| Short
 
| Every action that is to be accepted has a unique number. This field corresponds to that number.
 
|-
 
| Accepted
 
| Boolean
 
| Whether the action was accepted
 
|}
 
  
==== Close Window (clientbound) ====
+
==== Spawn Experience Orb ====
  
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.
+
Spawns one or more experience orbs.
 
 
Note, notchian clients send a close window packet with Window ID 0 to close their inventory even though there is never an [[#Open Window|Open Window]] packet for inventory.  
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=5 | 0x11 || rowspan=5 | Play || rowspan=5 | Client
! Field Name
+
| Entity ID || VarInt || Entity's ID
! Field Type
+
|-
! Notes
+
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|-
+
|-
| 0x12
+
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
| Play
+
|-
| Client
+
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
| Window ID
+
|-
| Unsigned Byte
+
| Count || Short || The amount of experience this orb will reward once collected
| This is the ID of the window that was closed. 0 for inventory.
+
|}
|}
 
  
==== Open Window ====
+
==== Entity Velocity ====
  
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.
+
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms);
 +
for example, -1343 would move (-1343 / 8000) = -0.167875 blocks per tick (or -3,3575 blocks per second).
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=4 | 0x12 || rowspan=4 | Play || rowspan=4 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| Velocity X || Short || Velocity on the X axis
|-
+
|-
|rowspan="5"| 0x13
+
| Velocity Y || Short || Velocity on the Y axis
|rowspan="5"| Play
+
|-
|rowspan="5"| Client
+
| Velocity Z || Short || Velocity on the Z axis
| Window ID
+
|}
| Unsigned Byte
 
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
 
|-
 
| Window Type
 
| String
 
| The window type to use for display. See [[Inventory]] for a list.
 
|-
 
| Window Title
 
| [[Chat]]
 
| The title of the window
 
|-
 
| Number Of Slots
 
| Unsigned Byte
 
| Number of slots in the window (excluding the number of slots in the player inventory)
 
|-
 
| Entity ID
 
| Optional Int
 
| EntityHorse's EID. Only sent when Window Type is “EntityHorse”
 
|}
 
  
See [[Inventory]] for further information.
+
==== Destroy Entities ====
 
 
==== 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.
+
Sent by the server when an list of Entities is to be destroyed on the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x13 || rowspan=2 | Play || rowspan=2 | Client
! Field Name
+
| Count || Byte || Length of following array
! Field Type
+
|-
! Notes
+
| Entity IDs || Array of Int || The list of entities of destroy
|-
+
|}
|rowspan="3"| 0x14
 
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Window ID
 
| Unsigned Byte
 
| The ID of window which items are being sent for. 0 for player inventory.
 
|-
 
| Count
 
| Short
 
| Number of elements in the following array
 
|-
 
| Slot Data
 
| Array of [[Slot Data|Slot]]
 
|  
 
|}
 
  
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
+
==== Entity ====
  
==== Window Property ====
+
Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.
  
This packet is used to inform the client that part of a GUI window should be updated.
+
For player entities, either this packet or any move/look packet is sent every game tick.
 +
So the meaning of this packet is basically that the entity did not move/look since the last such packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x14 || rowspan=1 | Play || rowspan=1 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="3"| 0x15
 
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Window ID
 
| Unsigned Byte
 
|  
 
|-
 
| Property
 
| Short
 
| The property to be updated, see below
 
|-
 
| Value
 
| Short
 
| The new value for the property, see below
 
|}
 
  
The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted.
+
==== Entity Relative Move ====
 
 
{| class="wikitable"
 
|-
 
! Window type
 
! Property
 
! Value
 
|-
 
|rowspan="4"| Furnace
 
| 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)
 
|-
 
| 2: Progress arrow
 
| 0–200 (in-game ticks)
 
|-
 
| 3: Maximum progress
 
| always 200
 
|-
 
|rowspan="7"| Enchantment Table
 
| 0: Level requirement for top enchantment slot
 
|rowspan="3"| The enchantment's xp level requirement
 
|-
 
| 1: Level requirement for middle enchantment slot
 
|-
 
| 2: Level requirement for bottom enchantment slot
 
|-
 
| 3: The seed for generating the enchantments view for the client
 
| Unknown
 
|-
 
| 4: Enchantment shown on mouse hover over top enchantment slot
 
|rowspan="3"| The enchantment id (set to -1 to hide it)
 
|-
 
| 5: Enchantment shown on mouse hover over middle enchantment slot
 
|-
 
| 6: Enchantment shown on mouse hover over bottom enchantment slot
 
|-
 
|rowspan="3"| Beacon
 
| 0: Power level
 
| Unknown
 
|-
 
| 1: First potion effect
 
| Unknown
 
|-
 
| 2: Second potion effect
 
| Unknown
 
|-
 
| Anvil
 
| 0: Repair cost
 
| The repair's cost in xp levels
 
|-
 
| Brewing Stand
 
| 0: Brew time
 
| 0–400, with 400 making the arrow empty, and 0 making the arrow full
 
|}
 
  
==== Set Slot ====
+
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 should be sent instead.
  
Sent by the server when an item in a slot (in a window) is added/removed.
+
This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=4| 0x15 || rowspan=4 | Play || rowspan=4 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|-
+
|-
|rowspan="3"| 0x16
+
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|rowspan="3"| Play
+
|-
|rowspan="3"| Client
+
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
| Window ID
+
|}
| Byte
 
| The window which is being updated. 0 for player inventory. Note that all known window types include the player inventory. This packet will only be sent for the currently opened window while the player is performing actions, even if it affects the player inventory. After the window is closed, a number of these packets are sent to update the player's inventory window (0).
 
|-
 
| Slot
 
| Short
 
| The slot that should be updated
 
|-
 
| Slot Data
 
| [[Slot Data|Slot]]
 
|
 
|}
 
  
To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot.
+
==== Entity Look ====
 
 
This packet can only be used to edit the hotbar of the player's inventory if window ID is set to 0 (slots 36 through 44).  If the window ID is set to -2, then any slot in the inventory can be used but no add item animation will be played.
 
 
 
==== Set Cooldown ====
 
  
Applies a cooldown period to all items with the given type.  Used by the Notchian server with enderpearlsThis 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.
+
This packet is sent by the server when an entity rotatesExample: "Yaw" field 64 means a 90 degree turn.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=3 | 0x16 || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| Yaw || Byte || The X Axis rotation as a fraction of 360
|-
+
|-
|rowspan="2"| 0x17
+
| Pitch || Byte || The Y Axis rotation as a fraction of 360
|rowspan="2"| Play
+
|}
|rowspan="2"| Client
 
| Item ID
 
| VarInt
 
| Numeric ID of the item to apply a cooldown to.
 
|-
 
| Cooldown Ticks
 
| VarInt
 
| Number of ticks to apply a cooldown for, or 0 to clear the cooldown.
 
|}
 
 
 
==== Plugin Message (clientbound) ====
 
  
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>.
+
==== Entity Look and Relative Move ====
  
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/]
+
This packet is sent by the server when an entity rotates and moves.
 +
Since a byte range is limited from -128 to 127, and movement is offset of fixed-point numbers,
 +
this packet allows at most four blocks movement in any direction. (-128/32 == -4)
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=6 | 0x17 || rowspan=6 | Play || rowspan=6 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|-
+
|-
|rowspan="2"| 0x18
+
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|rowspan="2"| Play
+
|-
|rowspan="2"| Client
+
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
| Channel
+
|-
| String
+
| Yaw || Byte || The X Axis rotation as a fraction of 360
| Name of the [[plugin channel]] used to send the data
+
|-
|-
+
| Pitch || Byte || The Y Axis rotation as a fraction of 360
| Data
+
|}
| Byte Array
 
| Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]]The length of this array must be inferred from the packet length.
 
|}
 
  
==== Named Sound Effect ====
+
==== Entity Teleport ====
{{See also|#Sound Effect}}
 
  
Used to play a sound effect on the client. Custom sounds may be added by resource packs.
+
This packet is sent by the server when an entity moves more than 4 blocks.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=6 | 0x18 || rowspan=6 | Play || rowspan=6 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|-
+
|-
|rowspan="7"| 0x19
+
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|rowspan="7"| Play
+
|-
|rowspan="7"| Client
+
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
| Sound Name
+
|-
| String
+
| Yaw || Byte || The X Axis rotation as a fraction of 360
| All known sound effect names can be seen [http://pokechu22.github.io/Burger/1.9.html#sounds here].
+
|-
|-
+
| Pitch || Byte || The Y Axis rotation as a fraction of 360
| Sound Category
+
|}
| VarInt Enum
 
| The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 
|-
 
| Effect Position X
 
| Int
 
| Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
|-
 
| Effect Position Y
 
| Int
 
| Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
|-
 
| Effect Position Z
 
| Int
 
| Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
|-
 
| Volume
 
| Float
 
| 1 is 100%, can be more
 
|-
 
| Pitch
 
| Unsigned Byte
 
| 63 is 100%, can be more
 
|}
 
  
==== Disconnect (play) ====
+
==== Entity Head Look ====
  
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.
+
Changes the direction an entity's head is facing.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| Head Yaw || Byte || Head yaw in steps of 2p/256
|-
+
|}
| 0x1A
 
| Play
 
| Client
 
| Reason
 
| [[Chat]]
 
| Displayed to the client when the connection terminates.
 
|}
 
  
 
==== Entity Status ====
 
==== Entity Status ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x1A || rowspan=2 | Play || rowspan=2 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| Entity Status || Byte || See below
|-
+
|}
|rowspan="2"| 0x1B
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Entity ID
 
| Int
 
|  
 
|-
 
| Entity Status
 
| Byte Enum
 
| See below
 
|}
 
  
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
|-
! Entity Status
+
! Entity Status !! Meaning
! Meaning
+
|-
|-
+
| 0 || Something related to living entities?
| 0
+
|-
| Spawn tipped arrow particle effects
+
| 1 || Something related to the player entity?
|-
+
|-
| 1
+
| 2 || Living Entity hurt  
| Reset a mob spawner minecart's timer (unused by the client?)
+
|-
|-
+
| 3 || Living Entity dead
| 1
+
|-
| Create rabbit running particles
+
| 4 || Iron Golem throwing up arms
|-
+
|-
| 2
+
| 6 || Wolf/Ocelot/Horse taming - Spawn "heart" particles
| Entity hurt animation
+
|-
|-
+
| 7 || Wolf/Ocelot/Horse tamed - Spawn "smoke" particles
| 3
+
|-
| Entity died animation
+
| 8 || Wolf shaking water - Trigger the shaking animation
|-
+
|-
| 4
+
| 9 || (of self) Eating accepted by server
| Iron Golem throwing up arms
+
|-
|-
+
| 10 || Sheep eating grass
| 6
+
|-
| Wolf/Ocelot/Horse taming Spawn “heart” particles
+
| 11 || Iron Golem handing over a rose
|-
+
|-
| 7
+
| 12 || Villager mating - Spawn "heart" particles
| Wolf/Ocelot/Horse tamed Spawn “smoke” particles
+
|-
|-
+
| 13 || Spawn particles indicating that a villager is angry and seeking revenge
| 8
+
|-
| Wolf shaking water Trigger the shaking animation
+
| 14 || Spawn happy particles near a villager
|-
+
|-
| 9
+
| 15 || Witch animation - Spawn "magic" particles
| Mark item use as finished (ie, eating finished, drinking finished)
+
|-
|-
+
| 16 || Zombie converting into a villager by shaking violently
| 10
+
|-
| Sheep eating grass
+
| 17 || Firework exploding
|-
+
|-
| 10
+
| 18 || Animal in love (ready to mate) - Spawn "heart" particles
| Ignite TNT minecart
+
|}
|-
 
| 11
 
| Iron Golem handing over a rose
 
|-
 
| 12
 
| Villager mating Spawn “heart” particles
 
|-
 
| 13
 
| Spawn particles indicating that a villager is angry and seeking revenge
 
|-
 
| 14
 
| Spawn happy particles near a villager
 
|-
 
| 15
 
| Witch animation Spawn “magic” particles
 
|-
 
| 16
 
| Play zombie converting into a villager sound
 
|-
 
| 17
 
| Firework exploding
 
|-
 
| 18
 
| Animal in love (ready to mate) Spawn “heart” particles
 
|-
 
| 19
 
| Reset squid rotation
 
|-
 
| 20
 
| Spawn explosion particle — works for some living entities
 
|-
 
| 21
 
| Play guardian sound — works for every entity
 
|-
 
| 22
 
| Enables reduced {{Minecraft Wiki|Debug screen|debug}} for the given player
 
|-
 
| 23
 
| Disables reduced {{Minecraft Wiki|Debug screen|debug}} for the given player
 
|-
 
| 24–28
 
| Sets the {{Minecraft Wiki|Server.properties#op-permission-level|op permission level}} 0–4 for the connected player
 
|-
 
| 29
 
| Shield block sound
 
|-
 
| 30
 
| Shield break sound
 
|-
 
| 31
 
| For a fishing rod bobber, if the hooked entity is this player, tug that player toward the caster of the rod
 
|-
 
| 32
 
| Armorstand hit sound
 
|-
 
| 33
 
| Entity hurt due to thorns (play thorns sound, perform normal hurt animation)
 
|}
 
  
==== Explosion ====
+
==== Attach Entity ====
  
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
+
This packet is sent when a player has been attached to an entity (e.g. Minecart)
  
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
+
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=3 | 0x1B || rowspan=3 | Play || rowspan=3 | Client
 +
| Entity ID || Int || Entity's ID
 +
|-
 +
| Vehicle ID || Int || Vechicle's Entity ID
 +
|-
 +
| Leash || Bool || If true leashes the entity to the vehicle
 +
|}
  
 +
==== Entity Metadata ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x1C || rowspan=2 | Play || rowspan=2 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| Metadata || [[Entities#Entity_Metadata_Format|Metadata]] ||  
|-
+
|}
|rowspan="9"| 0x1C
 
|rowspan="9"| Play
 
|rowspan="9"| Client
 
| X
 
| Float
 
|
 
|-
 
| Y
 
| Float
 
|
 
|-
 
| Z
 
| Float
 
|
 
|-
 
| Radius
 
| Float
 
| Currently unused in the client
 
|-
 
| Record Count
 
| Int
 
| Number of elements in the following array
 
|-
 
| Records
 
| Array of (Byte, Byte, Byte)
 
| Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
 
|-
 
| Player Motion X
 
| Float
 
| X velocity of the player being pushed by the explosion
 
|-
 
| Player Motion Y
 
| Float
 
| Y velocity of the player being pushed by the explosion
 
|-
 
| Player Motion Z
 
| Float
 
| Z velocity of the player being pushed by the explosion
 
|}
 
  
==== Unload Chunk ====
+
==== Entity Effect ====
 
+
{| class="wikitable"
Tells the client to unload a chunk column.
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=4 | 0x1D || rowspan=4 | Play || rowspan=4 | Client
 +
| Entity ID || Int || Entity's ID
 +
|-
 +
| Effect ID || Byte || See [[http://www.minecraftwiki.net/wiki/Potion_effect#Parameters]]
 +
|-
 +
| Amplifier || Byte ||
 +
|-
 +
| Duration || Short ||
 +
|}
  
 +
==== Remove Entity Effect ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x1E || rowspan=2 | Play || rowspan=2 | Client
! Field Name
+
| Entity ID || Int || Entity's ID
! Field Type
+
|-
! Notes
+
| Effect ID || Byte ||
|-
+
|}
|rowspan="2"| 0x1D
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Chunk X
 
| Int
 
| Block coordinate divided by 16, rounded down
 
|-
 
| Chunk Z
 
| Int
 
| Block coordinate divided by 16, rounded down
 
|}
 
  
==== Change Game State ====
+
==== Set Experience ====
  
Used for a wide variety of game state things, from weather to bed use to game mode to demo messages.
+
Sent by the server when the client should change experience levels.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=3 | 0x1F || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| Experience bar || Float || Between 0 and 1
! Field Type
+
|-
! Notes
+
| Level || Short ||
|-
+
|-
|rowspan="2"| 0x1E
+
| Total Experience || Short ||
|rowspan="2"| Play
+
|}
|rowspan="2"| Client
 
| Reason
 
| Unsigned Byte
 
| See below
 
|-
 
| Value
 
| Float
 
| Depends on Reason
 
|}
 
  
''Reason codes'':
+
==== Entity Properties ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=3 | 0x20 || rowspan=3 | Play || rowspan=3 | Client
 +
| Entity ID || Int || Entity's ID
 +
|-
 +
| Count || Int || Length of following array
 +
|-
 +
| Properties || Array of Property Data ||
 +
|}
  
 +
'''Property Data''' structure:
 
{| class="wikitable"
 
{| class="wikitable"
! Reason
+
|-
! Effect
+
! Field Name !! Field Type !! Notes
! Value
+
|-
|-
+
| Key || String ||  
| 0
+
|-
| Invalid Bed
+
| Value || Double ||  
| Would be used to switch between messages, but the only used message is 0 for invalid bed
+
|-
|-
+
| List Length || Short || Number of list elements that follow.
| 1
+
|-
| End raining
+
| Modifiers || Array of Modifier Data || http://www.minecraftwiki.net/wiki/Attribute#Modifiers
|  
+
|}
|-
 
| 2
 
| Begin raining
 
|  
 
|-
 
| 3
 
| Change game mode
 
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 
|-
 
| 4
 
| Exit end
 
| 0: Immediately send Client Status of respawn without showing end credits; 1: Show end credits and respawn at the end (or when esc is pressed).  1 is sent if the player has not yet received the "The end?" achievement, while if they do have it 0 is used.
 
|-
 
| 5
 
| Demo message
 
| 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
 
|-
 
| 6
 
| Arrow hitting player
 
| Appears to be played when an arrow strikes another player in Multiplayer
 
|-
 
| 7
 
| Fade value
 
| The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
 
|-
 
| 8
 
| Fade time
 
| Time in ticks for the sky to fade
 
|-
 
| 10
 
| Play elder guardian mob appearance (effect and sound)
 
|
 
|}
 
  
==== Keep Alive (clientbound) ====
+
Known key values:
 
+
{| class="wikitable"
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.
+
|-
 +
! Key !! Default !! Min !! Max !! Label
 +
|-
 +
| generic.maxHealth || 20.0 || 0.0 || Double.MaxValue || Max Health
 +
|-
 +
| generic.followRange || 32.0 || 0.0 || 2048.0 || Follow Range
 +
|-
 +
| generic.knockbackResistance || 0.0 || 0.0 || 1.0 || Knockback Resistance
 +
|-
 +
| generic.movementSpeed || 0.699999988079071 || 0.0 || Double.MaxValue || Movement Speed
 +
|-
 +
| generic.attackDamage || 2.0 || 0.0 || Double.MaxValue ||
 +
|-
 +
| horse.jumpStrength || 0.7 || 0.0 || 2.0 || Jump Strength
 +
|-
 +
| zombie.spawnReinforcements || 0.0 || 0.0 || 1.0 || Spawn Reinforcements Chance
 +
|}
  
 +
'''Modifier Data''' structure:
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
|-
! State
+
! Field Name !! Field Type !! Notes
! Bound To
+
|-
! Field Name
+
| UUID || 128-bit integer ||
! Field Type
+
|-
! Notes
+
| Amount || Double ||
|-
+
|-
|rowspan="1"| 0x1F
+
| Operation || Byte ||
|rowspan="1"| Play
+
|}
|rowspan="1"| Client
 
| Keep Alive ID
 
| VarInt
 
|  
 
|}
 
  
 
==== Chunk Data ====
 
==== Chunk Data ====
{{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).
+
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]]
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=7 | 0x21 || rowspan=7 | Play || rowspan=7 | Client
! Field Name
+
| Chunk X || Int || Chunk X coordinate
! Field Type
+
|-
! Notes
+
| Chunk Z || Int || Chunk Z coordinate
|-
+
|-
|rowspan="9"| 0x20
+
| Ground-Up continuous || Boolean || This is True if the packet represents all sections in this vertical column, where the primary bit map specifies exactly which sections are included, and which are air
|rowspan="9"| Play
+
|-
|rowspan="9"| Client
+
| Primary bit map || Unsigned Short || Bitmask with 1 for every 16x16x16 section which data follows in the compressed data.
| Chunk X
+
|-
| Int
+
| Add bit map || Unsigned Short || Same as above, but this is used exclusively for the 'add' portion of the payload
| Block coordinate divided by 16, rounded down
+
|-  
|-
+
| Compressed size || Int || Size of compressed chunk data
| Chunk Z
+
|-
| Int
+
| Compressed data || Byte array || The chunk data is compressed using Zlib Deflate
| Block coordinate divided by 16, rounded down
+
|}
|-
 
| Ground-Up Continuous
 
| Boolean
 
| This is true if the packet represents all chunk sections in this vertical chunk column, where the Primary Bit Mask specifies exactly which chunk sections are included, and which are air.
 
|-
 
| Primary Bit Mask
 
| VarInt
 
| Bitmask with bits set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
 
|-  
 
| Size
 
| VarInt
 
| Size of Data in bytes, plus size of Biomes in bytes if present
 
|-
 
| Data
 
| Array of [[SMP Map Format|Chunk Section]]
 
| The length of the array is equal to the number of bits set in Primary Bit Mask. Chunks are sent bottom-to-top, i.e. the first chunk, if sent, extends from Y=0 to Y=15.
 
|-
 
| Biomes
 
| Optional Byte Array
 
| Only if Ground-Up Continuous: biome array, byte per XZ coordinate, 256 bytes total.
 
|-
 
| Number of block entities
 
| VarInt
 
| Length of the following array
 
|-
 
| Block entities
 
| Array of [[NBT|NBT Tag]]
 
| All block entities in the chunk.  Use the x, y, and z tags in the NBT to determine their positions.
 
|}
 
 
 
==== Effect ====
 
 
 
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.
 
  
 +
==== Multi Block Change ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=5 | 0x22 || rowspan=5 | Play || rowspan=5 | Client
! Field Name
+
| Chunk X || Int || Chunk X coordinate
! Field Type
+
|-
! Notes
+
| Chunk Z || Int || Chunk Z Coordinate
|-
+
|-
|rowspan="4"| 0x21
+
| Record count || Short || The number of blocks affected
|rowspan="4"| Play
+
|-
|rowspan="4"| Client
+
| Data size || Int || The total size of the data, in bytes. Should always be 4*record count
| Effect ID
+
|-
| Int
+
| Records || Array of Records ||  
| The ID of the effect, see below
+
|}
|-
 
| Location
 
| Position
 
| The location of the effect
 
|-
 
| Data
 
| Int
 
  | Extra data for certain effects, see below
 
|-
 
| Disable Relative Volume
 
| Boolean
 
| See above
 
|}
 
 
 
Effect IDs:
 
  
 +
'''Record'''
 
{| class="wikitable"
 
{| class="wikitable"
! ID
+
|-
! Name
+
! Bit mask !! Width !! Meaning
! Data
+
|-
|-
+
| 00 00 00 0F || 4 bits || Block metadata
!colspan="3"| Sound
+
|-
|-
+
| 00 00 FF F0 || 12 bits || Block ID
| 1000
+
|-
| Dispenser dispenses
+
| 00 FF 00 00 || 8 bits || Y co-ordinate
|  
+
|-
|-
+
| 0F 00 00 00 || 4 bits || Z co-ordinate, relative to chunk
| 1001
+
|-
| Dispenser fails to dispense
+
| F0 00 00 00 || 4 bits || X co-ordinate, relative to chunk
|
+
|}
|-
 
| 1002
 
| Dispenser shoots
 
|
 
|-
 
| 1003
 
| Ender eye launched
 
|  
 
|-
 
| 1004
 
| Firework shot
 
|
 
|-
 
| 1005
 
| Iron door opened
 
|
 
|-
 
| 1006
 
| Wooden door opened
 
|
 
|-
 
| 1007
 
| Wooden trapdoor opened
 
|
 
|-
 
| 1008
 
| Fence gate opened
 
|
 
|-
 
| 1009
 
| Fire extinguished
 
|
 
|-
 
| 1010
 
| Play record
 
| {{Minecraft Wiki|Music Discs|Record ID}}
 
|-
 
| 1011
 
| Iron door closed
 
|
 
|-
 
| 1012
 
| Wooden door closed
 
|
 
|-
 
| 1013
 
| Wooden trapdoor closed
 
|  
 
|-
 
| 1014
 
| Fence gate closed
 
|
 
|-
 
| 1015
 
| Ghast warns
 
|
 
|-
 
| 1016
 
| Ghast shoots
 
|
 
|-
 
| 1017
 
| Enderdragon shoots
 
|  
 
|-
 
| 1018
 
| Blaze shoots
 
|
 
|-
 
| 1019
 
| Zombie attacks wood door
 
|
 
|-
 
| 1020
 
| Zombie attacks iron door
 
|
 
|-
 
| 1021
 
| Zombie breaks wood door
 
|
 
|-
 
| 1022
 
| Wither breaks block
 
|
 
|-
 
| 1023
 
| Wither spawned
 
|
 
|-
 
| 1024
 
| Wither shoots
 
|
 
|-
 
| 1025
 
| Bat takes off
 
|
 
|-
 
| 1026
 
| Zombie infects
 
|
 
|-
 
| 1027
 
| Zombie villager converted
 
|
 
|-
 
| 1028
 
| Ender dragon death
 
|
 
|-
 
| 1029
 
| Anvil destroyed
 
|
 
|-
 
| 1030
 
| Anvil used
 
|
 
|-
 
| 1031
 
| Anvil landed
 
|
 
|-
 
| 1032
 
| Portal travel
 
|
 
|-
 
| 1033
 
| Chorus flower grown
 
|
 
|-
 
| 1034
 
| Chorus flower died
 
|
 
|-
 
| 1035
 
| Brewing stand brewed
 
|
 
|-
 
| 1036
 
| Iron trapdoor opened
 
|
 
|-
 
| 1037
 
| Iron trapdoor closed
 
|
 
|-
 
!colspan="3"| Particle
 
|-
 
| 2000
 
| Spawns 10 smoke particles, e.g. from a fire
 
| Direction, see below
 
|-
 
| 2001
 
| Block break + block break sound
 
| {{Minecraft Wiki|Data values|Block ID}}
 
|-
 
| 2002
 
| Splash potion. Particle effect + glass break sound.
 
| [http://minecraft.gamepedia.com/Data_values#Potions Potion ID]
 
|-
 
| 2003
 
| Eye of Ender entity break animation — particles and sound
 
|
 
|-
 
| 2004
 
| Mob spawn particle effect: smoke + flames
 
|
 
|-
 
| 2005
 
| Bonemeal particles
 
| How many particles to spawn (if set to 0, 15 are spawned)
 
|-
 
| 2006
 
| Dragon breath
 
|
 
|-
 
| 3000
 
| End gateway spawn
 
|
 
|-
 
| 3001
 
| Enderdragon growl
 
|
 
|}
 
 
 
Smoke directions:
 
  
 +
==== Block Change ====
 
{| class="wikitable"
 
{| class="wikitable"
! ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Direction
+
|-
|-
+
| rowspan=5 | 0x23 || rowspan=5 | Play || rowspan=5 | Client
| 0
+
| X || Int || Block X Coordinate
| South-East
+
|-
|-
+
| Y || Unsigned Byte || Block Y Coordinate
| 1
+
|-
| South
+
| Z || Int || Block Z Coordinate
|-
+
|-
| 2
+
| Block ID || VarInt || The new block ID for the block
| South-West
+
|-
|-
+
| Block Metadata || Unsigned Byte || The new metadata for the block
| 3
+
|}
| East
 
|-
 
| 4
 
| (Up or middle ?)
 
|-
 
| 5
 
| West
 
|-
 
| 6
 
| North-East
 
|-
 
| 7
 
| North
 
|-
 
| 8
 
| North-West
 
|}
 
  
==== Particle ====
+
==== Block Action ====
  
Displays the named particle
+
This packet is used for a number of things:
 +
* Chests opening and closing
 +
* Pistons pushing and pulling
 +
* Note blocks playing
  
{| class="wikitable"
+
See Also: [[Block Actions]]
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="11"| 0x22
 
|rowspan="11"| Play
 
|rowspan="11"| Client
 
| Particle ID
 
| Int
 
| See below
 
|-
 
| Long Distance
 
| Boolean
 
| If true, particle distance increases from 256 to 65536
 
|-
 
| X
 
| Float
 
| X position of the particle
 
|-
 
| Y
 
| Float
 
| Y position of the particle
 
|-
 
| Z
 
| Float
 
| Z position of the particle
 
|-
 
| Offset X
 
| Float
 
| This is added to the X position after being multiplied by random.nextGaussian()
 
|-
 
| Offset Y
 
| Float
 
| This is added to the Y position after being multiplied by random.nextGaussian()
 
|-
 
| Offset Z
 
| Float
 
| This is added to the Z position after being multiplied by random.nextGaussian()
 
|-
 
| Particle Data
 
| Float
 
| The data of each particle
 
|-
 
| Particle Count
 
| Int
 
| The number of particles to create
 
|-
 
| Data
 
| Array of VarInt
 
| Length depends on particle. "iconcrack" has length of 2, "blockcrack", and "blockdust" have lengths of 1, the rest have 0.
 
|}
 
 
 
Particle IDs:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Particle Name
+
|-
! Particle ID
+
| rowspan=6 | 0x24 || rowspan=6 | Play || rowspan=6 | Client
|-
+
| X || Int || Block X Coordinate
| explode
+
|-
| 0
+
| Y || Short || Block Y Coordinate
|-
+
|-
| largeexplosion
+
| Z || Int || Block Z Coordinate
| 1
+
|-
|-
+
| Byte 1 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
| hugeexplosion
+
|-
| 2
+
| Byte 2 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
|-
+
|-
| fireworksSpark
+
| Block Type || VarInt || The block type for the block
| 3
+
|}
|-
 
| bubble
 
| 4
 
|-
 
| splash
 
| 5
 
|-
 
| wake
 
| 6
 
|-
 
| suspended
 
| 7
 
|-
 
| depthsuspend
 
| 8
 
|-
 
| crit
 
| 9
 
|-
 
| magicCrit
 
| 10
 
|-
 
| smoke
 
| 11
 
|-
 
| largesmoke
 
| 12
 
|-
 
| spell
 
| 13
 
|-
 
| instantSpell
 
| 14
 
|-
 
| mobSpell
 
| 15
 
|-
 
| mobSpellAmbient
 
| 16
 
|-
 
| witchMagic
 
| 17
 
|-
 
| dripWater
 
| 18
 
|-
 
| dripLava
 
| 19
 
|-
 
| angryVillager
 
| 20
 
|-
 
| happyVillager
 
| 21
 
|-
 
| townaura
 
| 22
 
|-
 
| note
 
| 23
 
|-
 
| portal
 
| 24
 
|-
 
| enchantmenttable
 
| 25
 
|-
 
| flame
 
| 26
 
|-
 
| lava
 
| 27
 
|-
 
| footstep
 
| 28
 
|-
 
| cloud
 
| 29
 
|-
 
| reddust
 
| 30
 
|-
 
| snowballpoof
 
| 31
 
|-
 
| snowshovel
 
| 32
 
|-
 
| slime
 
| 33
 
|-
 
| heart
 
| 34
 
|-
 
| barrier
 
| 35
 
|-
 
| iconcrack_(id)_(data)
 
| 36
 
|-
 
| blockcrack_(id+(data<<12))
 
| 37
 
|-
 
| blockdust_(id)
 
| 38
 
|-
 
| droplet
 
| 39
 
|-
 
| take
 
| 40
 
|-
 
| mobappearance
 
| 41
 
|-
 
| dragonbreath
 
| 42
 
|-
 
| endrod
 
| 43
 
|-
 
| damageindicator
 
| 44
 
|-
 
| sweepattack
 
| 45
 
|}
 
  
==== Join Game ====
+
==== Block Break Animation ====
  
See [[Protocol Encryption]] for information on logging in.
+
0-9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
  
{| class="wikitable"
+
You can also set an animation to air! The animation will still be visible.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="7"| 0x23
 
|rowspan="7"| Play
 
|rowspan="7"| Client
 
| Entity ID
 
| Int
 
| The player's Entity ID (EID)
 
|-
 
| Gamemode
 
| Unsigned Byte
 
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
 
|-
 
| Dimension
 
| Int Enum
 
| -1: Nether, 0: Overworld, 1: End; also, note that this is not a VarInt but instead a regular int.
 
|-
 
| Difficulty
 
| Unsigned Byte
 
| 0: peaceful, 1: easy, 2: normal, 3: hard
 
|-
 
| Max Players
 
| Unsigned Byte
 
| Was once used by the client to draw the player list, but now is ignored
 
|-
 
| Level Type
 
| String
 
| default, flat, largeBiomes, amplified, default_1_1
 
|-
 
| Reduced Debug Info
 
| Boolean
 
| If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}.
 
|}
 
  
==== Map ====
+
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
  
Updates a rectangular area on a {{Minecraft Wiki|map}} item.
+
Also if you set the coordinates to a special block like water, it won't show the actual break animation, but some other interesting effects. (Water will lose its transparency)
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=5 | 0x25 || rowspan=5 | Play || rowspan=5 | Client
!colspan="2"| Field Name
+
| Entity ID || VarInt || Entity's ID
!colspan="2"| Field Type
+
|-
! Notes
+
| X || Int || rowspan=3 | Block Position
|-
+
|-
|rowspan="13"| 0x24
+
| Y || Int
|rowspan="13"| Play
+
|-
|rowspan="13"| Client
+
| Z || Int
|colspan="2"| Item Damage
+
|-
|colspan="2"| VarInt
+
| Destroy Stage || Byte || 0 - 9
| The damage value (map ID) of the map being modified
+
|}
|-
 
|colspan="2"| Scale
 
|colspan="2"| Byte
 
| From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
 
|-
 
|colspan="2"| Tracking Position
 
|colspan="2"| Boolean
 
| Specifies whether the icons are shown
 
|-
 
|colspan="2"| Icon Count
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
|-
 
|rowspan="3"| Icon
 
| Direction And Type
 
|rowspan="3"| Array
 
| Byte
 
| 0xF0 = Direction, 0x0F = Type
 
|-
 
| X
 
| Byte
 
|  
 
|-
 
| Z
 
| Byte
 
|
 
|-
 
|colspan="2"| Columns
 
|colspan="2"| Byte
 
| Number of columns updated
 
|-
 
|colspan="2"| Rows
 
|colspan="2"| Optional Byte
 
| Only if Columns is more than 0; number of rows updated
 
|-
 
|colspan="2"| X
 
|colspan="2"| Optional Byte
 
| Only if Columns is more than 0; x offset of the westernmost column
 
|-
 
|colspan="2"| Z
 
|colspan="2"| Optional Byte
 
| Only if Columns is more than 0; z offset of the northernmost row
 
|-
 
|colspan="2"| Length
 
|colspan="2"| Optional VarInt
 
| Only if Columns is more than 0; length of the following array
 
|-
 
|colspan="2"| Data
 
|colspan="2"| Optional Array of Unsigned Byte
 
| Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}}
 
|}
 
  
==== Entity Relative Move ====
+
==== Map Chunk Bulk ====
  
This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Entity Teleport|Entity Teleport]] ([[#Play|Play]], 0x4A, clientbound) should be sent instead.
+
See also: [[SMP Map Format]]
  
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.
+
To reduce the number of bytes this packet is used to send chunks together for better compression results.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=5 | 0x26 || rowspan=5 | Play || rowspan=5 | Client
! Field Name
+
| Chunk column count || Short || The number of chunk in this packet
! Field Type
+
|-
! Notes
+
| Data length || Int || The size of the data field
|-
+
|-
|rowspan="5"| 0x25
+
| Sky light sent || Bool || Whether or not the chunk data contains a light nibble array. This is true in the main world, false in the end + nether
|rowspan="5"| Play
+
|-
|rowspan="5"| Client
+
| Data || Byte Array || Compressed chunk data
| Entity ID
+
|-
| VarInt
+
| Meta information || Meta || See below
|  
+
|}
|-
 
| Delta X
 
| Short
 
| Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
 
|-
 
| Delta Y
 
| Short
 
| Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
 
|-
 
| Delta Z
 
| Short
 
| Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 
|-
 
| On Ground
 
| Boolean
 
|  
 
|}
 
  
==== Entity Look And Relative Move ====
+
'''Meta'''
 +
{| class="wikitable"
 +
! Field Name !! Field Type !! Notes
 +
|-
 +
|Chunk X || Int || The X Coordinate of the chunk
 +
|-
 +
|Chunk Z || Int || The Z Coordinate of the chunk
 +
|-
 +
|Primary bitmap || Unsigned Short || A bitmap which specifies which sections are not empty in this chunk
 +
|-
 +
|Add bitmap || Unsigned Short || A bitmap which specifies which sections need add information because of very high block ids. not yet used
 +
|}
  
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>)
+
==== Explosion ====
  
{| class="wikitable"
+
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="7"| 0x26
 
|rowspan="7"| Play
 
|rowspan="7"| Client
 
| Entity ID
 
| VarInt
 
|
 
|-
 
| Delta X
 
| Short
 
| Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>
 
|-
 
| Delta Y
 
| Short
 
| Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>
 
|-
 
| Delta Z
 
| Short
 
| Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>
 
|-
 
| Yaw
 
| Angle
 
| New angle, not a delta
 
|-
 
| Pitch
 
| Angle
 
| New angle, not a delta
 
|-
 
| On Ground
 
| Boolean
 
|
 
|}
 
  
==== Entity Look ====
+
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 
 
This packet is sent by the server when an entity rotates.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="9" | 0x27 || rowspan=9 | Play || rowspan=9 | Client
! Field Name
+
| X || Float ||
! Field Type
+
|-
! Notes
+
| Y || Float ||
|-
+
|-
|rowspan="4"| 0x27
+
| Z || Float ||
|rowspan="4"| Play
+
|-
|rowspan="4"| Client
+
| Radius || Float || Currently unused in the client
| Entity ID
+
|-
| VarInt
+
| Record count || Int || This is the count, not the size. The size is 3 times this value.
|  
+
|-
|-
+
| Records || (Byte, Byte, Byte) × count || Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
| Yaw
+
|-
| Angle
+
| Player Motion X || Float || X velocity of the player being pushed by the explosion
| New angle, not a delta
+
|-
|-
+
| Player Motion Y || Float || Y velocity of the player being pushed by the explosion
| Pitch
+
|-
| Angle
+
| Player Motion Z || Float || Z velocity of the player being pushed by the explosion
| New angle, not a delta
+
|}
|-
 
| On Ground
 
| Boolean
 
|  
 
|}
 
  
==== Entity ====
+
==== Effect ====
  
This packet may be used to initialize an entity.
+
Sent when a client is to play a sound or particle effect.
  
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.
+
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 effects 1013 and 1018 (mob.wither.spawn and mob.enderdragon.end, respectively), and is ignored for any other value by the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="6" | 0x28 || rowspan=6 | Play || rowspan=6 | Client
! Field Name
+
| Effect ID || Int || The ID of the effect, see below.
! Field Type
+
|-
! Notes
+
| X || Int || The X location of the effect
|-
+
|-
|rowspan="1"| 0x28
+
| Y || Byte || The Y location of the effect
|rowspan="1"| Play
+
|-
|rowspan="1"| Client
+
| Z || Int || The Z location of the effect
| Entity ID
+
|-
| VarInt
+
| Data || Int || Extra data for certain effects, see below.
|  
+
|-
|}
+
| Disable relative volume || Bool || See above
 +
|}
  
==== Vehicle Move (clientbound) ====
+
===== Effects =====
 
 
Note that all fields use absolute positioning and do not allow for relative positioning.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! ID !! Name
! State
+
|-
! Bound To
+
| colspan=2 | '''Sound'''
! Field Name
+
|-
! Field Type
+
| 1000|| <code>random.click</code>
! Notes
+
|-
|-
+
| 1001|| <code>random.click</code>
|rowspan="7"| 0x29
+
|-
|rowspan="7"| Play
+
| 1002|| <code>random.bow</code>
|rowspan="7"| Client
+
|-
| X
+
| 1003|| <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
| Double
+
|-
| Absolute position (X coordinate)
+
| 1004|| <code>random.fizz</code>
|-
+
|-
| Y
+
| 1005|| Play a music disc. '''Data''' [http://www.minecraftwiki.net/wiki/Music_Discs Record ID]
| Double
+
|-
| Absolute position (Y coordinate)
+
| ''(1006 not assigned)'' ||
|-
+
|-
| Z
+
| 1007|| <code>mob.ghast.charge</code>
| Double
+
|-
| Absolute position (Z coordinate)
+
| 1008|| <code>mob.ghast.fireball</code>
|-
+
|-
| Yaw
+
| 1009|| <code>mob.ghast.fireball</code>, but with a lower volume.
| Float
+
|-
| Absolute rotation on the vertical axis, in degrees
+
| 1010|| <code>mob.zombie.wood</code>
|-
+
|-
| Pitch
+
| 1011|| <code>mob.zombie.metal</code>
| Float
+
|-
| Absolute rotation on the horizontal axis, in degrees
+
| 1012|| <code>mob.zombie.woodbreak</code>
|}
+
|-
 +
| 1013|| <code>mob.wither.spawn</code>
 +
|-
 +
| 1014|| <code>mob.wither.shoot</code>
 +
|-
 +
| 1015|| <code>mob.bat.takeoff</code>
 +
|-
 +
| 1016|| <code>mob.zombie.infect</code>
 +
|-
 +
| 1017|| <code>mob.zombie.unfect</code>
 +
|-
 +
| 1018|| <code>mob.enderdragon.end</code>
 +
|-
 +
| 1020|| <code>random.anvil_break</code>
 +
|-
 +
| 1021|| <code>random.anvil_use</code>
 +
|-
 +
| 1022|| <code>random.anvil_land</code>
 +
|-
 +
| colspan=2 | '''Particle'''
 +
|-
 +
| 2000|| Spawns 10 smoke particles, e.g. from a fire. '''Data''' direction, see below
 +
|-
 +
| 2001|| Block break. '''Data''' [http://www.minecraftwiki.net/wiki/Data_values Block ID]
 +
|-
 +
| 2002|| Splash potion. Particle effect + glass break sound. '''Data''' [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
 +
|-
 +
| 2003|| Eye of ender entity break animation - particles and sound
 +
|-
 +
| 2004|| Mob spawn particle effect: smoke + flames
 +
|-
 +
| 2005|| Spawn "happy villager" effect (green crosses), used for bonemealing vegetation.
 +
|-
 +
| 2006|| Spawn fall particles (when player hits ground). '''Data''' fall damage taken for particle speed
 +
|}
  
==== Open Sign Editor ====
+
Smoke directions:
 
 
Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]].
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! ID !! Direction
! State
+
|-
! Bound To
+
| 0 || South - East
! Field Name
+
|-
! Field Type
+
| 1 || South
! Notes
+
|-
|-
+
| 2 || South - West
|rowspan="1"| 0x2A
+
|-
|rowspan="1"| Play
+
| 3 || East
|rowspan="1"| Client
+
|-
| Location
+
| 4 || (Up or middle ?)
| Position
+
|-
|  
+
| 5 || West
|}
+
|-
 +
| 6 || North - East
 +
|-
 +
| 7 || North
 +
|-
 +
| 8 || North - West
 +
|}
  
==== Player Abilities (clientbound) ====
+
==== Sound Effect ====
  
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.
+
Used to play a sound effect on the client.
  
{| class="wikitable"
+
All known sound effect names can be seen [https://github.com/SirCmpwn/Craft.Net/blob/master/source/Craft.Net.Common/SoundEffect.cs here].
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="3"| 0x2B
 
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Flags
 
| Byte
 
| Bit field, see below
 
|-
 
| Flying Speed
 
| Float
 
|
 
|-
 
| Field of View Modifier
 
| Float
 
| Modifies the field of view, like a speed potion. A Notchian server will use the same value as the movement speed (send in the [[Protocol#Entity_Properties|Entity Properties]] packet).
 
|}
 
  
About the flags:
+
Custom sounds may be added by resource packs
  
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Field
+
|-
! Bit
+
| rowspan="6" | 0x29 || rowspan=6 | Play || rowspan=6 | Client
|-
+
| Sound name || String ||
| Invulnerable
+
|-
| 0x01
+
| Effect position X || Int || Effect X multiplied by 8
|-
+
|-
| Flying
+
| Effect position Y || Int || Effect Y multiplied by 8
| 0x02
+
|-
|-
+
| Effect position Z || Int || Effect Z multiplied by 8
| Allow Flying
+
|-
| 0x04
+
| Volume || Float || 1 is 100%, can be more
|-
+
|-
| Creative Mode
+
| Pitch || Unsigned Byte || 63 is 100%, can be more
| 0x08
+
|}
|}
 
  
==== Combat Event ====
+
==== Particle ====
  
{| class="wikitable"
+
Displays the named particle
! Packet ID
 
! State
 
! Bound To
 
!colspan="2"| Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="8"| 0x2C
 
|rowspan="8"| Play
 
|rowspan="8"| Client
 
|colspan="2"| Event
 
| VarInt Enum
 
| 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
 
|
 
|-
 
| Entity ID
 
| Int
 
|
 
|-
 
| Message
 
| [[Chat]]
 
|
 
|}
 
 
 
==== Player List Item ====
 
 
 
Sent by the server to update the user list (<tab> in the client).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="9" | 0x2A || rowspan=9 | Play || rowspan=9 | Client
!colspan="4"| Field Name
+
| Particle name || String || The name of the particle to create. A list can be found [https://gist.github.com/thinkofdeath/5110835 here]
!colspan="3"| Field Type
+
|-
! Notes
+
| X || Float || X position of the particle
|-
+
|-
|rowspan="19"| 0x2D
+
| Y || Float || Y position of the particle
|rowspan="19"| Play
+
|-
|rowspan="19"| Client
+
| Z || Float || Z position of the particle
|colspan="4"| Action
+
|-
|colspan="3"| VarInt
+
| Offset X || Float || This is added to the X position after being multiplied by random.nextGaussian()
| Determines the rest of the Player format after the UUID
+
|-
|-
+
| Offset Y || Float || This is added to the Y position after being multiplied by random.nextGaussian()
|colspan="4"| Number Of Players
+
|-
|colspan="3"| VarInt
+
| Offset Z || Float || This is added to the Z position after being multiplied by random.nextGaussian()
| Number of elements in the following array
+
|-
|-
+
| Particle data || Float || The data of each particle
|rowspan="17"| Player
+
|-
|colspan="3"| UUID
+
| Number of particles || Int || The number of particles to create
|rowspan="17"| Array
+
|}
|colspan="2"| UUID
 
|
 
|-
 
! Action
 
!colspan="2"| Field Name
 
!colspan="2"|
 
!
 
|-
 
|rowspan="10"| 0: add player
 
|colspan="2"| Name
 
|colspan="2"| String
 
|
 
|-
 
|colspan="2"| Number Of Properties
 
|colspan="2"| VarInt
 
| Number of elements in the following array
 
|-
 
|rowspan="4"| Property
 
| Name
 
|rowspan="4"| Array
 
| String
 
|  
 
|-
 
| Value
 
| String
 
|  
 
|-
 
| Is Signed
 
| Boolean
 
|
 
|-
 
| Signature
 
| Optional String
 
| Only if Is Signed is true
 
|-
 
|colspan="2"| Gamemode
 
|colspan="2"| VarInt
 
|  
 
|-
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
|
 
|-
 
|colspan="2"| Has Display Name
 
|colspan="2"| Boolean
 
|
 
|-
 
|colspan="2"| Display Name
 
|colspan="2"| Optional [[Chat]]
 
| Only if Has Display Name is true
 
|-
 
| 1: update gamemode
 
|colspan="2"| Gamemode
 
|colspan="2"| VarInt
 
|  
 
|-  
 
| 2: update latency
 
|colspan="2"| Ping
 
|colspan="2"| VarInt
 
|  
 
|-
 
|rowspan="2"| 3: update display name
 
|colspan="2"| Has Display Name
 
|colspan="2"| Boolean
 
|
 
|-
 
|colspan="2"| Display Name
 
|colspan="2"| Optional [[Chat]]
 
| Only send if Has Display Name is true
 
|-
 
| 4: remove player
 
|colspan="2"| ''no fields''
 
|colspan="2"| ''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.
+
==== Change Game State ====
  
==== Player Position And Look (clientbound) ====
+
It appears when a bed can't be used as a spawn point and when the rain state changes.
  
Updates the player's position on the server. This packet will also close the “Downloading Terrain” screen when joining/respawning.
+
The class has an array of strings linked to reason codes 0, 1, 2, and 3 but only the codes for 1 and 2 are null.
  
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 meters, the client will be kicked for “You moved too quickly :( (Hacking?)”.
+
{| class="wikitable"
 
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
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”.
+
|-
 
+
| rowspan="2" | 0x2B || rowspan=2 | Play || rowspan=2 | Client
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.
+
| Reason || Unsigned Byte ||
 +
|-
 +
| Value || Float || Depends on reason
 +
|}
  
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
+
'''Reason codes'''
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Code !! Effect !! Notes
! State
+
|-
! Bound To
+
| 0 || Invalid Bed || "tile.bed.notValid"
! Field Name
+
|-
! Field Type
+
| 1 || End raining ||  
! Notes
+
|-
|-
+
| 2 || Begin raining ||  
|rowspan="7"| 0x2E
+
|-
|rowspan="7"| Play
+
| 3 || Change game mode || "gameMode.changed" 0 - Survival, 1 - Creative, 2 - Adventure
|rowspan="7"| Client
+
|-
| X
+
| 4 || Enter credits ||
| Double
+
|-
| Absolute or relative position, depending on Flags
+
| 5 || Demo messages || 0 - Show welcome to demo screen, 101 - Tell movement controls, 102 - Tell jump control, 103 - Tell inventory control
|-
+
|-  
| Y
+
| 6 || Arrow hitting player || Appears to be played when an arrow strikes another player in Multiplayer
| Double
+
|-
| Absolute or relative position, depending on Flags
+
| 7 || Fade value || The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
|-
+
|-
| Z
+
| 8 || Fade time || Time in ticks for the sky to fade
| Double
+
|}
| Absolute or relative position, depending on Flags
 
|-
 
| Yaw
 
| Float
 
| Absolute or relative rotation on the X axis, in degrees
 
|-
 
| Pitch
 
| Float
 
| Absolute or relative rotation on the Y axis, in degrees
 
|-
 
| Flags
 
| Byte
 
| Bit field, see below
 
|-
 
| Teleport ID
 
| VarInt
 
| Client should confirm this packet with [[#Teleport Confirm|Teleport Confirm]] containing the same Teleport ID
 
|}
 
  
About the Flags field:
+
==== Spawn Global Entity ====
  
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
+
With this packet, the server notifies the client of thunderbolts striking within a 512 block radius around the player. The coordinates specify where exactly the thunderbolt strikes.
  
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Field
+
|-
! Bit
+
| rowspan="5" | 0x2C || rowspan=5 | Play || rowspan=5 | Client
|-
+
| Entity ID || VarInt || The entity ID of the thunderbolt
| X
+
|-
| 0x01
+
| Type || Byte || The global entity type, currently always 1 for thunderbolt.
|-
+
|-
| Y
+
| X || Int || Thunderbolt X a [[Data_Types#Fixed-point_numbers|fixed-point number]]
| 0x02
+
|-
|-
+
| Y || Int || Thunderbolt Y a [[Data_Types#Fixed-point_numbers|fixed-point number]]
| Z
+
|-
| 0x04
+
| Z || Int || Thunderbolt Z a [[Data_Types#Fixed-point_numbers|fixed-point number]]
|-
+
|}
| Y_ROT
 
| 0x08
 
|-
 
| X_ROT
 
| 0x10
 
|}
 
  
==== Use Bed ====  
+
==== Open Window ====
  
This packet tells that a player goes to bed.
+
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.
 
 
The client with the matching Entity ID will go into bed mode.
 
 
 
This Packet is sent to all nearby players including the one sent to bed.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="6" | 0x2D || rowspan=6 | Play || rowspan=6 | Client
! Field Name
+
| Window id || Unsigned Byte || A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
! Field Type
+
|-
! Notes
+
| Inventory Type || Unsigned Byte || The window type to use for display. Check below
|-
+
|-
|rowspan="2"| 0x2F
+
| Window title || String || The title of the window.
|rowspan="2"| Play
+
|-
|rowspan="2"| Client
+
| Number of Slots || Unsigned Byte || Number of slots in the window (excluding the number of slots in the player inventory).
  | Entity ID
+
|-
  | VarInt
+
| Use provided window title || Bool || If false, the client will look up a string like "window.minecart". If true, the client uses what the server provides.
| Sleeping player's EID
+
|-
|-
+
| Entity ID || Int || EntityHorse's entityId. Only sent when window type is equal to 11 (AnimalChest).
| Location
+
|}
| Position
 
| Block location of the head part of the bed
 
|}
 
 
 
==== Destroy Entities ====
 
  
Sent by the server when a list of entities is to be destroyed on the client.
+
See [[Inventory#Windows|inventory windows]] for further information.
  
{| class="wikitable"
+
==== Close Window ====
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x30
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Entity IDs
 
| Array of VarInt
 
| The list of entities of destroy
 
|}
 
  
==== Remove Entity Effect ====
+
This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x31
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
|
 
|-
 
| Effect ID
 
| Byte
 
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 
|}
 
  
==== Resource Pack Send ====
+
Note, notchian clients send a close window message with window id 0 to close their inventory even though there is never an Open Window message for inventory.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| 0x2E || rowspan=1 | Play || rowspan=1 | Client
! Field Name
+
| Window ID || Unsigned Byte || This is the id of the window that was closed. 0 for inventory.
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="2"| 0x32
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| URL
 
| String
 
| The URL to the resource pack.
 
|-
 
| Hash
 
| String
 
| A 40 character hexadecimal and lowercase [[wikipedia:SHA-1|SHA-1]] hash of the resource pack file. (must be lower case in order to work)<br />If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth — but it will still treat it as a unique id
 
|}
 
  
==== Respawn ====
+
==== Set Slot ====
  
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.
+
Sent by the server when an item in a slot (in a window) is added/removed.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x2F || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| Window ID || Byte
! Field Type
+
| 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).
! Notes
+
|-
|-
+
| Slot || Short || The slot that should be updated
|rowspan="4"| 0x33
+
|-
|rowspan="4"| Play
+
| Slot data || [[Slot_Data|Slot]] ||
|rowspan="4"| Client
+
|}
| Dimension
 
| Int Enum
 
| -1: The Nether, 0: The Overworld, 1: The End
 
|-
 
| Difficulty
 
| Unsigned Byte
 
| 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
 
|-
 
| Gamemode
 
| Unsigned Byte
 
| 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included
 
|-
 
| Level Type
 
| String
 
| 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).
+
==== Window Items ====
  
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.}}
+
[[File:Inventory-slots.png|thumb|The inventory slots]]
 
 
==== Entity Head Look ====
 
  
Changes the direction an entity's head is facing.
+
Sent by the server when an item in a slot (in a window) is added/removed. This includes the main inventory, equipped armour and crafting slots.  
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x30 || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| Window ID || Unsigned Byte || The id of window which items are being sent for. 0 for player inventory.
! Field Type
+
|-
! Notes
+
| Count || Short || The number of slots (see below)
|-
+
|-
|rowspan="2"| 0x34
+
| Slot data || Array of [[Slot_Data|Slot]]s ||
|rowspan="2"| Play
+
|}
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
|  
 
|-
 
| Head Yaw
 
| Angle
 
| New angle, not a delta
 
|}
 
  
==== World Border ====
+
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
  
 +
==== Window Property ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x31 || rowspan=3 | Play || rowspan=3 | Client
!colspan="2"| Field Name
+
| Window ID || Unsigned Byte || The id of the window.
! Field Type
+
|-
! Notes
+
| Property || Short || Which property should be updated.
|-
+
|-
|rowspan="18"| 0x35
+
| Value || Short || The new value for the property.
|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
 
| Current length of a single side of the world border, in meters
 
|-
 
| New Diameter
 
| Double
 
| Target length of a single side of the world border, in meters
 
|-
 
| Speed
 
| VarLong
 
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 
|-
 
|rowspan="2"| 2: set center
 
| X
 
| Double
 
|  
 
|-
 
| Z
 
| Double
 
|
 
|-
 
|rowspan="8"| 3: initialize
 
| X
 
| Double
 
|
 
|-
 
| Z
 
| Double
 
|
 
|-
 
| Old Diameter
 
| Double
 
| Current length of a single side of the world border, in meters
 
|-
 
| New Diameter
 
| Double
 
| Target length of a single side of the world border, in meters
 
|-
 
| Speed
 
| VarLong
 
| Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0.
 
|-
 
| Portal Teleport Boundary
 
| VarInt
 
| Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984.
 
|-
 
| Warning Time
 
| VarInt
 
| In seconds as set by <code>/worldborder warning time</code>
 
|-
 
| Warning Blocks
 
| VarInt
 
| In meters
 
|-
 
|rowspan="1"| 4: set warning time
 
| Warning Time
 
| VarInt
 
| In seconds as set by <code>/worldborder warning time</code>
 
|-
 
|rowspan="1"| 5: set warning blocks
 
| Warning Blocks
 
| VarInt
 
| In meters
 
|}
 
  
The Notchian client determines how solid to display the warning by comparing to whichever is higher, the warning distance or whichever is lower, the distance from the current diameter to the target diameter or the place the border will be after warningTime seconds. In pseudocode:
+
'''Furnace'''
  
<syntaxhighlight lang="java">
+
Properties:
distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance);
 
if (playerDistance < distance) {
 
    warning = 1.0 - playerDistance / distance;
 
} else {
 
    warning = 0.0;
 
}
 
</syntaxhighlight>
 
  
==== Camera ====
+
* 0: Progress arrow
 +
* 1: Fire icon (fuel)
  
Sets the entity that the player renders from. This is normally used when the player left-clicks an entity while in spectator mode.
+
Values:
  
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).
+
* 0-200 for progress arrow
 +
* 0-200 for fuel indicator
  
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.
+
Ranges are presumably in in-game ticks
  
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).
+
'''Enchantment Table'''
  
{| class="wikitable"
+
Properties: 0, 1 or 2 depending on the "enchantment slot" being given.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="1"| 0x36
 
|rowspan="1"| Play
 
|rowspan="1"| Client
 
| Camera ID
 
| VarInt
 
| ID of the entity to set the client's camera to
 
|}
 
  
The notchian also loads certain shaders for given entities:
+
Values: The enchantment's level.
  
* Creeper &rarr; <code>shaders/post/creeper.json</code>
+
'''Beacon'''
* 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) ====
+
* 0: Power level
 +
* 1: Potion effect one
 +
* 2: Potion effect two
  
Sent to change the player's slot selection.
+
'''Anvil'''
  
{| class="wikitable"
+
* 0: Maximum cost
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="1"| 0x37
 
|rowspan="1"| Play
 
|rowspan="1"| Client
 
| Slot
 
| Byte
 
| The slot which the player has selected (0–8)
 
|}
 
  
==== Display Scoreboard ====
+
'''Brewing Stand'''
  
This is sent to the client when it should display a scoreboard.
+
* 0: Brew time
  
{| class="wikitable"
+
Brew time is a value between 0 and 400, with 400 making the arrow empty, and 0 making the arrow full.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x38
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Position
 
| Byte
 
| The position of the scoreboard. 0: list, 1: sidebar, 2: below name.
 
|-
 
| Score Name
 
| String
 
| The unique name for the scoreboard to be displayed.
 
|}
 
  
==== Entity Metadata ====
+
==== Confirm Transaction ====
  
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.
+
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag). This packet is also sent from the client to the server in response to a server transaction rejection packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x32 || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| Window ID || Unsigned Byte || The id of the window that the action occurred in.
! Field Type
+
|-
! Notes
+
| Action number || Short || Every action that is to be accepted has a unique number. This field corresponds to that number.
|-
+
|-
|rowspan="2"| 0x39
+
| Accepted || Bool || Whether the action was accepted.
|rowspan="2"| Play
+
|}
|rowspan="2"| Client
 
| Entity ID
 
| VarInt
 
|  
 
|-
 
| Metadata
 
| [[Entities#Entity Metadata Format|Entity Metadata]]
 
|  
 
|}
 
  
==== Attach Entity ====
+
==== Update Sign ====
  
This packet is sent when an entity has been {{Minecraft Wiki|Lead|leashed}} to another entity.
+
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.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="7" | 0x33 || rowspan=7 | Play || rowspan=7 | Client
! Field Name
+
| X || Int || Block X Coordinate
! Field Type
+
|-
! Notes
+
| Y || Short || Block Y Coordinate
|-
+
|-
|rowspan="3"| 0x3A
+
| Z || Int || Block Z Coordinate
|rowspan="3"| Play
+
|-
|rowspan="3"| Client
+
| Line 1 || String || First line of text in the sign
| Attached Entity ID
+
|-
| Int
+
| Line 2 || String || Second line of text in the sign
| Attached entity's EID
+
|-
|-
+
| Line 3 || String || Third line of text in the sign
| Holding Entity ID
+
|-
| Int
+
| Line 4 || String || Fourth line of text in the sign
| ID of the entity holding the lead. Set to -1 to detach.
+
|}
|}
 
  
==== Entity Velocity ====
+
==== Maps ====
  
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms); for example, -1343 would move (-1343 / 8000) = −0.167875 blocks per tick (or −3,3575 blocks per second).
+
If the first byte of the array is 0, the next two bytes are X start and Y start and the rest of the bytes are the colors in that column.
  
{| class="wikitable"
+
If the first byte of the array is 1, the rest of the bytes are in groups of three: (data, x, y). The lower half of the data is the type (always 0 under vanilla) and the upper half is the direction.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="4"| 0x3B
 
|rowspan="4"| Play
 
|rowspan="4"| Client
 
| Entity ID
 
| 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
 
|}
 
  
==== Entity Equipment ====
+
If the first byte of the array is 2, the second byte is the map scale.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x34 || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| Item Damage || VarInt || The damage value of the map being modified
! Field Type
+
|-
! Notes
+
| Length || Short || Length of following byte array
|-
+
|-
|rowspan="3"| 0x3C
+
| Data || Byte Array || Array data
|rowspan="3"| Play
+
|}
|rowspan="3"| Client
 
| Entity ID
 
| VarInt
 
| Entity's EID
 
|-
 
| Slot
 
| VarInt Enum
 
| Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
 
|-
 
| Item
 
| [[Slot Data|Slot]]
 
|  
 
|}
 
  
==== Set Experience ====
+
==== Update Block Entity ====
  
Sent by the server when the client should change experience levels.
+
Essentially a block update on a block entity.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="6" | 0x35 || rowspan=6 | Play || rowspan=6 | Client
! Field Name
+
| X || Int ||
! Field Type
+
|-
! Notes
+
| Y || Short ||
|-
+
|-
|rowspan="3"| 0x3D
+
| Z || Int ||
|rowspan="3"| Play
+
|-
|rowspan="3"| Client
+
| Action || Unsigned Byte || The type of update to perform
| Experience bar
+
|-
| Float
+
| Data length || Short || Varies
| Between 0 and 1
+
|-
|-
+
| NBT Data || Byte Array || Present if data length > 0. Compressed with [[wikipedia:Gzip|gzip]]. Varies, but based on the NBT chunk storage format as can be found in the Minecraft Wiki (http://www.minecraftwiki.net/Chunk_Format)
| Level
+
|}
| VarInt
 
|  
 
|-
 
| Total Experience
 
| VarInt
 
| See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
 
|}
 
  
==== Update Health ====
+
'''Actions'''
  
Sent by the server to update/set the health of the player it is sent to.
+
* '''1''': Set mob displayed inside a mob spawner
 +
* '''2''': Set command block text (command and last execution status)
 +
* '''3''': Set rotation and skin of mob head
 +
* '''4''': Set type of flower in flower pot
  
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.
+
==== Sign Editor Open ====
  
{| class="wikitable"
+
Sent on placement of sign.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="3"| 0x3E
 
|rowspan="3"| Play
 
|rowspan="3"| Client
 
| Health
 
| Float
 
| 0 or less = dead, 20 = full HP
 
|-
 
| Food
 
| VarInt
 
| 0–20
 
|-
 
| Food Saturation
 
| Float
 
| Seems to vary from 0.0 to 5.0 in integer increments
 
|}
 
 
 
==== Scoreboard Objective ====
 
 
 
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x36 || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| X || Int || X in block coordinates
! Field Type
+
|-
! Notes
+
| Y || Int || Y in block coordinates
|-
+
|-
|rowspan="4"| 0x3F
+
| Z || Int || Z in block coordinates
|rowspan="4"| Play
+
|}
|rowspan="4"| Client
 
| Objective Name
 
| String
 
| An unique name for the objective
 
|-
 
| Mode
 
| Byte
 
| 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
 
|-
 
| Objective Value
 
| Optional String
 
| Only if mode is 0 or 2. The text to be displayed for the score
 
|-
 
| Type
 
| Optional String
 
| Only if mode is 0 or 2. “integer” or “hearts”
 
|}
 
 
 
==== Set Passengers ====
 
  
 +
==== Statistics ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To  
! State
+
! colspan="2" | Field Name
! Bound To
+
! Field Type !! Notes
! Field Name
+
|-
! Field Type
+
| rowspan="3" | 0x37 || rowspan=3 | Play || rowspan=3 | Client
! Notes
+
| colspan="2" | Count || VarInt || Number of entries
|-
+
|-
|rowspan="3"| 0x40
+
| rowspan=2 | Entry
|rowspan="3"| Play
+
| Statistic's name || String || https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0
|rowspan="3"| Client
+
|-
| Entity ID
+
| Value || VarInt || The amount to set it to
| VarInt
+
|}
| Vehicle's EID
 
|-
 
| Passenger Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Passengers
 
| Array of VarInt
 
| EIDs of entity's passengers
 
|}
 
  
==== Teams ====
+
==== Player List Item ====
  
Creates and updates teams.
+
Sent by the notchian server to update the user list (<tab> in the client).
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x38 || rowspan=3 | Play || rowspan=3 | Client
!colspan="2"| Field Name
+
| Player name || String || Supports chat colouring, limited to 16 characters.
! Field Type
+
|-
! Notes
+
| Online || Bool || The client will remove the user from the list if false.
|-
+
|-
|rowspan="23"| 0x41
+
| Ping || Short || Ping, presumably in ms.
|rowspan="23"| Play
+
|}
|rowspan="23"| Client
 
|colspan="2"| Team Name
 
| String
 
| A unique name for the team. (Shared with scoreboard).
 
|-
 
|colspan="2"| Mode
 
| Byte
 
| Determines the layout of the remaining packet
 
|-
 
|rowspan="9"| 0: create team
 
| Team Display Name
 
| String
 
|
 
|-
 
| Team Prefix
 
| String
 
| Displayed before the names of players that are part of this team
 
|-
 
| Team Suffix
 
| String
 
| Displayed after the names of players that are part of this team
 
|-
 
| Friendly Flags
 
| Byte
 
| Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible players on same team
 
|-
 
| Name Tag Visibility
 
| String Enum
 
| <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
 
|-
 
| Collision Rule
 
| String Enum
 
| <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
 
|-
 
| Color
 
| Byte
 
| Same as [[Chat]] colors
 
|-
 
| Player Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Players
 
| Array of String
 
| Usernames of the players in this team. Maximum 40 characters per entry.
 
|-
 
| 1: remove team
 
| ''no fields''
 
| ''no fields''
 
|  
 
|-
 
|rowspan="7"| 2: update team info
 
| Team Display Name
 
| String
 
|
 
|-
 
| Team Prefix
 
| String
 
| Displayed before the names of players that are part of this team
 
|-
 
| Team Suffix
 
| String
 
| Displayed after the names of players that are part of this team
 
|-
 
| Friendly Flags
 
| Byte
 
| Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible players on same team
 
|-
 
| Name Tag Visibility
 
| String Enum
 
| <code>always</code>, <code>hideForOtherTeams</code>, <code>hideForOwnTeam</code>, <code>never</code>
 
|-
 
| Collision Rule
 
| String Enum
 
| <code>always</code>, <code>pushOtherTeams</code>, <code>pushOwnTeam</code>, <code>never</code>
 
|-
 
| Color
 
| Byte
 
| Same as [[Chat]] colors
 
|-
 
|rowspan="2"| 3: add players to team
 
| Player Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Players
 
| Array of String
 
| Usernames of the added players. Maximum 40 characters per entry.
 
|-
 
|rowspan="2"| 4: remove players from team
 
| Player Count
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Players
 
| Array of String
 
| Usernames of the removed players. Maximum 40 characters per entry.
 
|}
 
  
==== Update Score ====
+
==== Player Abilities ====
  
This is sent to the client when it should update a scoreboard item.  
+
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"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x39 || rowspan=3 | Play || rowspan=3 | Client
! Field Name
+
| Flags || Byte ||
! Field Type
+
|-
! Notes
+
| Flying speed || Float|| previous integer value divided by 250
|-
+
|-
|rowspan="4"| 0x42
+
| Walking speed || Float || previous integer value divided by 250
|rowspan="4"| Play
+
|}
|rowspan="4"| Client
 
| Score Name
 
| String
 
| The name of the score to be updated or removed
 
|-
 
| Action
 
| Byte
 
| 0 to create/update an item. 1 to remove an item.
 
|-
 
| Objective Name
 
| String
 
| The name of the objective the score belongs to
 
|-
 
| Value
 
| Optional VarInt
 
| The score to be displayed next to the entry. Only sent when Action does not equal 1.
 
|}
 
  
==== Spawn Position ====
+
==== Tab-Complete ====
  
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.
+
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2| 0x3A || rowspan=2 | Play || rowspan=2 | Client
! Field Name
+
| Count || VarInt || Number of following strings
! Field Type
+
|-
! Notes
+
| Match || String || One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
|-
+
|}
|rowspan="1"| 0x43
 
  |rowspan="1"| Play
 
|rowspan="1"| Client
 
| Location
 
| Position
 
| Spawn location
 
|}
 
  
==== Time Update ====
+
==== Scoreboard Objective ====
  
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.
+
This is sent to the client when it should create a new scoreboard or remove one.
  
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
+
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan="3" | 0x3B || rowspan=3 | Play || rowspan=3 | Client
 +
| Objective name || String || An unique name for the objective
 +
|-
 +
| Objective value || String || The text to be displayed for the score.
 +
|-
 +
| Create/Remove || Byte || 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.  
 +
|}
  
The default SMP server increments the time by <code>20</code> every second.
+
==== Update Score ====
  
{| class="wikitable"
+
This is sent to the client when it should update a scoreboard item.  
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x44
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| World Age
 
| Long
 
| In ticks; not changed by server commands
 
|-
 
| Time of day
 
| Long
 
| The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
 
|}
 
 
 
==== Title ====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="4" | 0x3C || rowspan=4 | Play || rowspan=4 | Client
!colspan="2"| Field Name
+
| Item Name || String || An unique name to be displayed in the list.
! Field Type
+
|-
! Notes
+
| Update/Remove || Byte || 0 to create/update an item. 1 to remove an item.
|-
+
|-
|rowspan="9"| 0x45
+
| Score Name || String || The unique name for the scoreboard to be updated. Only sent when Update/Remove does not equal 1.
|rowspan="9"| Play
+
|-
|rowspan="9"| Client
+
| Value || Int || The score to be displayed next to the entry. Only sent when Update/Remove does not equal 1.
|colspan="2"| Action
+
|}
| VarInt Enum
+
{{Warning|The final String and Int are only sent if the Update/Remove Byte does not equal 1}}
|  
 
|-
 
! Action
 
! Field Name
 
!
 
!
 
|-
 
| 0: set title
 
| Title Text
 
| [[Chat]]
 
|  
 
|-
 
| 1: set subtitle
 
| Subtitle Text
 
| [[Chat]]
 
|
 
|-
 
|rowspan="3"| 2: set times and display
 
| Fade In
 
| Int
 
| Ticks to spend fading in
 
|-
 
| Stay
 
| Int
 
| Ticks to keep the title displayed
 
|-
 
| Fade Out
 
| Int
 
| Ticks to spend out, not when to start fading out
 
|-
 
| 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.
+
==== Display Scoreboard ====
  
The title is visible on screen for Fade In + Stay + Fade Out ticks.
+
This is sent to the client when it should display a scoreboard.
 
 
==== Sound Effect ====
 
 
 
This packet is used to play a number of [http://pokechu22.github.io/Burger/1.9.html#sounds hardcoded sound events]. For custom sounds, use [[#Named Sound Effect|Named Sound Effect]] ([[#Play|Play]], 0x19, clientbound).
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="2" | 0x3D || rowspan=2 | Play || rowspan=2 | Client
! Field Name
+
| Position || Byte || The position of the scoreboard. 0 = list, 1 = sidebar, 2 = belowName.
! Field Type
+
|-
! Notes
+
| Score Name || String || The unique name for the scoreboard to be displayed.
|-
+
|}
|rowspan="7"| 0x46
 
|rowspan="7"| Play
 
|rowspan="7"| Client
 
| Sound ID
 
| VarInt
 
| ID of hardcoded sound event ([http://pokechu22.github.io/Burger/1.9.html#sounds events])
 
|-
 
| Sound Category
 
| VarInt Enum
 
| The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories])
 
|-
 
| Effect Position X
 
| Int
 
| Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
|-
 
| Effect Position Y
 
| Int
 
| Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
|-
 
| Effect Position Z
 
| Int
 
| Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part)
 
|-
 
| Volume
 
| Float
 
| 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients
 
|-
 
| Pitch
 
| Unsigned Byte
 
| Float multiplied by 63.5, capped between 0.5 and 2.0 by Notchian clients
 
|}
 
  
==== Player List Header And Footer ====
+
==== Teams ====
  
This packet may be used by custom servers to display additional information above/below the player list. It is never sent by the Notchian server.
+
Creates and updates teams.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="8" | 0x3E || rowspan=8 | Play || rowspan=8 | Client
! Field Name
+
| Team Name || String || A unique name for the team. (Shared with scoreboard).
! Field Type
+
|-
! Notes
+
| Mode || Byte || If 0 then the team is created.
|-
+
If 1 then the team is removed.
|rowspan="2"| 0x47
 
|rowspan="2"| Play
 
|rowspan="2"| Client
 
| Header
 
| [[Chat]]
 
| To remove the header, send a empty translatable component: {"translate":""}
 
|-
 
| Footer
 
| [[Chat]]
 
| To remove the footer, send a empty translatable component: {"translate":""}
 
|}
 
  
==== Collect Item ====
+
If 2 the team team information is updated.
  
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.
+
If 3 then new players are added to the team.  
  
{| class="wikitable"
+
If 4 then players are removed from the team.
! Packet ID
+
|-
! State
+
| Team Display Name || String || Only if Mode = 0 or 2.
! Bound To
+
|-
! Field Name
+
| Team Prefix || String || Only if Mode = 0 or 2. Displayed before the players' name that are part of this team.
! Field Type
+
|-
! Notes
+
| Team Suffix || String || Only if Mode = 0 or 2. Displayed after the players' name that are part of this team.
|-
+
|-
|rowspan="2"| 0x48
+
| Friendly fire || Byte || Only if Mode = 0 or 2; 0 for off, 1 for on, 3 for seeing friendly invisibles
|rowspan="2"| Play
+
|-
|rowspan="2"| Client
+
| Player count || Short || Only if Mode = 0 or 3 or 4. Number of players in the array
| Collected Entity ID
+
|-
| VarInt
+
| Players || Array of strings || Only if Mode = 0 or 3 or 4. Players to be added/remove from the team.
|  
+
|}
|-  
 
| Collector Entity ID
 
| VarInt
 
|  
 
|}
 
  
==== Entity Teleport ====
+
==== Plugin Message ====
  
This packet is sent by the server when an entity moves more than 4 blocks.
+
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>.
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="7"| 0x49
 
|rowspan="7"| Play
 
|rowspan="7"| Client
 
| Entity ID
 
| VarInt
 
|
 
|-
 
| X
 
| Double
 
|
 
|-
 
| Y
 
| Double
 
|
 
|-
 
| Z
 
| Double
 
|
 
|-
 
| Yaw
 
| Angle
 
| New angle, not a delta
 
|-
 
| Pitch
 
| Angle
 
| New angle, not a delta
 
|-
 
| On Ground
 
| Boolean
 
|
 
|}
 
  
==== Entity Properties ====
+
More documentation on this: http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/
 
 
Sets {{Minecraft Wiki|Attribute|attributes}} on the given entity.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x3F || rowspan=3 | Play || rowspan=3 | Client
!colspan="2"| Field Name
+
| Channel || String || Name of the "channel" used to send the data.
!colspan="2"| Field Type
+
|-
! Notes
+
| Length || Short || Length of the following byte array
|-
+
|-
|rowspan="6"| 0x4A
+
| Data || Byte Array || Any data.
|rowspan="6"| Play
+
|}
|rowspan="6"| Client
 
|colspan="2"| Entity ID
 
|colspan="2"| VarInt
 
|  
 
|-
 
|colspan="2"| Number Of Properties
 
|colspan="2"| Int
 
| Number of elements in the following array
 
|-
 
|rowspan="4"| Property
 
| Key
 
|rowspan="4"| Array
 
| String
 
| See below
 
|-
 
| Value
 
| Double
 
| See below
 
|-
 
| Number Of Modifiers
 
| VarInt
 
| Number of elements in the following array
 
|-
 
| Modifiers
 
| Array of Modifier Data
 
| See {{Minecraft Wiki|Attribute#Modifiers}}. Modifier Data defined below.
 
|}
 
  
Known Key values (see also {{Minecraft Wiki|Attribute#Modifiers}}):
+
==== Disconnect ====
  
{| class="wikitable"
+
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.
|-
 
! Key
 
! Default
 
! Min
 
! Max
 
! Label
 
|-
 
| generic.maxHealth
 
| 20.0
 
| 0.0
 
| 1024.0
 
| Max Health
 
|-
 
| generic.followRange
 
| 32.0
 
| 0.0
 
| 2048.0
 
| Follow Range
 
|-
 
| generic.knockbackResistance
 
| 0.0
 
| 0.0
 
| 1.0
 
| Knockback Resistance
 
|-
 
| generic.movementSpeed
 
| 0.699999988079071
 
| 0.0
 
| 1024.0
 
| Movement Speed
 
|-
 
| generic.attackDamage
 
| 2.0
 
| 0.0
 
| 2048.0
 
| Attack Damage
 
|-
 
| generic.attackSpeed
 
| 4.0
 
| 0.0
 
| 1024.0
 
| Attack Speed
 
|-
 
| horse.jumpStrength
 
| 0.7
 
| 0.0
 
| 2.0
 
| Jump Strength
 
|-
 
| zombie.spawnReinforcements
 
| 0.0
 
| 0.0
 
| 1.0
 
| Spawn Reinforcements Chance
 
|}
 
 
 
''Modifier Data'' structure:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Field Name
+
|-
! Field Type
+
| 0x40 || rowspan=1 | Play || rowspan=1 | Client
! Notes
+
| Reason || String || Displayed to the client when the connection terminates. Must be valid JSON.
|-
+
|}
| UUID
 
| UUID
 
|  
 
|-
 
| Amount
 
| Double
 
| May be positive or negative
 
|-
 
| Operation
 
| Byte
 
| See below
 
|}
 
  
The operation controls how the base value of the modifier is changed.
+
=== Serverbound ===
  
* 0: Add/subtract amount
+
==== Keep Alive ====
* 1: Add/subtract amount percent of the current value
 
* 2: Multiply by amount percent
 
  
All of the 0's are applied first, and then the 1's, and then the 2's.
+
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
 
 
==== Entity Effect ====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Server
! Field Name
+
| Keep Alive ID || Int ||
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="5"| 0x4B
 
|rowspan="5"| Play
 
|rowspan="5"| Client
 
| Entity ID
 
| VarInt
 
|  
 
|-
 
| Effect ID
 
| Byte
 
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 
|-
 
| Amplifier
 
| Byte
 
| Notchian client displays effect level as Amplifier + 1
 
|-
 
| Duration
 
| VarInt
 
| Seconds
 
|-
 
| Hide particles
 
| Boolean
 
| False: show particles, true: hide particles
 
|}
 
  
=== Serverbound ===
+
==== Chat Message ====
  
==== Teleport Confirm ====
+
The default server will check the message to see if it begins with a '/'. If it doesn't, the username of the sender is prepended and sent to all other clients (including the original sender). If it does, the server assumes it to be a command and attempts to process it. A message longer than 100 characters will cause the server to kick the client. This change was initially done by allowing the client to not slice the message up to 119 (the previous limit), without changes to the server. For this reason, the vanilla server kept the code to cut messages at 119, but this isn't a protocol limitation and can be ignored.
  
Sent by client as confirmation of [[#Player Position And Look (clientbound)|Player Position And Look]] ([[#Play|Play]], 0x2E, clientbound).
+
For more information, see [[Chat]].
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x01 || rowspan=1 | Play || rowspan=1 | Server
! Field Name
+
| Message || String ||  
! Field Type
+
|}
! Notes
 
|-
 
| 0x00
 
| Play
 
| Server
 
| Teleport ID
 
| VarInt
 
| The ID given by the [[#Player Position And Look (clientbound)|Player Position And Look]] packet
 
|}
 
  
==== Tab-Complete (serverbound) ====
+
==== Use Entity ====
  
Sent when the user presses ''tab'' while writing text.
+
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
  
{| class="wikitable"
+
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.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="4"| 0x01
 
|rowspan="4"| Play
 
|rowspan="4"| Server
 
| Text
 
| String
 
| All text behind the cursor (e.g. to the left of the cursor in left-to-right languages like English)
 
|-
 
| Assume Command
 
| Boolean
 
| If true, the server will parse Text as a command even if it doesn't start with a <code>/</code>. Used in the command block GUI.
 
|-
 
| Has Position
 
| Boolean
 
|
 
|-
 
| Looked At Block
 
| Optional Position
 
| The position of the block being looked at. Only sent if Has Position is true.
 
|}
 
  
==== Chat Message (serverbound) ====
+
Note that middle-click in creative mode is interpreted by the client and sent as a Creative Inventory Action packet instead.
 
 
Used to send a chat message to the server.  The message may not be longer than 100 characters or else the server will kick the client.
 
 
 
If the message starts with a <code>/</code>, the server will attempt to interpret it as a command.  Otherwise, the server will broadcast the same chat message to all players on the server (including the player that sent the message), prepended with player's name.  Specifically, it will respond with a translate [[chat]] component, "<code>chat.type.text</code>" with the first parameter set to the display name of the player (including some chat component logic to support clicking the name to send a PM) and the second parameter set to the message.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x02 || rowspan=2 | Play || rowspan=2 | Server
! Field Name
+
| Target || Int ||
! Field Type
+
|-
! Notes
+
| Mouse || Byte || 0 = Right-click, 1 = Left-click
|-
+
|}
|rowspan="1"| 0x02
 
|rowspan="1"| Play
 
|rowspan="1"| Server
 
| Message
 
| String
 
| The client sends the raw input, not a [[Chat]] component
 
|}
 
  
==== Client Status ====
+
==== Player ====
  
Sent when the client is ready to complete login and when the client is ready to respawn after death.
+
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="1"| 0x03
 
|rowspan="1"| Play
 
|rowspan="1"| Server
 
| Action ID
 
| VarInt Enum
 
| See below
 
|}
 
  
''Action ID'' values:
+
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.
  
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Action ID
+
|-
! Action
+
| rowspan=1 | 0x03 || rowspan=1 | Play || rowspan=1 | Server
|-
+
| On Ground || Bool || True if the client is on the ground, False otherwise
| 0
+
|}
| Perform respawn
 
|-
 
| 1
 
| Request stats
 
|-
 
| 2
 
| Open inventory
 
|}
 
  
==== Client Settings ====
+
==== Player Position ====
  
Sent when the player connects, or when settings are changed.
+
Updates the players XYZ position on the server.
 +
If <code>HeadY - FeetY</code> is less than <code>0.1</code> or greater than <code>1.65</code>, the stance is illegal and the client will be kicked with the message “Illegal Stance”.
 +
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 units will result in the client being kicked for "You moved too quickly :( (Hacking?)"
 +
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for "Illegal position"
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=5| 0x04 || rowspan=5 | Play || rowspan=5 | Server
! Field Name
+
| X || Double || Absolute position
! Field Type
+
|-
! Notes
+
| FeetY || Double || Absolute feet position, normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
|-
+
|-
|rowspan="6"| 0x04
+
| HeadY || Double || Absolute head position
|rowspan="6"| Play
+
|-
|rowspan="6"| Server
+
| Z || Double || Absolute position
| Locale
+
|-
| String
+
| On Ground || Bool || True if the client is on the ground, False otherwise
| e.g. en_GB
+
|}
|-
 
| View Distance
 
| Byte
 
| Client-side render distance, in chunks
 
|-
 
| Chat Mode
 
| VarInt Enum
 
| 0: enabled, 1: commands only, 2: hidden
 
|-
 
| Chat Colors
 
| Boolean
 
| “Colors” multiplayer setting
 
|-
 
| Displayed Skin Parts
 
| Unsigned Byte
 
| Bit mask, see below
 
|-
 
| Main Hand
 
| VarInt Enum
 
| 0: Left, 1: Right
 
|}
 
  
''Displayed Skin Parts'' flags:
+
==== Player Look ====
  
* Bit 0 (0x01): Cape enabled
+
[[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]]
* Bit 1 (0x02): Jacket enabled
 
* Bit 2 (0x04): Left Sleeve enabled
 
* Bit 3 (0x08): Right Sleeve enabled
 
* Bit 4 (0x10): Left Pants Leg enabled
 
* Bit 5 (0x20): Right Pants Leg enabled
 
* Bit 6 (0x40): Hat enabled
 
  
The most significant bit (bit 7, 0x80) appears to be unused.
+
[[File:Yaw.png|thumb|The unit circle of yaw, redrawn]]
  
==== Confirm Transaction (serverbound) ====
+
Updates the direction the player is looking in.
  
If a transaction sent by the client was not accepted, the server will reply with a [[#Confirm Transaction|Confirm Transaction]] ([[#Play|Play]], 0x32, clientbound) packet with the Accepted field set to false. When this happens, the client must reflect the packet to apologize (as with movement), otherwise the server ignores any successive transactions.
+
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.
  
{| class="wikitable"
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="3"| 0x05
 
|rowspan="3"| Play
 
|rowspan="3"| Server
 
| Window ID
 
| Byte
 
| The ID of the window that the action occurred in
 
|-
 
| Action Number
 
| Short
 
| Every action that is to be accepted has a unique number. This field corresponds to that number.
 
|-
 
| Accepted
 
| Boolean
 
| Whether the action was accepted
 
|}
 
  
==== Enchant Item ====
+
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
 +
  l = x-x0
 +
  w = z-z0
 +
  c = sqrt( l*l + w*w )
 +
  alpha1 = -arcsin(l/c)/PI*180
 +
  alpha2 = arccos(w/c)/PI*180
 +
  if alpha2 > 90 then
 +
    yaw = 180 - alpha1
 +
  else
 +
    yaw = alpha1
  
{| class="wikitable"
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="2"| 0x06
 
|rowspan="2"| Play
 
|rowspan="2"| Server
 
| Window ID
 
| Byte
 
| The ID of the enchantment table window sent by [[#Open Window|Open Window]]
 
|-
 
| Enchantment
 
| Byte
 
| The position of the enchantment on the enchantment table window, starting with 0 as the topmost one
 
|}
 
  
==== Click Window ====
+
You can get a unit vector from a given yaw/pitch via:
 
+
  x = -cos(pitch) * sin(yaw)
This packet is sent by the player when it clicks on a slot in a window.
+
  y = -sin(pitch)
 +
  z = cos(pitch) * cos(yaw)
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=3| 0x05 || rowspan=3 | Play || rowspan=3 | Server
! Field Name
+
| Yaw || Float || Absolute rotation on the X Axis, in degrees
! Field Type
+
|-
! Notes
+
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
|-
+
|-
|rowspan="6"| 0x07
+
| On Ground || Bool || True if the client is on the ground, False otherwise
|rowspan="6"| Play
+
|}
|rowspan="6"| Server
 
| Window ID
 
| Unsigned Byte
 
| The ID of the window which was clicked. 0 for player inventory.
 
|-
 
| Slot
 
| Short
 
| The clicked slot number, see below
 
|-
 
| Button
 
| Byte
 
| The button used in the click, see below
 
|-
 
| Action Number
 
| Short
 
| A unique number for the action, implemented by Notchian as a counter, starting at 1. Used by the server to send back a [[#Confirm Transaction|Confirm Transaction]].
 
|-
 
| Mode
 
| VarInt Enum
 
| Inventory operation mode, see below
 
|-
 
| Clicked item
 
| [[Slot Data|Slot]]
 
| The clicked slot. Has to be empty (item ID = -1) for drop mode.
 
|}
 
 
 
See [[Inventory]] for further information about how slots are indexed.
 
  
When right-clicking on a stack of items, half the stack will be picked up and half left in the slot. If the stack is an odd number, the half left in the slot will be smaller of the amounts.
+
==== Player Position And Look ====
  
The distinct type of click performed by the client is determined by the combination of the Mode and Button fields.
+
A combination of Player Look and Player position.  
  
 
{| class="wikitable"
 
{| class="wikitable"
! Mode
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Button
+
|-
! Slot
+
| rowspan=7| 0x06 || rowspan=7 | Play || rowspan=7 | Server
! Trigger
+
| X || Double || Absolute position
|-
+
|-
!rowspan="2"| 0
+
| FeetY || Double || Absolute feet position. Is normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
| 0
+
|-
| Normal
+
| HeadY || Double || Absolute head position
| Left mouse click
+
|-
|-
+
| Z || Double || Absolute position
| 1
+
|-
| Normal
+
| Yaw || Float || Absolute rotation on the X Axis, in degrees
| Right mouse click
+
|-
|-
+
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
!rowspan="2"| 1
+
|-
| 0
+
| On Ground || Bool || True if the client is on the ground, False otherwise
| Normal
+
|}
| Shift + left mouse click
 
|-
 
| 1
 
| Normal
 
| Shift + right mouse click ''(identical behavior)''
 
|-
 
!rowspan="5"| 2
 
| 0
 
| Normal
 
| Number key 1
 
|-
 
| 1
 
| Normal
 
| Number key 2
 
|-
 
| 2
 
| Normal
 
| Number key 3
 
|-
 
| ⋮
 
| ⋮
 
| ⋮
 
|-
 
| 8
 
| Normal
 
| Number key 9
 
|-
 
!rowspan="1"| 3
 
| 2
 
| Normal
 
| Middle click
 
|-
 
!rowspan="4"| 4
 
| 0
 
| Normal*
 
| Drop key (Q) (* Clicked item is different, see above)
 
|-
 
| 1
 
| Normal*
 
| Ctrl + Drop key (Ctrl-Q) ''(drops full stack)''
 
|-
 
| 0
 
| -999
 
| Left click outside inventory holding nothing ''(no-op)''
 
|-
 
| 1
 
| -999
 
| Right click outside inventory holding nothing ''(no-op)''
 
|-
 
!rowspan="6"| 5
 
| 0
 
| -999
 
| Starting left mouse drag ''(or middle mouse)''
 
|-
 
| 4
 
| -999
 
| Starting right mouse drag
 
|-
 
| 1
 
| Normal
 
| Add slot for left-mouse drag
 
|-
 
| 5
 
| Normal
 
| Add slot for right-mouse drag
 
|-
 
| 2
 
| -999
 
| Ending left mouse drag
 
|-
 
| 6
 
| -999
 
| Ending right mouse drag
 
|-
 
! 6
 
| 0
 
| Normal
 
| Double click
 
|}
 
  
Starting from version 1.5, “painting mode” is available for use in inventory windows. It is done by picking up stack of something (more than 1 item), then holding mouse button (left, right or middle) and dragging held stack over empty (or same type in case of right button) slots. In that case client sends the following to server after mouse button release (omitting first pickup packet which is sent as usual):
+
==== Player Digging ====
  
# packet with mode 5, slot -999, button (0 for left | 4 for right);
+
Sent when the player mines a block. A Notchian server only accepts digging packets with coordinates within a 6-unit radius of the player's position.
# packet for every slot painted on, mode is still 5, button (1 | 5);
 
# packet with mode 5, slot -999, button (2 | 6);
 
 
 
If any of the painting packets other than the “progress” ones are sent out of order (for example, a start, some slots, then another start; or a left-click in the middle) the painting status will be reset.
 
 
 
The server will send back a [[#Confirm Transaction|Confirm Transaction]] packet. If the click was not accepted, the client must reflect that packet before sending more [[#Click Window|Click Window]] packets, otherwise the server will reject them silently. The Notchian server also sends a [[#Window Items|Window Items]] packet for the open window and [[#Set Slot|Set Slot]] packets for the clicked and cursor slot, but only when the click was not accepted, probably to resynchronize client and server.
 
 
 
==== Close Window (serverbound) ====
 
 
 
This packet is sent by the client when closing a window.
 
 
 
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 the inventory.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="5" | 0x07 || rowspan=5 | Play || rowspan=5 | Server
! Field Name
+
| Status || Byte || The action the player is taking against the block (see below)
! Field Type
+
|-
! Notes
+
| X || Int || Block position
|-
+
|-
| 0x08
+
| Y || Unsigned Byte || Block position
| Play
+
|-
| Server
+
| Z || Int || Block position
| Window ID
+
|-
| Unsigned Byte
+
| Face || Byte || The face being hit (see below)
| This is the ID of the window that was closed. 0 for player inventory.
+
|}
|}
 
 
 
==== Plugin Message (serverbound) ====
 
 
 
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/]
 
  
Note that the length of Data is known only from the packet length, since the packet has no length field of any kind.
+
Status can (currently) be one of six values:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Meaning !! Value
! State
+
|-
! Bound To
+
| Started digging || <code>0</code>
! Field Name
+
|-
! Field Type
+
| Cancelled digging || <code>1</code>
! Notes
+
|-
|-
+
| Finished digging || <code>2</code>
|rowspan="2"| 0x09
+
|-
|rowspan="2"| Play
+
| Drop item stack || <code>3</code>
|rowspan="2"| Server
+
|-
| Channel
+
| Drop item || <code>4</code>
| String
+
|-
| Name of the [[plugin channel]] used to send the data
+
| Shoot arrow / finish eating || <code>5</code>
|-
+
|}
| Data
 
| Byte Array
 
| Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].  The length of this array must be inferred from the packet length.
 
|}
 
  
==== Use Entity ====
+
Notchian clients send a 0 (started digging) when they start digging and a 2 (finished digging) once they think they are finished. If digging is aborted, the client simply send a 1 (Cancel digging).
  
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
+
Status code 4 (drop item) is a special case.  In-game, when you use the Drop Item command (keypress 'q'), a dig packet with a status of 4, and all other values set to 0, is sent from client to server. Status code 3 is similar, but drops the entire stack.
  
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.
+
Status code 5 (shoot arrow / finish eating) is also a special case. The x, y and z fields are all set to 0 like above, with the exception of the face field, which is set to 255.
  
Note that middle-click in creative mode is interpreted by the client and sent as a [[#Creative Inventory Action|Creative Inventory Action]] packet instead.
+
The face can be one of six values, representing the face being hit:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
|-
! State
+
| Value || 0 || 1 || 2 || 3 || 4 || 5
! Bound To
+
|-
! Field Name
+
| Offset || -Y || +Y || -Z || +Z || -X || +X
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="6"| 0x0A
 
|rowspan="6"| Play
 
|rowspan="6"| Server
 
| Target
 
| VarInt
 
|  
 
|-
 
| Type
 
| VarInt Enum
 
| 0: interact, 1: attack, 2: interact at
 
|-
 
| Target X
 
| Optional Float
 
| Only if Type is interact at
 
|-
 
| Target Y
 
| Optional Float
 
| Only if Type is interact at
 
|-
 
| Target Z
 
| Optional Float
 
| Only if Type is interact at
 
|-
 
| Hand
 
| Optional VarInt Enum
 
| Only if Type is interact or interact at; 0: main hand, 1: off hand
 
|}
 
  
==== Keep Alive (serverbound) ====
+
In 1.7.3, when a player opens a door with left click the server receives Packet 0xE+start digging and opens the door.
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
 
  
 +
==== Player Block Placement ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
|-
! State
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Bound To
+
|-
! Field Name
+
| rowspan="8" | 0x08 || rowspan=8 | Play || rowspan=8 | Server
! Field Type
+
| X || Int || Block position
! Notes
+
|-
|-
+
| Y || Unsigned Byte || Block position
| 0x0B
+
|-
| Play
+
| Z || Int || Block position
| Server
+
|-
| Keep Alive ID
+
| Direction || Byte || The offset to use for block/item placement (see below)
| VarInt
+
|-
|  
+
| Held item || [[Slot_Data|Slot]] ||
|}
+
|-
 +
| Cursor position X || Byte || The position of the crosshair on the block
 +
|-
 +
| Cursor position Y || Byte ||
 +
|-
 +
| Cursor position Z || Byte ||
 +
|}
 +
In normal operation (ie placing a block), this packet is sent once, with the values set normally.
  
==== Player Position ====
+
This packet has a special case where X, Y, Z, and Direction are all -1. (Note that Y is unsigned so set to 255.) This special packet indicates that the currently held item for the player should have its state updated such as eating food, shooting bows, using buckets, etc.
  
Updates the player's XYZ position on the server.
+
In a Notchian Beta client, the block or item ID corresponds to whatever the client is currently holding, and the client sends one of these packets any time a right-click is issued on a surface, so no assumptions can be made about the safety of the ID.  However, with the implementation of server-side inventory, a Notchian server seems to ignore the item ID, instead operating on server-side inventory information and holding selection. The client has been observed (1.2.5 and 1.3.2) to send both real item IDs and -1 in a single session.
  
Checking for moving too fast is achieved like this:
+
Special note on using buckets:  When using buckets, the Notchian client might send two packets:  first a normal and then a special case.  The first normal packet is sent when you're looking at a block (e.g. the water you want to scoop up).  This normal packet does not appear to do anything with a Notchian server.  The second, special case packet appears to perform the action - based on current position/orientation and with a distance check - it appears that buckets can only be used within a radius of 6 units.
  
* Each server tick, the player's current position is stored
+
==== Held Item Change ====
* When a player moves, the changes in x, y, and z coordinates are compared with the positions from the previous tick (&Delta;x, &Delta;y, &Delta;z)
 
* Total movement distance squared is computed as &Delta;x&sup2; + &Delta;y&sup2; + &Delta;z&sup2;
 
* The expected movement distance squared is computed as velocityX&sup2; + veloctyY&sup2; + velocityZ&sup2;
 
* If the total movement distance squared value minus the expected movement distance squared value is more than 100 (300 if the player is using an elytra), they are moving too fast.
 
  
If the player is moving too fast, it will be logged that "<player> moved too quickly! " followed by the change in x, y, and z, and the player will be teleported back to their current (before this packet) serverside position.
+
Sent when the player changes the slot selection
 
 
Also, if the absolute value of X or the absolute value of Z is a value greater than 3.2×10<sup>7</sup>, or X, Y, or Z are not finite (either positive infinity, negative infinity, or NaN), the client will be kicked for “Invalid move player packet received”.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x09 || rowspan=1 | Play || rowspan=1 | Server
! Field Name
+
| Slot || Short || The slot which the player has selected (0-8)
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="4"| 0x0C
 
|rowspan="4"| Play
 
|rowspan="4"| Server
 
| X
 
| Double
 
| Absolute position
 
|-
 
| Feet Y
 
| Double
 
| Absolute feet position, normally Head Y - 1.62
 
|-
 
| Z
 
| Double
 
| Absolute position
 
|-
 
| On Ground
 
| Boolean
 
| True if the client is on the ground, false otherwise
 
|}
 
 
 
==== Player Position And Look (serverbound) ====
 
 
 
A combination of [[#Player Look|Player Look]] and [[#Player Position|Player Position]].
 
  
 +
==== Animation ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x0A || rowspan=2 | Play || rowspan=2 | Server
! Field Name
+
| Entity ID || Int || Player ID
! Field Type
+
|-
! Notes
+
| Animation || Byte || Animation ID
|-
+
|}
|rowspan="6"| 0x0D
 
|rowspan="6"| Play
 
|rowspan="6"| Server
 
| X
 
| Double
 
| Absolute position
 
|-
 
| Feet Y
 
| Double
 
| Absolute feet position, normally Head Y - 1.62
 
|-
 
| Z
 
| Double
 
| Absolute position
 
|-
 
| Yaw
 
| Float
 
| Absolute rotation on the X Axis, in degrees
 
|-
 
| Pitch
 
| Float
 
| Absolute rotation on the Y Axis, in degrees
 
|-
 
| On Ground
 
| Boolean
 
| True if the client is on the ground, false otherwise
 
|}
 
  
==== Player Look ====
 
[[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]]
 
[[File:Yaw.png|thumb|The unit circle of yaw, redrawn]]
 
  
Updates the direction the player is looking in.
+
Animation can be one of the following values:
 
 
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 and pitch of player (in degrees), standing at point (x0, y0, z0) and looking towards point (x, y, z) one can be calculated with:
 
 
 
dx = x-x0
 
dy = y-y0
 
dz = z-z0
 
r = sqrt( dx*dx + dy*dy + dz*dz )
 
yaw = -atan2(dx,dz)/PI*180
 
if yaw < 0 then
 
    yaw = 360 - yaw
 
pitch = -arcsin(dy/r)/PI*180
 
 
 
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"
 
{| class="wikitable"
! Packet ID
+
! ID !! Animation
! State
+
|-
! Bound To
+
| 0 || No animation
! Field Name
+
|-
! Field Type
+
| 1 || Swing arm
! Notes
+
|-
|-
+
| 2 || Damage animation
|rowspan="3"| 0x0E
+
|-
|rowspan="3"| Play
+
| 3 || Leave bed
|rowspan="3"| Server
+
|-
| Yaw
+
| 5 || Eat food
| Float
+
|-
| Absolute rotation on the X Axis, in degrees
+
| 6 || Critical effect
|-
+
|-
| Pitch
+
| 7 || Magic critical effect
| Float
+
|-
| Absolute rotation on the Y Axis, in degrees
+
| 102 || (unknown)
|-
+
|-
| On Ground
+
| 104 || Crouch
| Boolean
+
|-
| True if the client is on the ground, False otherwise
+
| 105 || Uncrouch
|}
+
|}
  
==== Player ====
+
==== Entity Action ====
  
This packet as well as [[#Player Position|Player Position]] ([[#Play|Play]], 0x04, serverbound), [[#Player Look|Player Look]] ([[#Play|Play]], 0x05, serverbound), and [[#Player Position And Look 2|Player Position And Look]] ([[#Play|Play]], 0x06, serverbound) are called the “serverbound movement packets”. At least one of them must be sent on each tick to ensure that servers will update things like player health correctly. Vanilla clients will send Player Position once every 20 ticks even for a stationary player, and Player on every other tick.
+
Sent at least when crouching, leaving a bed, or sprinting.
 
+
To send action animation to client use 0x28.
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
+
The client will send this with Action ID = 3 when "Leave Bed" is clicked.
 
 
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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x0B || rowspan=3 | Play || rowspan=3 | Server
! Field Name
+
| Entity ID || Int || Player ID
! Field Type
+
|-
! Notes
+
| Action ID || Byte || The ID of the action, see below.
|-
+
|-
|rowspan="1"| 0x0F
+
| Jump Boost || Int || Horse jump boost. Ranged from 0 -> 100.
|rowspan="1"| Play
+
|}
|rowspan="1"| Server
 
| On Ground
 
| Boolean
 
| True if the client is on the ground, false otherwise
 
|}
 
  
==== Vehicle Move (serverbound) ====
+
Action ID can be one of the following values:
 
 
Sent when a player moves in a vehicle. Fields are the same as in [[#Player Position And Look (serverbound)|Player Position And Look]] ([[#Play|Play]], 0x2E, serverbound). Note that all fields use absolute positioning and do not allow for relative positioning.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! ID !! Action
! State
+
|-
! Bound To
+
| 1 || Crouch
! Field Name
+
|-
! Field Type
+
| 2 || Uncrouch
! Notes
+
|-
|-
+
| 3 || Leave bed
|rowspan="7"| 0x10
+
|-
|rowspan="7"| Play
+
| 4 || Start sprinting
|rowspan="7"| Server
+
|-
| X
+
| 5 || Stop sprinting
| Double
+
|-
| Absolute position (X coordinate)
+
| 6 || Horse jump
|-
+
|-
| Y
+
| 5 || Horse interaction ?
| Double
+
|}
| Absolute position (Y coordinate)
 
|-
 
| Z
 
| Double
 
| Absolute position (Z coordinate)
 
|-
 
| Yaw
 
| Float
 
| Absolute rotation on the vertical axis, in degrees
 
|-
 
| Pitch
 
| Float
 
| Absolute rotation on the horizontal axis, in degrees
 
|}
 
 
 
==== Steer Boat ====
 
 
 
Used to ''visually'' update whether boat paddles are turning.  The server will update the [[Entities#Boat|Boat entity metadata]] to match the values here.
 
  
 +
==== Steer Vehicle ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="4" | 0x0C || rowspan=4 | Play || rowspan=4 | Server
! Field Name
+
| Sideways || Float || Positive to the left of the player
! Field Type
+
|-
! Notes
+
| Forward || Float || Positive forward
|-
+
|-
|rowspan="2"| 0x11
+
| Jump || Bool ||
|rowspan="2"| Play
+
|-
|rowspan="2"| Server
+
| Unmount || Bool || True when leaving the vehicle
| Right paddle turning
+
|}
| Boolean
 
|
 
|-
 
| Left paddle turning
 
| Boolean
 
|
 
|}
 
  
Right paddle turning is set to true when the left button or forward button is held; left paddle turning is set to true when the right button or forward button is set to true.
+
==== Close Window ====
  
==== Player Abilities (serverbound) ====
+
This packet is sent by the client when closing a window.
  
The latter 2 bytes are used to indicate the walking and flying speeds respectively, while the first byte is used to determine the value of 4 booleans.
+
Note, notchian clients send a close window message with window id 0 to close their inventory even though there is never an Open Window message for inventory.  
  
The vanilla client sends this packet when the player starts/stops flying with the Flags parameter changed accordingly. All other parameters are ignored by the vanilla server.
+
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| 0x0D || rowspan=1 | Play || rowspan=1 | Server
 +
| Window id || byte || This is the id of the window that was closed. 0 for inventory.
 +
|}
  
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="3"| 0x12
 
|rowspan="3"| Play
 
|rowspan="3"| Server
 
| Flags
 
| Byte
 
| Bit mask. 0x08: damage disabled (god mode), 0x04: can fly, 0x02: is flying, 0x01: is Creative
 
|-
 
| Flying Speed
 
| Float
 
|
 
|-
 
| Walking Speed
 
| Float
 
|
 
|}
 
  
==== Player Digging ====
+
==== Click Window ====
  
Sent when the player mines a block. A Notchian server only accepts digging packets with coordinates within a 6-unit radius between the center of the block and 1.5 units from the player's feet (''not'' their eyes).
+
This packet is sent by the player when it clicks on a slot in a window.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="6" | 0x0E || rowspan=6 | Play || rowspan=6 | Server
! Field Name
+
| Window ID || Byte || The id of the window which was clicked. 0 for player inventory.
! Field Type
+
|-
! Notes
+
| Slot || Short || The clicked slot. See below.
|-
+
|-
|rowspan="3"| 0x13
+
| Button || Byte || The button used in the click. See below.
|rowspan="3"| Play
+
|-
|rowspan="3"| Server
+
| Action number || Short || A unique number for the action, used for transaction handling (See the Transaction packet).
| Status
+
|-
| VarInt Enum
+
| Mode || Byte || Inventory operation mode. See below.
| The action the player is taking against the block (see below)
+
|-
|-
+
| Clicked item || [[Slot_Data|Slot]] ||
| Location
+
|}
| Position
 
| Block position
 
|-
 
| Face
 
| Byte Enum
 
| The face being hit (see below)
 
|}
 
  
Status can be one of seven values:
+
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
  
{| class="wikitable"
+
When right-clicking on a stack of items, half the stack will be picked up and half left in the slot. If the stack is an odd number, the half left in the slot will be smaller of the amounts.
! Value
 
! Meaning
 
! Notes
 
|-
 
| 0
 
| Started digging
 
|
 
|-
 
| 1
 
| Cancelled digging
 
| Sent when the player lets go of the Mine Block key (default: left click)
 
|-
 
| 2
 
| Finished digging
 
| Sent when the client thinks it is finished
 
|-
 
| 3
 
| Drop item stack
 
  | Triggered by using the Drop Item key (default: Q) with the modifier to drop the entire selected stack (default: depends on OS). Location is always set to 0/0/0, Face is always set to -Y.
 
|-
 
| 4
 
| Drop item
 
| Triggered by using the Drop Item key (default: Q). Location is always set to 0/0/0, Face is always set to -Y.
 
|-
 
| 5
 
| Shoot arrow / finish eating
 
| Location is always set to 0/0/0, Face is always set to Special.
 
|-
 
| 6
 
| Swap item in hand
 
| Used to swap or assign an item to the second hand. Location is always set to 0/0/0, Face is always set to -Y.
 
|}
 
  
The Face field can be one of the following values, representing the face being hit (or the Special value used for “shoot arrow / finish eating”):
+
The Action number is actually a counter, starting at 1.  This number is used by the server as a transaction ID to send back a [[#0x6A|Transaction packet]].
  
 +
The distinct type of click performed by the client is determined by the combination of the "Mode" and "Button" fields.
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Mode !! Button !! Slot !! Trigger
! Value
+
|-
! Offset
+
! rowspan="2" | 0
! Face
+
| 0 || Normal || Left mouse click
|-
+
|-
| 0
+
| 1 || Normal || Right mouse click
| -Y
+
|-
| Bottom
+
! rowspan="2" | 1
|-
+
| 0 || Normal || Shift + left mouse click
| 1
+
|-
| +Y
+
| 1 || Normal || Shift + right mouse click ''(Identical behavior)''
| Top
+
|-
|-
+
! rowspan="5" | 2
| 2
+
| 0 || Normal || Number key 1
| -Z
+
|-
| North
+
| 1 || Normal || Number key 2
|-
+
|-
| 3
+
| 2 || Normal || Number key 3
| +Z
+
|-
| South
+
| ...
|-
+
| ...
| 4
+
| ...
| -X
+
|-
| West
+
| 8 || Normal || Number key 9
|-
+
|-
| 5
+
! rowspan="1" | 3
| +X
+
| 2 || Normal || Middle click
| East
+
|-
|-
+
! rowspan="4" | 4
| 255
+
| 0 || Normal || Drop key (Q)
|
+
|-
| Special
+
| 1 || Normal || Ctrl + Drop key (Ctrl-Q)
|}
+
|-
 +
| 0 || -999 || Left click outside inventory holding nothing ''(No-op)''
 +
|-
 +
| 1 || -999 || Right click outside inventory holding nothing ''(No-op)''
 +
|-
 +
! rowspan="6" | 5
 +
| 0 || -999 || Starting left mouse drag ''(Or middle mouse)''
 +
|-
 +
| 4 || -999 || Starting right mouse drag
 +
|-
 +
| 1 || Normal || Add slot for left-mouse drag
 +
|-
 +
| 5 || Normal || Add slot for right-mouse drag
 +
|-
 +
| 2 || -999 || Ending left mouse drag
 +
|-
 +
| 6 || -999 || Ending right mouse drag
 +
|-
 +
! 6
 +
| 0 || Normal || Double click
 +
|}
  
==== Entity Action ====
+
Starting from version 1.5, "painting mode" is available for use in inventory windows. It is done by picking up stack of something (more than 1 items), then holding mouse button (left, right or middle) and dragging holded stack over empty (or same type in case of right button ) slots. In that case client sends the following to server after mouse button release (omitting first pickup packet which is sent as usual):
  
Sent by the client to indicate that it has performed certain actions: sneaking (crouching), sprinting, exiting a bed, jumping with a horse, and opening a horse's inventory while riding it.
+
# packet with mode 5, slot -999 , button (0 for left | 4 for right);
 
+
# packet for every slot painted on, mode is still 5, button (1 | 5);
{| class="wikitable"
+
# packet with mode 5, slot -999, button (2 | 6);
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="3"| 0x14
 
|rowspan="3"| Play
 
|rowspan="3"| Server
 
| Entity ID
 
| VarInt
 
| Player ID
 
|-
 
| Action ID
 
| VarInt Enum
 
| The ID of the action, see below
 
|-
 
| Jump Boost
 
| VarInt
 
| Only used by the “start jump with horse” action, in which case it ranges from 0 to 100. In all other cases it is 0.
 
|}
 
  
Action ID can be one of the following values:
+
If any of the painting packets other than the "progress" ones are sent out of order (for example, a start, some slots, then another start; or a left-click in the middle) the painting status will be reset.
  
 +
==== Confirm Transaction ====
 
{| class="wikitable"
 
{| class="wikitable"
! ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Action
+
|-
|-
+
| rowspan="3" | 0x0F || rowspan=3 | Play || rowspan=3 | Server
| 0
+
| Window ID || Byte || The id of the window that the action occurred in.
| Start sneaking
+
|-
|-
+
| Action number || Short || Every action that is to be accepted has a unique number. This field corresponds to that number.
| 1
+
|-
| Stop sneaking
+
| Accepted || Bool || Whether the action was accepted.
|-
+
|}
| 2
 
| Leave bed
 
|-
 
| 3
 
| Start sprinting
 
|-
 
| 4
 
| Stop sprinting
 
|-
 
| 5
 
| Start jump with horse
 
|-
 
| 6
 
| Stop jump with horse
 
|-
 
| 7
 
| Open horse inventory
 
|-
 
| 8
 
| Start flying with elytra
 
|}
 
  
Leave bed is only sent when the “Leave Bed” button is clicked on the sleep GUI, not when waking up due today time.
+
==== Creative Inventory Action ====
 
 
Open horse inventory is only sent when pressing the inventory key (default: E) while on a horse — all other methods of opening a horse's inventory (involving right-clicking or shift-right-clicking it) do not use this packet.
 
  
“Open inventory” is now sent via the [[#Client Status|Client Status]] ([[#Play|Play]], 0x03, serverbound) packet.
+
While the user is in the standard inventory (i.e., not a crafting bench) on a creative-mode server then the server will send this packet:
  
==== Steer Vehicle ====
+
* If an item is dropped into the quick bar
 +
* If an item is picked up from the quick bar (item id is -1)
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="2" | 0x10 || rowspan=2 | Play || rowspan=2 | Server
! Field Name
+
| Slot || Short || Inventory slot
! Field Type
+
|-
! Notes
+
| Clicked item || [[Slot_Data|Slot]] ||
|-
+
|}
|rowspan="3"| 0x15
 
|rowspan="3"| Play
 
|rowspan="3"| Server
 
| Sideways
 
| Float
 
| Positive to the left of the player
 
|-
 
| Forward
 
| Float
 
| Positive forward
 
|-
 
| Flags
 
| Unsigned Byte
 
| Bit mask. 0x1: jump, 0x2: unmount
 
|}
 
 
 
==== Resource Pack Status ====
 
  
 +
==== Enchant Item ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="2" | 0x11 || rowspan=2 | Play || rowspan=2 | Server
! Field Name
+
| Window ID || Byte || The ID sent by [[#0x64|Open Window]]
! Field Type
+
|-
! Notes
+
| Enchantment || Byte || The position of the enchantment on the enchantment table window, starting with 0 as the topmost one.
|-
+
|}
|rowspan="2"| 0x16
 
|rowspan="2"| Play
 
|rowspan="2"| Server
 
| Hash
 
| String
 
| The hash sent in the [[#Resource Pack Send|Resource Pack Send]] packet.
 
|-
 
| Result
 
| VarInt Enum
 
| 0: successfully loaded, 1: declined, 2: failed download, 3: accepted
 
|}
 
  
==== Held Item Change (serverbound) ====
+
==== Update Sign ====
  
Sent when the player changes the slot selection
+
This message is sent from the client to the server when the "Done" button is pushed after placing a sign.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="7" | 0x12 || rowspan=7 | Play || rowspan=7 | Server
! Field Name
+
| X || Int || Block X Coordinate
! Field Type
+
|-
! Notes
+
| Y || Short || Block Y Coordinate
|-
+
|-
|rowspan="1"| 0x17
+
| Z || Int || Block Z Coordinate
|rowspan="1"| Play
+
|-
|rowspan="1"| Server
+
| Line 1 || String || First line of text in the sign
| Slot
+
|-
| Short
+
| Line 2 || String || Second line of text in the sign
| The slot which the player has selected (0–8)
+
|-
|}
+
| Line 3 || String || Third line of text in the sign
 +
|-
 +
| Line 4 || String || Fourth line of text in the sign
 +
|}
  
==== Creative Inventory Action ====
+
==== Player Abilities ====
  
While the user is in the standard inventory (i.e., not a crafting bench) in Creative mode, the player will send this packet.
+
The latter 2 bytes are used to indicate the walking and flying speeds respectively, while the first byte is used to determine the value of 4 booleans.
 
+
Clicking in the creative inventory menu is quite different from non-creative inventory management. Picking up an item with the mouse actually deletes the item from the server, and placing an item into a slot or dropping it out of the inventory actually tells the server to create the item from scratch. (This can be verified by clicking an item that you don't mind deleting, then severing the connection to the server; the item will be nowhere to be found when you log back in.) As a result of this implementation strategy, the "Destroy Item" slot is just a client-side implementation detail that means "I don't intend to recreate this item.". Additionally, the long listings of items (by category, etc.) are a client-side interface for choosing which item to create. Picking up an item from such listings sends no packets to the server; only when you put it somewhere does it tell the server to create the item in that location.
+
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).
 
+
This action can be described as "set inventory slot". Picking up an item sets the slot to item ID -1. Placing an item into an inventory slot sets the slot to the specified item. Dropping an item (by clicking outside the window) effectively sets slot -1 to the specified item, which causes the server to spawn the item entity, etc.. All other inventory slots are numbered the same as the non-creative inventory (including slots for the 2x2 crafting menu, even though they aren't visible in the vanilla client).
+
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.
 +
The vanilla client sends this packet when the player starts/stops flying with the second parameter changed accordingly. All other parameters are ignored by the vanilla server.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x13 || rowspan=3 | Play || rowspan=3 | Server
! Field Name
+
| Flags || Byte ||
! Field Type
+
|-
! Notes
+
| Flying speed || Float|| previous integer value divided by 250
|-
+
|-
|rowspan="2"| 0x18
+
| Walking speed || Float || previous integer value divided by 250
|rowspan="2"| Play
+
|}
|rowspan="2"| Server
 
| Slot
 
| Short
 
| Inventory slot
 
|-
 
| Clicked Item
 
| [[Slot Data|Slot]]
 
|  
 
|}
 
 
 
==== Update Sign ====
 
  
{{anchor|Update Sign (serverbound)}}This message is sent from the client to the server when the “Done” button is pushed after placing a sign.
+
==== Tab-Complete ====
  
The server only accepts this packet after [[#Open Sign Editor|Open Sign Editor]] ([[#Play|Play]], 0x2A, clientbound), otherwise this packet is silently ignored.
+
Sent when the user presses [tab] while writing text. The payload contains all text behind the cursor.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| 0x14 || rowspan=1 | Play || rowspan=1 | Server
! Field Name
+
| Text || String ||
! Field Type
+
|}
! Notes
 
|-
 
  |rowspan="5"| 0x19
 
|rowspan="5"| Play
 
|rowspan="5"| Server
 
| Location
 
| Position
 
| Block Coordinates
 
|-
 
| Line 1
 
| String
 
| First line of text in the sign
 
|-
 
| Line 2
 
| String
 
| Second line of text in the sign
 
|-
 
| Line 3
 
| String
 
| Third line of text in the sign
 
|-
 
| Line 4
 
| String
 
| Fourth line of text in the sign
 
|}
 
  
==== Animation (serverbound) ====
+
==== Client Settings ====
  
Sent when the player's arm swings.
+
Sent when the player connects, or when settings are changed.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="6" | 0x15 || rowspan=6 | Play || rowspan=6 | Server
! Field Name
+
| Locale || String || en_GB
! Field Type
+
|-
! Notes
+
| View distance || Byte || Client-side render distance(chunks)
|-
+
|-
| 0x1A
+
| Chat flags || Byte || Chat settings. See notes below.
| Play
+
|-
| Server
+
| Chat colours || Bool || "Colours" multiplayer setting
| Hand
+
|-
| VarInt Enum
+
| Difficulty || Byte || Client-side difficulty from options.txt
| Hand used for the animation. 0: main hand, 1: off hand.
+
|-
|}
+
| Show Cape || Bool || Show Cape multiplayer setting
 +
|}
 +
 
 +
Chat flags has several values packed into one byte.
  
==== Spectate ====
+
'''Chat Enabled:''' Bits 0-1. 00: Enabled.  01: Commands only.  10: Hidden.
  
Teleports the player to the given entity.  The player must be in spectator mode.
+
==== Client Status ====
  
The Notchian client only uses this to teleport to players, but it appears to accept any type of entity.  The entity does not need to be in the same dimension as the player; if necessary, the player will be respawned in the right world.  If the given entity cannot be found (or isn't loaded), this packet will be ignored.  It will also be ignored if the player attempts to teleport to themselves.
+
Sent when the client is ready to complete login and when the client is ready to respawn after death.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x16 || rowspan=1 | Play || rowspan=1 | Server
! Field Name
+
| Action ID || Byte || See below
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="1"| 0x1B
 
|rowspan="1"| Play
 
|rowspan="1"| Server
 
| Target Player
 
| UUID
 
| UUID of the player to teleport to (can also be an entity UUID)
 
|}
 
 
 
==== Player Block Placement ====
 
  
 +
Action ID values:
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
|-
! Packet ID
+
! Action ID !! Name
! State
+
|-
! Bound To
+
| 0 || Perform respawn
! Field Name
+
|-
! Field Type
+
| 1 || Request stats
! Notes
+
|-
|-
+
| 2 || Open inventory achievement
|rowspan="6"| 0x1C
+
|}
|rowspan="6"| Play
 
|rowspan="6"| Server
 
| Location
 
| Position
 
| Block position
 
|-
 
| Face
 
| VarInt Enum
 
| The face on which the block is placed (as documented at [[#Player Digging|Player Digging]])
 
|-
 
| Hand
 
| VarInt Enum
 
| The hand from which the block is placed; 0: main hand, 1: off hand
 
|-
 
| Cursor Position X
 
| Unsigned Byte
 
| The position of the crosshair on the block, from 0 to 15 increasing from west to east
 
|-
 
| Cursor Position Y
 
| Unsigned Byte
 
| The position of the crosshair on the block, from 0 to 15 increasing from bottom to top
 
|-
 
| Cursor Position Z
 
| Unsigned Byte
 
| The position of the crosshair on the block, from 0 to 15 increasing from north to south
 
|}
 
  
In normal operation (i.e. placing a block), this packet is sent once, with the values set normally.
+
==== Plugin Message ====
  
The Cursor Position X/Y/Z fields (also known as in-block coordinates) are calculated using raytracing. The unit corresponds to one pixel in the default resource pack. For example, let's say a slab is being placed against the south face of a full block. The Cursor Position X will be higher if the player was pointing near the right (east) edge of the face, lower if pointing near the left. The Cursor Position Y will be used to determine whether it will appear as a bottom slab (values 0–7) or as a top slab (values 8–15). The Cursor Position Z should be 15 since the player was looking at the southernmost part of the block.
+
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>.
  
This packet has a special case where X, Y, Z, and Face are all -1. (Note that Y is unsigned so set to 255.) This special packet indicates that the currently held item for the player should have its state updated such as eating food, pulling back bows, using buckets, etc.
+
More documentation on this: http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/
 
 
Special note on using buckets: When using buckets, the Notchian client might send two packets: first a normal and then a special case. The first normal packet is sent when you're looking at a block (e.g. the water you want to scoop up). This normal packet does not appear to do anything with a Notchian server. The second, special case packet appears to perform the action — based on current position/orientation and with a distance check — it appears that buckets can only be used within a radius of 6 units.
 
 
 
==== Use Item ====
 
 
 
Sent when pressing the Use Item key (default: right click) with an item in hand.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan="3" | 0x17 || rowspan=3 | Play || rowspan=3 | Server
! Field Name
+
| Channel || String || Name of the "channel" used to send the data.
! Field Type
+
|-
! Notes
+
| Length || Short || Length of the following byte array
|-
+
|-
| 0x1D
+
| Data || Byte Array || Any data.
| Play
+
|}
| Server
 
| Hand
 
| VarInt Enum
 
| Hand used for the animation. 0: main hand, 1: off hand.
 
|}
 
  
 
== Status ==
 
== Status ==
{{Main|Server List Ping}}
+
The status ping works as follows.
 +
    C->S : Handshake State=1
 +
    C->S : Request
 +
    S->C : Response
 +
    C->S : Ping
 +
    S->C : Ping
  
 
=== Clientbound ===
 
=== Clientbound ===
  
 
==== Response ====
 
==== Response ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x00  || rowspan=1 | Status || rowspan=1 | Client
! Field Name
+
| JSON Response || String || https://gist.github.com/thinkofdeath/6927216
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="1"| 0x00
 
  |rowspan="1"| Status
 
|rowspan="1"| Client
 
| JSON Response
 
| String
 
| See [[Server List Ping#Response]]
 
|}
 
  
==== Pong ====
 
  
 +
==== Ping ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x01  || rowspan=1 | Status || rowspan=1 | Client
! Field Name
+
| Time || Long || Should be the same as sent by the client
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="1"| 0x01
 
  |rowspan="1"| Status
 
|rowspan="1"| Client
 
| Payload
 
| Long
 
| Should be the same as sent by the client
 
|}
 
  
 
=== Serverbound ===
 
=== Serverbound ===
  
 
==== Request ====
 
==== Request ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=1 | 0x00 || Status || Server || || ||
 +
|}
  
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="1"| 0x00
 
| Status
 
| Server
 
|colspan="3"| ''no fields''
 
|}
 
  
 
==== Ping ====
 
==== Ping ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x01  || rowspan=1 | Status || rowspan=1 | Server
! Field Name
+
| Time || Long ||
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="1"| 0x01
 
  |rowspan="1"| Status
 
|rowspan="1"| Server
 
| Payload
 
| Long
 
| May be any number. Notchian clients use a system-dependent time value which is counted in milliseconds.
 
|}
 
  
 
== Login ==
 
== Login ==
  
 
The login process is as follows:
 
The login process is as follows:
 +
    C->S : Handshake State=2
 +
    C->S : Login Start
 +
    S->C : Encryption Key Request
 +
    (Client Auth)
 +
    C->S : Encryption Key Response
 +
    (Server Auth, Both enable encryption)
 +
    S->C : Login Success
  
# C→S: [[#Handshake|Handshake]] with Next State set to 2 (login)
+
For unauthenticated and* localhost connections there is no encryption.
# C→S: [[#Login Start|Login Start]]
+
In that case Login Start is directly followed by Login Success.
# S→C: [[#Encryption Request|Encryption Request]]
 
# Client auth
 
# C→S: [[#Encryption Response|Encryption Response]]
 
# Server auth, both enable encryption
 
# S→C: [[#Login Success|Login Success]] and Set Compression
 
 
 
Login Success and Set Compression can be sent in either order, but anything after Set Compression must use the [[#With_compression|Post Compression packet format]]. The packet ID for Set Compression also depends on the current connection state, and Login Success switches the state to [[#Play|play]], meaning that the correct packet ID must be used depending on the order chosen.
 
  
For unauthenticated and localhost connections (either of the two conditions is enough for an unencrypted connection) there is no encryption. In that case [[#Login Start|Login Start]] is directly followed by [[#Login Success|Login Success]].
+
<nowiki>*</nowiki> It could be that only one of the two conditions is enough for an unencrypted connection.
  
 
See [[Protocol Encryption]] for details.
 
See [[Protocol Encryption]] for details.
Line 5,047: Line 2,241:
 
=== Clientbound ===
 
=== Clientbound ===
  
==== Disconnect (login) ====
+
==== Disconnect ====
 
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x00 || rowspan=1 | Login || rowspan=1 | Client
! Field Name
+
| JSON Data || String ||
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="1"| 0x00
 
|rowspan="1"| Login
 
|rowspan="1"| Client
 
| Reason
 
| [[Chat]]
 
|  
 
|}
 
  
 
==== Encryption Request ====
 
==== Encryption Request ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=5 | 0x01  || rowspan=5 | Login || rowspan=5 | Client
! Field Name
+
| Server ID || String || appears to be empty as of 1.7.x
! Field Type
+
|-
! Notes
+
| Length || Short || length of public key
|-
+
|-
|rowspan="5"| 0x01
+
| Public Key || Byte array ||  
  |rowspan="5"| Login
+
|-
|rowspan="5"| Client
+
| Length || Short || length of verify token
| Server ID
+
|-
| String
+
| Verify Token || Byte array ||
| Appears to be empty
+
|-
|-
+
|}
| Public Key Length
 
| VarInt
 
| Length of Public Key
 
|-
 
| Public Key
 
| Byte Array
 
|  
 
|-
 
| Verify Token Length
 
| VarInt
 
| Length of Verify Token. Always 4 for Notchian servers.
 
|-
 
| Verify Token
 
| Byte Array
 
| A sequence of random bytes generated by the server
 
|}
 
  
 
See [[Protocol Encryption]] for details.
 
See [[Protocol Encryption]] for details.
  
 
==== Login Success ====
 
==== Login Success ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=2 | 0x02 || rowspan=2 | Login || rowspan=2 | Client
! Field Name
+
| UUID || String ||
! Field Type
+
|-
! Notes
+
| Username || String ||
|-
+
|}
|rowspan="2"| 0x02
 
|rowspan="2"| Login
 
|rowspan="2"| Client
 
| UUID
 
| String
 
| Unlike in other packets, this field contains the UUID as a string with hyphens.
 
|-
 
| Username
 
| String
 
|  
 
|}
 
 
 
This packet switches the connection state to [[#Play|play]].
 
 
 
==== Set Compression ====
 
 
 
{| class="wikitable"
 
! Packet ID
 
! State
 
! Bound To
 
! Field Name
 
! Field Type
 
! Notes
 
|-
 
|rowspan="1"| 0x03
 
|rowspan="1"| Login
 
|rowspan="1"| Client
 
| Threshold
 
| VarInt
 
| Maximum size of a packet before it is compressed
 
|}
 
  
 
=== Serverbound ===
 
=== Serverbound ===
  
 
==== Login Start  ====
 
==== Login Start  ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=1 | 0x00 || rowspan=1 | Login || rowspan=1 | Server
! Field Name
+
| Name || String ||  
! Field Type
+
|}
! Notes
 
|-
 
|rowspan="1"| 0x00
 
|rowspan="1"| Login
 
|rowspan="1"| Server
 
| Name
 
| String
 
|  
 
|}
 
  
 
==== Encryption Response ====
 
==== Encryption Response ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! State
+
|-
! Bound To
+
| rowspan=4 | 0x01  || rowspan=4 | Login || rowspan=4 | Server
! Field Name
+
| Length || Short || length of shared secret
! Field Type
+
|-
! Notes
+
| Shared Secret || Byte array ||  
|-
+
|-
|rowspan="4"| 0x01
+
| Length || Short || length of verify token
  |rowspan="4"| Login
+
|-
|rowspan="4"| Server
+
| Verify Token || Byte array ||
| Shared Secret Length
+
|-
| VarInt
+
|}
| Length of Shared Secret
 
|-
 
| Shared Secret
 
| Byte Array
 
|  
 
|-
 
| Verify Token Length
 
| VarInt
 
| Length of Verify Token
 
|-
 
| Verify Token
 
| Byte Array
 
|  
 
|}
 
  
 
See [[Protocol Encryption]] for details.
 
See [[Protocol Encryption]] for details.
 +
 +
== See Also ==
 +
* [[Data Types]]
 +
* [[Protocol History]]
 +
* [[Units of Measurement]]
  
 
[[Category:Protocol Details]]
 
[[Category:Protocol Details]]
 
[[Category:Minecraft Modern]]
 
[[Category:Minecraft Modern]]

Revision as of 18:34, 13 May 2016

This page presents a dissection of the current stable Minecraft protocol. The current pre-release protocol is documented elsewhere. The protocol for Pocket Minecraft is substantially different, and is documented at Pocket Minecraft Protocol.

If you're having trouble, check out the FAQ or ask for help in the IRC channel (#mcdevs on irc.freenode.net).

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.

Warning.png As of 1.7 strings are now UTF-8 (prefixed with a VarInt giving the string's length in bytes) instead of UTF-16.

Warning.png As of 1.7.6 all UUIDs used in the protocol now contain '-'. The session server still returns them without

The changes between versions may be viewed at Protocol History

Contents

Definitions

Data types

All data sent over the network (except for VarInt and VarLong) is big-endian, that is the bytes are sent from most significant byte to least significant byte. The majority of everyday computers are little-endian, therefore it may be necessary to change the endianness before sending data over the network.


Name Size (bytes) Encodes Notes
Boolean 1 Either false or true True is encoded as 0x01, false as 0x00.
Byte 1 An integer between -128 and 127 Signed 8-bit integer, two's complement
Unsigned Byte 1 An integer between 0 and 255 Unsigned 8-bit integer
Short 2 An integer between -32768 and 32767 Signed 16-bit integer, two's complement
Unsigned Short 2 An integer between 0 and 65535 Unsigned 16-bit integer
Int 4 An integer between -2147483648 and 2147483647 Signed 32-bit integer, two's complement
Long 8 An integer between -9223372036854775808 and 9223372036854775807 Signed 64-bit integer, two's complement
Float 4 A single-precision 32-bit IEEE 754 floating point number
Double 8 A double-precision 64-bit IEEE 754 floating point number
String (n) ≥ 1
≤ (n×3) + 3
A sequence of Unicode scalar values UTF-8 string prefixed with its size in bytes as a VarInt. Maximum length of n characters, which varies by context. The encoding used on the wire is regular UTF-8, not Java's "slight modification". However, the length of the string for purposes of the length limit is its number of UTF-16 code units, that is, scalar values > U+FFFF are counted as two. Up to n × 3 bytes can be used to encode a UTF-8 string comprising n code units when converted to UTF-16, and both of those limits are checked. Maximum n value is 32767. The + 3 is due to the max size of a valid length VarInt.
Text Component Varies See Text formatting#Text components Encoded as a NBT Tag, with the type of tag used depending on the case:
  • As a String Tag: For components only containing text (no styling, no events etc.).
  • As a Compound Tag: Every other case.
JSON Text Component ≥ 1
≤ (262144×3) + 3
See Text formatting#Text components The maximum permitted length when decoding is 262144, but the Notchian server since 1.20.3 refuses to encode longer than 32767. This may be a bug.
Identifier ≥ 1
≤ (32767×3) + 3
See Identifier below Encoded as a String with max length of 32767.
VarInt ≥ 1
≤ 5
An integer between -2147483648 and 2147483647 Variable-length data encoding a two's complement signed 32-bit integer; more info in their section
VarLong ≥ 1
≤ 10
An integer between -9223372036854775808 and 9223372036854775807 Variable-length data encoding a two's complement signed 64-bit integer; more info in their section
Entity Metadata Varies Miscellaneous information about an entity See Entity_metadata#Entity Metadata Format
Slot Varies An item stack in an inventory or container See Slot Data
NBT Varies Depends on context See NBT
Position 8 An integer/block position: x (-33554432 to 33554431), z (-33554432 to 33554431), y (-2048 to 2047) x as a 26-bit integer, followed by z as a 26-bit integer, followed by y as a 12-bit integer (all signed, two's complement). See also the section below.
Angle 1 A rotation angle in steps of 1/256 of a full turn Whether or not this is signed does not matter, since the resulting angles are the same.
UUID 16 A UUID Encoded as an unsigned 128-bit integer (or two unsigned 64-bit integers: the most significant 64 bits and then the least significant 64 bits)
BitSet Varies See #BitSet below A length-prefixed bit set.
Fixed BitSet (n) ceil(n / 8) See #Fixed BitSet below A bit set with a fixed length of n bits.
Optional X 0 or size of X A field of type X, or nothing Whether or not the field is present must be known from the context.
Array of X count times size of X Zero or more fields of type X The count must be known from the context.
X Enum size of X A specific value from a given list The list of possible values and how each is encoded as an X must be known from the context. An invalid value sent by either side will usually result in the client being disconnected with an error or even crashing.
Byte Array Varies Depends on context This is just a sequence of zero or more bytes, its meaning should be explained somewhere else, e.g. in the packet description. The length must also be known from the context.
ID or X size of VarInt + (size of X or 0) See #ID or X below Either a registry ID or an inline data definition of type X.
ID Set Varies See #ID Set below Set of registry IDs specified either inline or as a reference to a tag.
Sound Event Varies See #Sound Event below Parameters for a sound event.

Identifier

Identifiers are a namespaced location, in the form of minecraft:thing. If the namespace is not provided, it defaults to minecraft (i.e. thing is minecraft:thing). Custom content should always be in its own namespace, not the default one. Both the namespace and value can use all lowercase alphanumeric characters (a-z and 0-9), dot (.), dash (-), and underscore (_). In addition, values can use slash (/). The naming convention is lower_case_with_underscores. More information. For ease of determining whether a namespace or value is valid, here are regular expressions for each:

  • Namespace: [a-z0-9.-_]
  • Value: [a-z0-9.-_/]

VarInt and VarLong

Variable-length format such that smaller numbers use fewer bytes. These are very similar to Protocol Buffer Varints: the 7 least significant bits are used to encode the value and the most significant bit indicates whether there's another byte after it for the next part of the number. The least significant group is written first, followed by each of the more significant groups; thus, VarInts are effectively little endian (however, groups are 7 bits, not 8).

VarInts are never longer than 5 bytes, and VarLongs are never longer than 10 bytes. Within these limits, unnecessarily long encodings (e.g. 81 00 to encode 1) are allowed.

Pseudocode to read and write VarInts and VarLongs:

private static final int SEGMENT_BITS = 0x7F;
private static final int CONTINUE_BIT = 0x80;
public int readVarInt() {
    int value = 0;
    int position = 0;
    byte currentByte;

    while (true) {
        currentByte = readByte();
        value |= (currentByte & SEGMENT_BITS) << position;

        if ((currentByte & CONTINUE_BIT) == 0) break;

        position += 7;

        if (position >= 32) throw new RuntimeException("VarInt is too big");
    }

    return value;
}
public long readVarLong() {
    long value = 0;
    int position = 0;
    byte currentByte;

    while (true) {
        currentByte = readByte();
        value |= (long) (currentByte & SEGMENT_BITS) << position;

        if ((currentByte & CONTINUE_BIT) == 0) break;

        position += 7;

        if (position >= 64) throw new RuntimeException("VarLong is too big");
    }

    return value;
}
public void writeVarInt(int value) {
    while (true) {
        if ((value & ~SEGMENT_BITS) == 0) {
            writeByte(value);
            return;
        }

        writeByte((value & SEGMENT_BITS) | CONTINUE_BIT);

        // Note: >>> means that the sign bit is shifted with the rest of the number rather than being left alone
        value >>>= 7;
    }
}
public void writeVarLong(long value) {
    while (true) {
        if ((value & ~((long) SEGMENT_BITS)) == 0) {
            writeByte(value);
            return;
        }

        writeByte((value & SEGMENT_BITS) | CONTINUE_BIT);

        // Note: >>> means that the sign bit is shifted with the rest of the number rather than being left alone
        value >>>= 7;
    }
}

Warning.png Note Minecraft's VarInts are identical to LEB128 with the slight change of throwing a exception if it goes over a set amount of bytes.

Warning.png Note that Minecraft's VarInts are not encoded using Protocol Buffers; it's just similar. If you try to use Protocol Buffers Varints with Minecraft's VarInts, you'll get incorrect results in some cases. The major differences:

  • Minecraft's VarInts are all signed, but do not use the ZigZag encoding. Protocol buffers have 3 types of Varints: uint32 (normal encoding, unsigned), sint32 (ZigZag encoding, signed), and int32 (normal encoding, signed). Minecraft's are the int32 variety. Because Minecraft uses the normal encoding instead of ZigZag encoding, negative values always use the maximum number of bytes.
  • Minecraft's VarInts are never longer than 5 bytes and its VarLongs will never be longer than 10 bytes, while Protocol Buffer Varints will always use 10 bytes when encoding negative numbers, even if it's an int32.

Sample VarInts:

Value Hex bytes Decimal bytes
0 0x00 0
1 0x01 1
2 0x02 2
127 0x7f 127
128 0x80 0x01 128 1
255 0xff 0x01 255 1
25565 0xdd 0xc7 0x01 221 199 1
2097151 0xff 0xff 0x7f 255 255 127
2147483647 0xff 0xff 0xff 0xff 0x07 255 255 255 255 7
-1 0xff 0xff 0xff 0xff 0x0f 255 255 255 255 15
-2147483648 0x80 0x80 0x80 0x80 0x08 128 128 128 128 8

Sample VarLongs:

Value Hex bytes Decimal bytes
0 0x00 0
1 0x01 1
2 0x02 2
127 0x7f 127
128 0x80 0x01 128 1
255 0xff 0x01 255 1
2147483647 0xff 0xff 0xff 0xff 0x07 255 255 255 255 7
9223372036854775807 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x7f 255 255 255 255 255 255 255 255 127
-1 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x01 255 255 255 255 255 255 255 255 255 1
-2147483648 0x80 0x80 0x80 0x80 0xf8 0xff 0xff 0xff 0xff 0x01 128 128 128 128 248 255 255 255 255 1
-9223372036854775808 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x01 128 128 128 128 128 128 128 128 128 1

Position

Note: What you are seeing here is the latest version of the Data types article, but the position type was different before 1.14.

64-bit value split into three signed integer parts:

  • x: 26 MSBs
  • z: 26 middle bits
  • y: 12 LSBs

For example, a 64-bit position can be broken down as follows:

Example value (big endian): 01000110000001110110001100 10110000010101101101001000 001100111111

  • The red value is the X coordinate, which is 18357644 in this example.
  • The blue value is the Z coordinate, which is -20882616 in this example.
  • The green value is the Y coordinate, which is 831 in this example.

Encoded as follows:

((x & 0x3FFFFFF) << 38) | ((z & 0x3FFFFFF) << 12) | (y & 0xFFF)

And decoded as:

val = read_long();
x = val >> 38;
y = val << 52 >> 52;
z = val << 26 >> 38;

Note: The above assumes that the right shift operator sign extends the value (this is called an arithmetic shift), so that the signedness of the coordinates is preserved. In many languages, this requires the integer type of val to be signed. In the absence of such an operator, the following may be useful:

if x >= 1 << 25 { x -= 1 << 26 }
if y >= 1 << 11 { y -= 1 << 12 }
if z >= 1 << 25 { z -= 1 << 26 }

Fixed-point numbers

Some fields may be stored as fixed-point numbers, where a certain number of bits represent the signed integer part (number to the left of the decimal point) and the rest represent the fractional part (to the right). Floating point numbers (float and double), in contrast, keep the number itself (mantissa) in one chunk, while the location of the decimal point (exponent) is stored beside it. Essentially, while fixed-point numbers have lower range than floating point numbers, their fractional precision is greater for higher values.

Prior to version 1.9 a fixed-point format with 5 fraction bits and 27 integer bits was used to send entity positions to the client. Some uses of fixed point remain in modern versions, but they differ from that format.

Most programming languages lack support for fractional integers directly, but you can represent them as integers. The following C or Java-like pseudocode converts a double to a fixed-point integer with n fraction bits:

 x_fixed = (int)(x_double * (1 << n));

And back again:

 x_double = (double)x_fixed / (1 << n);

Bit sets

The types BitSet and Fixed BitSet represent packed lists of bits. The Notchian implementation uses Java's BitSet class.

BitSet

Bit sets of type BitSet are prefixed by their length in longs.

Field Name Field Type Meaning
Length VarInt Number of longs in the following array. May be 0 (if no bits are set).
Data Array of Long A packed representation of the bit set as created by BitSet.toLongArray.

The ith bit is set when (Data[i / 64] & (1 << (i % 64))) != 0, where i starts at 0.

Fixed BitSet

Bit sets of type Fixed BitSet (n) have a fixed length of n bits, encoded as ceil(n / 8) bytes. Note that this is different from BitSet, which uses longs.

Field Name Field Type Meaning
Data Byte Array (n) A packed representation of the bit set as created by BitSet.toByteArray, padded with zeroes at the end to fit the specified length.

The ith bit is set when (Data[i / 8] & (1 << (i % 8))) != 0, where i starts at 0. This encoding is not equivalent to the long array in BitSet.

Registry references

ID or X

Represents a data record of type X, either inline, or by reference to a registry implied by context.

Field Name Field Type Meaning
ID VarInt 0 if value of type X is given inline; otherwise registry ID + 1.
Value Optional X Only present if ID is 0.

ID Set

Represents a set of IDs in a certain registry (implied by context), either directly (enumerated IDs) or indirectly (tag name).

Field Name Field Type Meaning
Type VarInt Value used to determine the data that follows. It can be either:
  • 0 - Represents a named set of IDs defined by a tag.
  • Anything else - Represents an ad-hoc set of IDs enumerated inline.
Tag Name Optional Identifier The registry tag defining the ID set. Only present if Type is 0.
IDs Optional Array of VarInt An array of registry IDs. Only present if Type is not 0.
The size of the array is equal to Type - 1.

Registry data

These types are commonly used in conjuction with ID or X to specify custom data inline.

Sound Event

Describes a sound that can be played.

Name Type Description
Sound Name Identifier
Has Fixed Range Boolean Whether this sound has a fixed range, as opposed to a variable volume based on distance.
Fixed Range Optional Float The maximum range of the sound. Only present if Has Fixed Range is true.


Other definitions

Term Definition
Player When used in the singular, Player always refers to the client connected to the server
Entity Entity refers to any item, player, mob, minecart or boat in the world. This definition is subject to change as Notch extends the protocol
EID An EID - or Entity ID - is a unique 4-byte integer used to identify a specific entity
XYZ In this document, the axis names are the same as those used by Notch. Y points upwards, X points South, and Z points West.
See also: Units of Measurement

Packets

Protocol Version

1.7.2 - 4

1.7.6 - 5

Packet format

Field Name Field Type Notes
Length VarInt Length of packet data + length of the packet ID
Packet ID VarInt
Data

Handshaking

Serverbound

Handshake

This causes the server to switch into the target state.

Packet ID Category Bound To Field Name Field Type Notes
0x00 Handshake Server Protocol Version VarInt (4 as of 1.7.2)
Server Address (hostname or IP) String localhost
Server Port Unsigned Short 25565
Next state VarInt 1 for status, 2 for login

Play

Clientbound

Keep Alive

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.

Packet ID Category Bound To Field Name Field Type Notes
0x00 Play Client Keep Alive ID Int

Join Game

See Protocol Encryption for information on logging in.

Packet ID Category Bound To Field Name Field Type Notes
0x01 Play Client Entity ID Int The player's Entity ID
Gamemode Unsigned Byte 0: survival, 1: creative, 2: adventure. Bit 3 (0x8) is the hardcore flag
Dimension Byte -1: nether, 0: overworld, 1: end
Difficulty Unsigned Byte 0 thru 3 for Peaceful, Easy, Normal, Hard
Max Players Unsigned Byte Used by the client to draw the player list
Level Type String default, flat, largeBiomes, amplified, default_1_1

Warning.png If the Dimension isn't valid then the client will crash

Chat Message

Packet ID Category Bound To Field Name Field Type Notes
0x02 Play Client JSON Data String Chat, Limited to 32767 bytes

Warning.png Malformed JSON will disconnect the client

Time Update

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 20 every second.

Packet ID Category Bound To Field Name Field Type Notes
0x03 Play Client Age of the world Long In ticks; not changed by server commands
Time of day Long The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time

Entity Equipment

Packet ID Category Bound To Field Name Field Type Notes
0x04 Play Client EntityID Int Entity's ID
Slot Short Equipment slot: 0=held, 1-4=armor slot (1 - boots, 2 - leggings, 3 - chestplate, 4 - helmet)
Item Slot Item in slot format

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.

Packet ID Category Bound To Field Name Field Type Notes
0x05 Play Client X Int Spawn X in block coordinates
Y Int Spawn Y in block coordinates
Z Int Spawn Z in block coordinates

Update Health

Sent by the server to update/set the health of the player it is sent to.

Food 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.

Packet ID Category Bound To Field Name Field Type Notes
0x06 Play Client Health Float 0 or less = dead, 20 = full HP
Food Short 0 - 20
Food Saturation Float Seems to vary from 0.0 to 5.0 in integer increments

Respawn

To change the player's dimension (overworld/nether/end), send them a respawn packet with the appropriate dimension, followed by prechunks/chunks for the new dimension, and finally a position and look packet. You do not need to unload chunks, the client will do it automatically.

Packet ID Category Bound To Field Name Field Type Notes
0x07 Play Client Dimension Int -1: The Nether, 0: The Overworld, 1: The End
Difficulty Unsigned Byte 0 thru 3 for Peaceful, Easy, Normal, Hard.
Gamemode Unsigned Byte 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
Level Type String Same as Join Game

Warning.png If the Dimension isn't valid then the client will crash

Warning.png Avoid changing player's dimension to same dimension they were already in, weird bugs can occur i.e. such player will be unable to attack other players in new world (fixes after their death and respawn)

Player Position And Look

Updates the players position on the server. If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 units will result in the client being kicked for "You moved too quickly :( (Hacking?)" Also if the fixed-point number of X or Z is set greater than 3.2E7D the client will be kicked for "Illegal position"

Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0,-1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.

Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.

The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:

 l = x-x0
 w = z-z0
 c = sqrt( l*l + w*w )
 alpha1 = -arcsin(l/c)/PI*180
 alpha2 =  arccos(w/c)/PI*180
 if alpha2 > 90 then
   yaw = 180 - alpha1
 else
   yaw = alpha1

You can get a unit vector from a given yaw/pitch via:

 x = -cos(pitch) * sin(yaw)
 y = -sin(pitch)
 z =  cos(pitch) * cos(yaw)
Packet ID Category Bound To Field Name Field Type Notes
0x08 Play Client X Double Absolute position
Y Double Absolute position (eyes pos)
Z Double Absolute position
Yaw Float Absolute rotation on the X Axis, in degrees
Pitch Float Absolute rotation on the Y Axis, in degrees
On Ground Bool True if the client is on the ground, False otherwise

Held Item Change

Sent to change the player's slot selection

Packet ID Category Bound To Field Name Field Type Notes
0x09 Play Client Slot Byte The slot which the player has selected (0-8)

Use Bed

This packet tells that a player goes to bed.

The client with the matching Entity ID will go into bed mode.

This Packet is sent to all nearby players including the one sent to bed.

Packet ID Category Bound To Field Name Field Type Notes
0x0A Play Client Entity ID Int Player ID
X Int Bed headboard X as block coordinate
Y Unsigned Byte Bed headboard Y as block coordinate
Z Int Bed headboard Z as block coordinate

Animation

Sent whenever an entity should change animation.

Packet ID Category Bound To Field Name Field Type Notes
0x0B Play Client Entity ID VarInt Player ID
Animation Unsigned Byte Animation ID

Animation can be one of the following values:

ID Animation
0 Swing arm
1 Damage animation
2 Leave bed
3 Eat food
4 Critical effect
5 Magic critical effect
102 (unknown)
104 Crouch
105 Uncrouch

Spawn Player

This packet is sent by the server when a player comes into visible range, not when a player joins.

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 :)
Packet ID Category Bound To Field Name Field Type Notes
0x0C Play Client Entity ID VarInt Player's Entity ID
Player UUID String Player's UUID
Player Name String Player's Name
Data count VarInt
Data Name String Name of the property as return by the session server's /hasJoined. E.g: textures
Value String Value of the property (base64) as return by the session server's /hasJoined
Signature String Signature of the property (base64) as return by the session server's /hasJoined.
X Int Player X as a Fixed-Point number
Y Int Player X as a Fixed-Point number
Z Int Player X as a Fixed-Point number
Yaw Byte Player rotation as a packed byte
Pitch Byte Player rotation as a packet byte
Current Item Short The item the player is currently holding. Note that this should be 0 for "no item", unlike -1 used in other packets. A negative value crashes clients.
Metadata Metadata The client will crash if no metadata is sent

Warning.png The client will crash if no metadata is sent Warning.png The client will disconnect if both UUID and Name are empty

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 and [Player Position & Look packet sent by the client.

Packet ID Category Bound To Field Name Field Type Notes
0x0D Play Client Collected Entity ID Int
Collector Entity ID Int

Spawn Object

Sent by the server when an Object/Vehicle is created.

Packet ID Category Bound To Field Name Field Type Notes
0x0E Play Client Entity ID VarInt Entity ID of the object
Type Byte The type of object (See Objects)
X Int X position as a Fixed-Point number
Y Int Y position as a Fixed-Point number
Z Int Z position as a Fixed-Point number
Pitch Byte The pitch in steps of 2p/256
Yaw Byte The yaw in steps of 2p/256
Data Object Data

Spawn Mob

Sent by the server when a Mob Entity is Spawned

Packet ID Category Bound To Field Name Field Type Notes
0x0F Play Client Entity ID VarInt Entity's ID
Type Unsigned Byte The type of mob. See Mobs
X Int X position as a Fixed-Point number
Y Int Y position as a Fixed-Point number
Z Int Z position as a Fixed-Point number
Yaw Byte The yaw in steps of 2p/256
Pitch Byte The pitch in steps of 2p/256
Head Pitch Byte The pitch in steps of 2p/256
Velocity X Short
Velocity Y Short
Velocity Z Short
Metadata Metadata

Spawn Painting

This packet shows location, name, and type of painting.

Calculating the center of an image: given a (width x height) grid of cells, with (0, 0) being the top left corner, the center is (max(0, width / 2 - 1), height / 2). E.g.

2x1 (1, 0) 4x4 (1, 2)


Packet ID Category Bound To Field Name Field Type Notes
0x10 Play Client Entity ID VarInt Entity's ID
Title String Name of the painting. Max length 13
X Int Center X coordinate
Y Int Center Y coordinate
Z Int Center Z coordinate
Direction Int Direction the painting faces (0 -z, 1 -x, 2 +z, 3 +x)

Spawn Experience Orb

Spawns one or more experience orbs.

Packet ID Category Bound To Field Name Field Type Notes
0x11 Play Client Entity ID VarInt Entity's ID
X Int X position as a Fixed-Point number
Y Int Y position as a Fixed-Point number
Z Int Z position as a Fixed-Point number
Count Short The amount of experience this orb will reward once collected

Entity Velocity

Velocity is believed to be in units of 1/8000 of a block per server tick (50ms); for example, -1343 would move (-1343 / 8000) = -0.167875 blocks per tick (or -3,3575 blocks per second).

Packet ID Category Bound To Field Name Field Type Notes
0x12 Play Client Entity ID Int Entity's ID
Velocity X Short Velocity on the X axis
Velocity Y Short Velocity on the Y axis
Velocity Z Short Velocity on the Z axis

Destroy Entities

Sent by the server when an list of Entities is to be destroyed on the client.

Packet ID Category Bound To Field Name Field Type Notes
0x13 Play Client Count Byte Length of following array
Entity IDs Array of Int The list of entities of destroy

Entity

Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.

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.

Packet ID Category Bound To Field Name Field Type Notes
0x14 Play Client Entity ID Int Entity's ID

Entity Relative Move

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 should be sent instead.

This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.

Packet ID Category Bound To Field Name Field Type Notes
0x15 Play Client Entity ID Int Entity's ID
DX Byte Change in X position as a Fixed-Point number
DY Byte Change in Y position as a Fixed-Point number
DZ Byte Change in Z position as a Fixed-Point number

Entity Look

This packet is sent by the server when an entity rotates. Example: "Yaw" field 64 means a 90 degree turn.

Packet ID Category Bound To Field Name Field Type Notes
0x16 Play Client Entity ID Int Entity's ID
Yaw Byte The X Axis rotation as a fraction of 360
Pitch Byte The Y Axis rotation as a fraction of 360

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)

Packet ID Category Bound To Field Name Field Type Notes
0x17 Play Client Entity ID Int Entity's ID
DX Byte Change in X position as a Fixed-Point number
DY Byte Change in Y position as a Fixed-Point number
DZ Byte Change in Z position as a Fixed-Point number
Yaw Byte The X Axis rotation as a fraction of 360
Pitch Byte The Y Axis rotation as a fraction of 360

Entity Teleport

This packet is sent by the server when an entity moves more than 4 blocks.

Packet ID Category Bound To Field Name Field Type Notes
0x18 Play Client Entity ID Int Entity's ID
X Int X position as a Fixed-Point number
Y Int Y position as a Fixed-Point number
Z Int Z position as a Fixed-Point number
Yaw Byte The X Axis rotation as a fraction of 360
Pitch Byte The Y Axis rotation as a fraction of 360

Entity Head Look

Changes the direction an entity's head is facing.

Packet ID Category Bound To Field Name Field Type Notes
0x19 Play Client Entity ID Int Entity's ID
Head Yaw Byte Head yaw in steps of 2p/256

Entity Status

Packet ID Category Bound To Field Name Field Type Notes
0x1A Play Client Entity ID Int Entity's ID
Entity Status Byte See below
Entity Status Meaning
0 Something related to living entities?
1 Something related to the player entity?
2 Living Entity hurt
3 Living Entity dead
4 Iron Golem throwing up arms
6 Wolf/Ocelot/Horse taming - Spawn "heart" particles
7 Wolf/Ocelot/Horse tamed - Spawn "smoke" particles
8 Wolf shaking water - Trigger the shaking animation
9 (of self) Eating accepted by server
10 Sheep eating grass
11 Iron Golem handing over a rose
12 Villager mating - Spawn "heart" particles
13 Spawn particles indicating that a villager is angry and seeking revenge
14 Spawn happy particles near a villager
15 Witch animation - Spawn "magic" particles
16 Zombie converting into a villager by shaking violently
17 Firework exploding
18 Animal in love (ready to mate) - Spawn "heart" particles

Attach Entity

This packet is sent when a player has been attached to an entity (e.g. Minecart)

Packet ID Category Bound To Field Name Field Type Notes
0x1B Play Client Entity ID Int Entity's ID
Vehicle ID Int Vechicle's Entity ID
Leash Bool If true leashes the entity to the vehicle

Entity Metadata

Packet ID Category Bound To Field Name Field Type Notes
0x1C Play Client Entity ID Int Entity's ID
Metadata Metadata

Entity Effect

Packet ID Category Bound To Field Name Field Type Notes
0x1D Play Client Entity ID Int Entity's ID
Effect ID Byte See [[1]]
Amplifier Byte
Duration Short

Remove Entity Effect

Packet ID Category Bound To Field Name Field Type Notes
0x1E Play Client Entity ID Int Entity's ID
Effect ID Byte

Set Experience

Sent by the server when the client should change experience levels.

Packet ID Category Bound To Field Name Field Type Notes
0x1F Play Client Experience bar Float Between 0 and 1
Level Short
Total Experience Short

Entity Properties

Packet ID Category Bound To Field Name Field Type Notes
0x20 Play Client Entity ID Int Entity's ID
Count Int Length of following array
Properties Array of Property Data

Property Data structure:

Field Name Field Type Notes
Key String
Value Double
List Length Short Number of list elements that follow.
Modifiers Array of Modifier Data http://www.minecraftwiki.net/wiki/Attribute#Modifiers

Known key values:

Key Default Min Max Label
generic.maxHealth 20.0 0.0 Double.MaxValue Max Health
generic.followRange 32.0 0.0 2048.0 Follow Range
generic.knockbackResistance 0.0 0.0 1.0 Knockback Resistance
generic.movementSpeed 0.699999988079071 0.0 Double.MaxValue Movement Speed
generic.attackDamage 2.0 0.0 Double.MaxValue
horse.jumpStrength 0.7 0.0 2.0 Jump Strength
zombie.spawnReinforcements 0.0 0.0 1.0 Spawn Reinforcements Chance

Modifier Data structure:

Field Name Field Type Notes
UUID 128-bit integer
Amount Double
Operation Byte

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

Packet ID Category Bound To Field Name Field Type Notes
0x21 Play Client Chunk X Int Chunk X coordinate
Chunk Z Int Chunk Z coordinate
Ground-Up continuous Boolean This is True if the packet represents all sections in this vertical column, where the primary bit map specifies exactly which sections are included, and which are air
Primary bit map Unsigned Short Bitmask with 1 for every 16x16x16 section which data follows in the compressed data.
Add bit map Unsigned Short Same as above, but this is used exclusively for the 'add' portion of the payload
Compressed size Int Size of compressed chunk data
Compressed data Byte array The chunk data is compressed using Zlib Deflate

Multi Block Change

Packet ID Category Bound To Field Name Field Type Notes
0x22 Play Client Chunk X Int Chunk X coordinate
Chunk Z Int Chunk Z Coordinate
Record count Short The number of blocks affected
Data size Int The total size of the data, in bytes. Should always be 4*record count
Records Array of Records

Record

Bit mask Width Meaning
00 00 00 0F 4 bits Block metadata
00 00 FF F0 12 bits Block ID
00 FF 00 00 8 bits Y co-ordinate
0F 00 00 00 4 bits Z co-ordinate, relative to chunk
F0 00 00 00 4 bits X co-ordinate, relative to chunk

Block Change

Packet ID Category Bound To Field Name Field Type Notes
0x23 Play Client X Int Block X Coordinate
Y Unsigned Byte Block Y Coordinate
Z Int Block Z Coordinate
Block ID VarInt The new block ID for the block
Block Metadata Unsigned Byte The new metadata for the block

Block Action

This packet is used for a number of things:

  • Chests opening and closing
  • Pistons pushing and pulling
  • Note blocks playing

See Also: Block Actions

Packet ID Category Bound To Field Name Field Type Notes
0x24 Play Client X Int Block X Coordinate
Y Short Block Y Coordinate
Z Int Block Z Coordinate
Byte 1 Unsigned Byte Varies depending on block - see Block_Actions
Byte 2 Unsigned Byte Varies depending on block - see Block_Actions
Block Type VarInt The block type for the block

Block Break Animation

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.

If you need to display several break animations at the same time you have to give each of them a unique Entity ID.

Also if you set the coordinates to a special block like water, it won't show the actual break animation, but some other interesting effects. (Water will lose its transparency)

Packet ID Category Bound To Field Name Field Type Notes
0x25 Play Client Entity ID VarInt Entity's ID
X Int Block Position
Y Int
Z Int
Destroy Stage Byte 0 - 9

Map Chunk Bulk

See also: SMP Map Format

To reduce the number of bytes this packet is used to send chunks together for better compression results.

Packet ID Category Bound To Field Name Field Type Notes
0x26 Play Client Chunk column count Short The number of chunk in this packet
Data length Int The size of the data field
Sky light sent Bool Whether or not the chunk data contains a light nibble array. This is true in the main world, false in the end + nether
Data Byte Array Compressed chunk data
Meta information Meta See below

Meta

Field Name Field Type Notes
Chunk X Int The X Coordinate of the chunk
Chunk Z Int The Z Coordinate of the chunk
Primary bitmap Unsigned Short A bitmap which specifies which sections are not empty in this chunk
Add bitmap Unsigned Short A bitmap which specifies which sections need add information because of very high block ids. not yet used

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

Packet ID Category Bound To Field Name Field Type Notes
0x27 Play Client X Float
Y Float
Z Float
Radius Float Currently unused in the client
Record count Int This is the count, not the size. The size is 3 times this value.
Records (Byte, Byte, Byte) × count Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
Player Motion X Float X velocity of the player being pushed by the explosion
Player Motion Y Float Y velocity of the player being pushed by the explosion
Player Motion Z Float Z velocity of the player being pushed by the explosion

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 effects 1013 and 1018 (mob.wither.spawn and mob.enderdragon.end, respectively), and is ignored for any other value by the client.

Packet ID Category Bound To Field Name Field Type Notes
0x28 Play Client Effect ID Int The ID of the effect, see below.
X Int The X location of the effect
Y Byte The Y location of the effect
Z Int The Z location of the effect
Data Int Extra data for certain effects, see below.
Disable relative volume Bool See above
Effects
ID Name
Sound
1000 random.click
1001 random.click
1002 random.bow
1003 random.door_open or random.door_close (50/50 chance)
1004 random.fizz
1005 Play a music disc. Data Record ID
(1006 not assigned)
1007 mob.ghast.charge
1008 mob.ghast.fireball
1009 mob.ghast.fireball, but with a lower volume.
1010 mob.zombie.wood
1011 mob.zombie.metal
1012 mob.zombie.woodbreak
1013 mob.wither.spawn
1014 mob.wither.shoot
1015 mob.bat.takeoff
1016 mob.zombie.infect
1017 mob.zombie.unfect
1018 mob.enderdragon.end
1020 random.anvil_break
1021 random.anvil_use
1022 random.anvil_land
Particle
2000 Spawns 10 smoke particles, e.g. from a fire. Data direction, see below
2001 Block break. Data Block ID
2002 Splash potion. Particle effect + glass break sound. Data Potion ID
2003 Eye of ender entity break animation - particles and sound
2004 Mob spawn particle effect: smoke + flames
2005 Spawn "happy villager" effect (green crosses), used for bonemealing vegetation.
2006 Spawn fall particles (when player hits ground). Data fall damage taken for particle speed

Smoke directions:

ID Direction
0 South - East
1 South
2 South - West
3 East
4 (Up or middle ?)
5 West
6 North - East
7 North
8 North - West

Sound Effect

Used to play a sound effect on the client.

All known sound effect names can be seen here.

Custom sounds may be added by resource packs

Packet ID Category Bound To Field Name Field Type Notes
0x29 Play Client Sound name String
Effect position X Int Effect X multiplied by 8
Effect position Y Int Effect Y multiplied by 8
Effect position Z Int Effect Z multiplied by 8
Volume Float 1 is 100%, can be more
Pitch Unsigned Byte 63 is 100%, can be more

Particle

Displays the named particle

Packet ID Category Bound To Field Name Field Type Notes
0x2A Play Client Particle name String The name of the particle to create. A list can be found here
X Float X position of the particle
Y Float Y position of the particle
Z Float Z position of the particle
Offset X Float This is added to the X position after being multiplied by random.nextGaussian()
Offset Y Float This is added to the Y position after being multiplied by random.nextGaussian()
Offset Z Float This is added to the Z position after being multiplied by random.nextGaussian()
Particle data Float The data of each particle
Number of particles Int The number of particles to create

Change Game State

It appears when a bed can't be used as a spawn point and when the rain state changes.

The class has an array of strings linked to reason codes 0, 1, 2, and 3 but only the codes for 1 and 2 are null.

Packet ID Category Bound To Field Name Field Type Notes
0x2B Play Client Reason Unsigned Byte
Value Float Depends on reason

Reason codes

Code Effect Notes
0 Invalid Bed "tile.bed.notValid"
1 End raining
2 Begin raining
3 Change game mode "gameMode.changed" 0 - Survival, 1 - Creative, 2 - Adventure
4 Enter credits
5 Demo messages 0 - Show welcome to demo screen, 101 - Tell movement controls, 102 - Tell jump control, 103 - Tell inventory control
6 Arrow hitting player Appears to be played when an arrow strikes another player in Multiplayer
7 Fade value The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
8 Fade time Time in ticks for the sky to fade

Spawn Global Entity

With this packet, the server notifies the client of thunderbolts striking within a 512 block radius around the player. The coordinates specify where exactly the thunderbolt strikes.

Packet ID Category Bound To Field Name Field Type Notes
0x2C Play Client Entity ID VarInt The entity ID of the thunderbolt
Type Byte The global entity type, currently always 1 for thunderbolt.
X Int Thunderbolt X a fixed-point number
Y Int Thunderbolt Y a fixed-point number
Z Int Thunderbolt Z a fixed-point number

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.

Packet ID Category Bound To Field Name Field Type Notes
0x2D Play Client Window id Unsigned Byte A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
Inventory Type Unsigned Byte The window type to use for display. Check below
Window title String The title of the window.
Number of Slots Unsigned Byte Number of slots in the window (excluding the number of slots in the player inventory).
Use provided window title Bool If false, the client will look up a string like "window.minecart". If true, the client uses what the server provides.
Entity ID Int EntityHorse's entityId. Only sent when window type is equal to 11 (AnimalChest).

See inventory windows for further information.

Close Window

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 message with window id 0 to close their inventory even though there is never an Open Window message for inventory.

Packet ID Category Bound To Field Name Field Type Notes
0x2E Play Client Window ID Unsigned Byte This is the id of the window that was closed. 0 for inventory.

Set Slot

Sent by the server when an item in a slot (in a window) is added/removed.

Packet ID Category Bound To Field Name Field Type Notes
0x2F Play Client Window ID Byte The window which is being updated. 0 for player inventory. Note that all known window types include the player inventory. This packet will only be sent for the currently opened window while the player is performing actions, even if it affects the player inventory. After the window is closed, a number of these packets are sent to update the player's inventory window (0).
Slot Short The slot that should be updated
Slot data Slot

Window Items

The inventory slots

Sent by the server when an item in a slot (in a window) is added/removed. This includes the main inventory, equipped armour and crafting slots.

Packet ID Category Bound To Field Name Field Type Notes
0x30 Play Client Window ID Unsigned Byte The id of window which items are being sent for. 0 for player inventory.
Count Short The number of slots (see below)
Slot data Array of Slots

See inventory windows for further information about how slots are indexed.

Window Property

Packet ID Category Bound To Field Name Field Type Notes
0x31 Play Client Window ID Unsigned Byte The id of the window.
Property Short Which property should be updated.
Value Short The new value for the property.

Furnace

Properties:

  • 0: Progress arrow
  • 1: Fire icon (fuel)

Values:

  • 0-200 for progress arrow
  • 0-200 for fuel indicator

Ranges are presumably in in-game ticks

Enchantment Table

Properties: 0, 1 or 2 depending on the "enchantment slot" being given.

Values: The enchantment's level.

Beacon

  • 0: Power level
  • 1: Potion effect one
  • 2: Potion effect two

Anvil

  • 0: Maximum cost

Brewing Stand

  • 0: Brew time

Brew time is a value between 0 and 400, with 400 making the arrow empty, and 0 making the arrow full.

Confirm Transaction

A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag). This packet is also sent from the client to the server in response to a server transaction rejection packet.

Packet ID Category Bound To Field Name Field Type Notes
0x32 Play Client Window ID Unsigned Byte The id of the window that the action occurred in.
Action number Short Every action that is to be accepted has a unique number. This field corresponds to that number.
Accepted Bool Whether the action was accepted.

Update Sign

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.

Packet ID Category Bound To Field Name Field Type Notes
0x33 Play Client X Int Block X Coordinate
Y Short Block Y Coordinate
Z Int Block Z Coordinate
Line 1 String First line of text in the sign
Line 2 String Second line of text in the sign
Line 3 String Third line of text in the sign
Line 4 String Fourth line of text in the sign

Maps

If the first byte of the array is 0, the next two bytes are X start and Y start and the rest of the bytes are the colors in that column.

If the first byte of the array is 1, the rest of the bytes are in groups of three: (data, x, y). The lower half of the data is the type (always 0 under vanilla) and the upper half is the direction.

If the first byte of the array is 2, the second byte is the map scale.

Packet ID Category Bound To Field Name Field Type Notes
0x34 Play Client Item Damage VarInt The damage value of the map being modified
Length Short Length of following byte array
Data Byte Array Array data

Update Block Entity

Essentially a block update on a block entity.

Packet ID Category Bound To Field Name Field Type Notes
0x35 Play Client X Int
Y Short
Z Int
Action Unsigned Byte The type of update to perform
Data length Short Varies
NBT Data Byte Array Present if data length > 0. Compressed with gzip. Varies, but based on the NBT chunk storage format as can be found in the Minecraft Wiki (http://www.minecraftwiki.net/Chunk_Format)

Actions

  • 1: Set mob displayed inside a mob spawner
  • 2: Set command block text (command and last execution status)
  • 3: Set rotation and skin of mob head
  • 4: Set type of flower in flower pot

Sign Editor Open

Sent on placement of sign.

Packet ID Category Bound To Field Name Field Type Notes
0x36 Play Client X Int X in block coordinates
Y Int Y in block coordinates
Z Int Z in block coordinates

Statistics

Packet ID Category Bound To Field Name Field Type Notes
0x37 Play Client Count VarInt Number of entries
Entry Statistic's name String https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0
Value VarInt The amount to set it to

Player List Item

Sent by the notchian server to update the user list (<tab> in the client).

Packet ID Category Bound To Field Name Field Type Notes
0x38 Play Client Player name String Supports chat colouring, limited to 16 characters.
Online Bool The client will remove the user from the list if false.
Ping Short Ping, presumably in ms.

Player Abilities

The latter 2 floats are used to indicate the walking and flying speeds respectively, while the first byte is used to determine the value of 4 booleans.

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.

Packet ID Category Bound To Field Name Field Type Notes
0x39 Play Client Flags Byte
Flying speed Float previous integer value divided by 250
Walking speed Float previous integer value divided by 250

Tab-Complete

The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported.

Packet ID Category Bound To Field Name Field Type Notes
0x3A Play Client Count VarInt Number of following strings
Match String One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count

Scoreboard Objective

This is sent to the client when it should create a new scoreboard or remove one.

Packet ID Category Bound To Field Name Field Type Notes
0x3B Play Client Objective name String An unique name for the objective
Objective value String The text to be displayed for the score.
Create/Remove Byte 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.

Update Score

This is sent to the client when it should update a scoreboard item.

Packet ID Category Bound To Field Name Field Type Notes
0x3C Play Client Item Name String An unique name to be displayed in the list.
Update/Remove Byte 0 to create/update an item. 1 to remove an item.
Score Name String The unique name for the scoreboard to be updated. Only sent when Update/Remove does not equal 1.
Value Int The score to be displayed next to the entry. Only sent when Update/Remove does not equal 1.

Warning.png The final String and Int are only sent if the Update/Remove Byte does not equal 1

Display Scoreboard

This is sent to the client when it should display a scoreboard.

Packet ID Category Bound To Field Name Field Type Notes
0x3D Play Client Position Byte The position of the scoreboard. 0 = list, 1 = sidebar, 2 = belowName.
Score Name String The unique name for the scoreboard to be displayed.

Teams

Creates and updates teams.

Packet ID Category Bound To Field Name Field Type Notes
0x3E Play Client Team Name String A unique name for the team. (Shared with scoreboard).
Mode Byte If 0 then the team is created.

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 String Only if Mode = 0 or 2.
Team Prefix String Only if Mode = 0 or 2. Displayed before the players' name that are part of this team.
Team Suffix String Only if Mode = 0 or 2. Displayed after the players' name that are part of this team.
Friendly fire Byte Only if Mode = 0 or 2; 0 for off, 1 for on, 3 for seeing friendly invisibles
Player count Short Only if Mode = 0 or 3 or 4. Number of players in the array
Players Array of strings Only if Mode = 0 or 3 or 4. Players to be added/remove from the team.

Plugin Message

Mods and plugins can use this to send their data. Minecraft itself uses a number of plugin channels. These internal channels are prefixed with MC|.

More documentation on this: http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/

Packet ID Category Bound To Field Name Field Type Notes
0x3F Play Client Channel String Name of the "channel" used to send the data.
Length Short Length of the following byte array
Data Byte Array Any data.

Disconnect

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.

Packet ID Category Bound To Field Name Field Type Notes
0x40 Play Client Reason String Displayed to the client when the connection terminates. Must be valid JSON.

Serverbound

Keep Alive

The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.

Packet ID Category Bound To Field Name Field Type Notes
0x00 Play Server Keep Alive ID Int

Chat Message

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.

For more information, see Chat.

Packet ID Category Bound To Field Name Field Type Notes
0x01 Play Server Message String

Use Entity

This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).

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 packet instead.

Packet ID Category Bound To Field Name Field Type Notes
0x02 Play Server Target Int
Mouse Byte 0 = Right-click, 1 = Left-click

Player

This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).

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.

Packet ID Category Bound To Field Name Field Type Notes
0x03 Play Server On Ground Bool True if the client is on the ground, False otherwise

Player Position

Updates the players XYZ position on the server. If HeadY - FeetY is less than 0.1 or greater than 1.65, the stance is illegal and the client will be kicked with the message “Illegal Stance”. If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 units will result in the client being kicked for "You moved too quickly :( (Hacking?)" Also if the fixed-point number of X or Z is set greater than 3.2E7D the client will be kicked for "Illegal position"

Packet ID Category Bound To Field Name Field Type Notes
0x04 Play Server X Double Absolute position
FeetY Double Absolute feet position, normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
HeadY Double Absolute head position
Z Double Absolute position
On Ground Bool True if the client is on the ground, False otherwise

Player Look

The unit circle for yaw
The unit circle of yaw, redrawn

Updates the direction the player is looking in.

Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0,-1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.

Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.

The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:

 l = x-x0
 w = z-z0
 c = sqrt( l*l + w*w )
 alpha1 = -arcsin(l/c)/PI*180
 alpha2 =  arccos(w/c)/PI*180
 if alpha2 > 90 then
   yaw = 180 - alpha1
 else
   yaw = alpha1

Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.

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)
Packet ID Category Bound To Field Name Field Type Notes
0x05 Play Server Yaw Float Absolute rotation on the X Axis, in degrees
Pitch Float Absolute rotation on the Y Axis, in degrees
On Ground Bool True if the client is on the ground, False otherwise

Player Position And Look

A combination of Player Look and Player position.

Packet ID Category Bound To Field Name Field Type Notes
0x06 Play Server X Double Absolute position
FeetY Double Absolute feet position. Is normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
HeadY Double Absolute head position
Z Double Absolute position
Yaw Float Absolute rotation on the X Axis, in degrees
Pitch Float Absolute rotation on the Y Axis, in degrees
On Ground Bool True if the client is on the ground, False otherwise

Player Digging

Sent when the player mines a block. A Notchian server only accepts digging packets with coordinates within a 6-unit radius of the player's position.

Packet ID Category Bound To Field Name Field Type Notes
0x07 Play Server Status Byte The action the player is taking against the block (see below)
X Int Block position
Y Unsigned Byte Block position
Z Int Block position
Face Byte The face being hit (see below)

Status can (currently) be one of six values:

Meaning Value
Started digging 0
Cancelled digging 1
Finished digging 2
Drop item stack 3
Drop item 4
Shoot arrow / finish eating 5

Notchian clients send a 0 (started digging) when they start digging and a 2 (finished digging) once they think they are finished. If digging is aborted, the client simply send a 1 (Cancel digging).

Status code 4 (drop item) is a special case. In-game, when you use the Drop Item command (keypress 'q'), a dig packet with a status of 4, and all other values set to 0, is sent from client to server. Status code 3 is similar, but drops the entire stack.

Status code 5 (shoot arrow / finish eating) is also a special case. The x, y and z fields are all set to 0 like above, with the exception of the face field, which is set to 255.

The face can be one of six values, representing the face being hit:

Value 0 1 2 3 4 5
Offset -Y +Y -Z +Z -X +X

In 1.7.3, when a player opens a door with left click the server receives Packet 0xE+start digging and opens the door.

Player Block Placement

Packet ID Category Bound To Field Name Field Type Notes
0x08 Play Server X Int Block position
Y Unsigned Byte Block position
Z Int Block position
Direction Byte The offset to use for block/item placement (see below)
Held item Slot
Cursor position X Byte The position of the crosshair on the block
Cursor position Y Byte
Cursor position Z Byte

In normal operation (ie placing a block), this packet is sent once, with the values set normally.

This packet has a special case where X, Y, Z, and Direction are all -1. (Note that Y is unsigned so set to 255.) This special packet indicates that the currently held item for the player should have its state updated such as eating food, shooting bows, using buckets, etc.

In a Notchian Beta client, the block or item ID corresponds to whatever the client is currently holding, and the client sends one of these packets any time a right-click is issued on a surface, so no assumptions can be made about the safety of the ID. However, with the implementation of server-side inventory, a Notchian server seems to ignore the item ID, instead operating on server-side inventory information and holding selection. The client has been observed (1.2.5 and 1.3.2) to send both real item IDs and -1 in a single session.

Special note on using buckets: When using buckets, the Notchian client might send two packets: first a normal and then a special case. The first normal packet is sent when you're looking at a block (e.g. the water you want to scoop up). This normal packet does not appear to do anything with a Notchian server. The second, special case packet appears to perform the action - based on current position/orientation and with a distance check - it appears that buckets can only be used within a radius of 6 units.

Held Item Change

Sent when the player changes the slot selection

Packet ID Category Bound To Field Name Field Type Notes
0x09 Play Server Slot Short The slot which the player has selected (0-8)

Animation

Packet ID Category Bound To Field Name Field Type Notes
0x0A Play Server Entity ID Int Player ID
Animation Byte Animation ID


Animation can be one of the following values:

ID Animation
0 No animation
1 Swing arm
2 Damage animation
3 Leave bed
5 Eat food
6 Critical effect
7 Magic critical effect
102 (unknown)
104 Crouch
105 Uncrouch

Entity Action

Sent at least when crouching, leaving a bed, or sprinting. To send action animation to client use 0x28. The client will send this with Action ID = 3 when "Leave Bed" is clicked.

Packet ID Category Bound To Field Name Field Type Notes
0x0B Play Server Entity ID Int Player ID
Action ID Byte The ID of the action, see below.
Jump Boost Int Horse jump boost. Ranged from 0 -> 100.

Action ID can be one of the following values:

ID Action
1 Crouch
2 Uncrouch
3 Leave bed
4 Start sprinting
5 Stop sprinting
6 Horse jump
5 Horse interaction ?

Steer Vehicle

Packet ID Category Bound To Field Name Field Type Notes
0x0C Play Server Sideways Float Positive to the left of the player
Forward Float Positive forward
Jump Bool
Unmount Bool True when leaving the vehicle

Close Window

This packet is sent by the client when closing a window.

Note, notchian clients send a close window message with window id 0 to close their inventory even though there is never an Open Window message for inventory.

Packet ID Category Bound To Field Name Field Type Notes
0x0D Play Server Window id byte This is the id of the window that was closed. 0 for inventory.


Click Window

This packet is sent by the player when it clicks on a slot in a window.

Packet ID Category Bound To Field Name Field Type Notes
0x0E Play Server Window ID Byte The id of the window which was clicked. 0 for player inventory.
Slot Short The clicked slot. See below.
Button Byte The button used in the click. See below.
Action number Short A unique number for the action, used for transaction handling (See the Transaction packet).
Mode Byte Inventory operation mode. See below.
Clicked item Slot

See inventory windows for further information about how slots are indexed.

When right-clicking on a stack of items, half the stack will be picked up and half left in the slot. If the stack is an odd number, the half left in the slot will be smaller of the amounts.

The Action number is actually a counter, starting at 1. This number is used by the server as a transaction ID to send back a Transaction packet.

The distinct type of click performed by the client is determined by the combination of the "Mode" and "Button" fields.

Mode Button Slot Trigger
0 0 Normal Left mouse click
1 Normal Right mouse click
1 0 Normal Shift + left mouse click
1 Normal Shift + right mouse click (Identical behavior)
2 0 Normal Number key 1
1 Normal Number key 2
2 Normal Number key 3
... ... ...
8 Normal Number key 9
3 2 Normal Middle click
4 0 Normal Drop key (Q)
1 Normal Ctrl + Drop key (Ctrl-Q)
0 -999 Left click outside inventory holding nothing (No-op)
1 -999 Right click outside inventory holding nothing (No-op)
5 0 -999 Starting left mouse drag (Or middle mouse)
4 -999 Starting right mouse drag
1 Normal Add slot for left-mouse drag
5 Normal Add slot for right-mouse drag
2 -999 Ending left mouse drag
6 -999 Ending right mouse drag
6 0 Normal Double click

Starting from version 1.5, "painting mode" is available for use in inventory windows. It is done by picking up stack of something (more than 1 items), then holding mouse button (left, right or middle) and dragging holded stack over empty (or same type in case of right button ) slots. In that case client sends the following to server after mouse button release (omitting first pickup packet which is sent as usual):

  1. packet with mode 5, slot -999 , button (0 for left | 4 for right);
  2. packet for every slot painted on, mode is still 5, button (1 | 5);
  3. packet with mode 5, slot -999, button (2 | 6);

If any of the painting packets other than the "progress" ones are sent out of order (for example, a start, some slots, then another start; or a left-click in the middle) the painting status will be reset.

Confirm Transaction

Packet ID Category Bound To Field Name Field Type Notes
0x0F Play Server Window ID Byte The id of the window that the action occurred in.
Action number Short Every action that is to be accepted has a unique number. This field corresponds to that number.
Accepted Bool Whether the action was accepted.

Creative Inventory Action

While the user is in the standard inventory (i.e., not a crafting bench) on a creative-mode server then the server will send this packet:

  • If an item is dropped into the quick bar
  • If an item is picked up from the quick bar (item id is -1)
Packet ID Category Bound To Field Name Field Type Notes
0x10 Play Server Slot Short Inventory slot
Clicked item Slot

Enchant Item

Packet ID Category Bound To Field Name Field Type Notes
0x11 Play Server Window ID Byte The ID sent by Open Window
Enchantment Byte The position of the enchantment on the enchantment table window, starting with 0 as the topmost one.

Update Sign

This message is sent from the client to the server when the "Done" button is pushed after placing a sign.

Packet ID Category Bound To Field Name Field Type Notes
0x12 Play Server X Int Block X Coordinate
Y Short Block Y Coordinate
Z Int Block Z Coordinate
Line 1 String First line of text in the sign
Line 2 String Second line of text in the sign
Line 3 String Third line of text in the sign
Line 4 String Fourth line of text in the sign

Player Abilities

The latter 2 bytes 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. The vanilla client sends this packet when the player starts/stops flying with the second parameter changed accordingly. All other parameters are ignored by the vanilla server.

Packet ID Category Bound To Field Name Field Type Notes
0x13 Play Server Flags Byte
Flying speed Float previous integer value divided by 250
Walking speed Float previous integer value divided by 250

Tab-Complete

Sent when the user presses [tab] while writing text. The payload contains all text behind the cursor.

Packet ID Category Bound To Field Name Field Type Notes
0x14 Play Server Text String

Client Settings

Sent when the player connects, or when settings are changed.

Packet ID Category Bound To Field Name Field Type Notes
0x15 Play Server Locale String en_GB
View distance Byte Client-side render distance(chunks)
Chat flags Byte Chat settings. See notes below.
Chat colours Bool "Colours" multiplayer setting
Difficulty Byte Client-side difficulty from options.txt
Show Cape Bool Show Cape multiplayer setting

Chat flags has several values packed into one byte.

Chat Enabled: Bits 0-1. 00: Enabled. 01: Commands only. 10: Hidden.

Client Status

Sent when the client is ready to complete login and when the client is ready to respawn after death.

Packet ID Category Bound To Field Name Field Type Notes
0x16 Play Server Action ID Byte See below

Action ID values:

Action ID Name
0 Perform respawn
1 Request stats
2 Open inventory achievement

Plugin Message

Mods and plugins can use this to send their data. Minecraft itself uses a number of plugin channels. These internal channels are prefixed with MC|.

More documentation on this: http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/

Packet ID Category Bound To Field Name Field Type Notes
0x17 Play Server Channel String Name of the "channel" used to send the data.
Length Short Length of the following byte array
Data Byte Array Any data.

Status

The status ping works as follows.

   C->S : Handshake State=1
   C->S : Request
   S->C : Response
   C->S : Ping
   S->C : Ping

Clientbound

Response

Packet ID Category Bound To Field Name Field Type Notes
0x00 Status Client JSON Response String https://gist.github.com/thinkofdeath/6927216


Ping

Packet ID Category Bound To Field Name Field Type Notes
0x01 Status Client Time Long Should be the same as sent by the client

Serverbound

Request

Packet ID Category Bound To Field Name Field Type Notes
0x00 Status Server


Ping

Packet ID Category Bound To Field Name Field Type Notes
0x01 Status Server Time Long

Login

The login process is as follows:

   C->S : Handshake State=2
   C->S : Login Start
   S->C : Encryption Key Request
   (Client Auth)
   C->S : Encryption Key Response
   (Server Auth, Both enable encryption)
   S->C : Login Success

For unauthenticated and* localhost connections there is no encryption. In that case Login Start is directly followed by Login Success.

* It could be that only one of the two conditions is enough for an unencrypted connection.

See Protocol Encryption for details.

Clientbound

Disconnect

Packet ID Category Bound To Field Name Field Type Notes
0x00 Login Client JSON Data String

Encryption Request

Packet ID Category Bound To Field Name Field Type Notes
0x01 Login Client Server ID String appears to be empty as of 1.7.x
Length Short length of public key
Public Key Byte array
Length Short length of verify token
Verify Token Byte array

See Protocol Encryption for details.

Login Success

Packet ID Category Bound To Field Name Field Type Notes
0x02 Login Client UUID String
Username String

Serverbound

Login Start

Packet ID Category Bound To Field Name Field Type Notes
0x00 Login Server Name String

Encryption Response

Packet ID Category Bound To Field Name Field Type Notes
0x01 Login Server Length Short length of shared secret
Shared Secret Byte array
Length Short length of verify token
Verify Token Byte array

See Protocol Encryption for details.

See Also