Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
m (Protocol version in the Handshake packet was missing a number.)
(Undo formating change, much easier to focus on clientbound and serverbound packets with them seperated)
Line 52: Line 52:
 
1.8 - 47
 
1.8 - 47
  
=== Packet format ===
+
== Packet format ==
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 89: Line 89:
 
== Handshaking ==
 
== Handshaking ==
  
=== Handshake ===
+
=== Serverbound ===
 +
 
 +
==== 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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=4 | 0x00 || rowspan=4 | Handshake || rowspan=4 | Client to Server
+
| rowspan=4 | 0x00 || rowspan=4 | Handshake || rowspan=4 | Server
| Protocol Version || VarInt || (47 as of 1.7.2)
+
| Protocol Version || VarInt || (4 as of 1.7.2)
 
|-
 
|-
 
| Server Address (hostname or IP) || String || localhost
 
| Server Address (hostname or IP) || String || localhost
Line 104: Line 106:
 
|}
 
|}
  
== Status ==
+
== Play ==
The status ping works as follows.
+
 
    C->S : Handshake State=1
+
=== Clientbound ===
    C->S : Request
+
 
    S->C : Response
+
==== Keep Alive ====
    C->S : Ping
+
 
    S->C : Ping
+
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.
  
=== Request ===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x00 || Status || Client to Server || || ||
+
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Client
 +
| Keep Alive ID || VarInt ||
 
|}
 
|}
  
=== Response ===
+
==== Join Game ====
 +
See [[Protocol Encryption]] for information on logging in.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x00  || rowspan=1 | Status || rowspan=1 | Server to Client
+
| rowspan=7 | 0x01 || rowspan=7 | Play || rowspan=7 | Client
| JSON Response || String || https://gist.github.com/thinkofdeath/6927216
+
| Entity ID || Int || The player's Entity ID
|}
 
 
 
=== Ping ===
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=1 | 0x01  || rowspan=1 | Status || rowspan=1 | Client to Server
+
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. Bit 3 (0x8) is the hardcore flag
| Time || Long ||
 
|}
 
 
 
=== Ping ===
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=1 | 0x01  || rowspan=1 | Status || rowspan=1 | Server to Client
+
| Dimension || Byte || -1: nether, 0: overworld, 1: end
| Time || Long || Should be the same as sent by the client
+
|-
|}
+
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard
 
+
|-
== Login ==
+
| Max Players || Unsigned Byte || Used by the client to draw the player list
 
+
|-
The login process is as follows:
+
| Level Type || String || default, flat, largeBiomes, amplified, default_1_1
    C->S : Handshake State=2
+
|-
    C->S : Login Start
+
| Reduced Debug Info || Boolean ||
    S->C : Encryption Key Request
+
|}
    (Client Auth)
+
{{Warning|If the Dimension isn't valid then the client will crash}}
    C->S : Encryption Key Response
 
    (Server Auth, Both enable encryption)
 
    S->C : Login Success
 
  
For unauthenticated and* localhost connections there is no encryption.
+
==== Chat Message ====
In that case Login Start is directly followed by Login Success.
 
  
<nowiki>*</nowiki> It could be that only one of the two conditions is enough for an unencrypted connection.
+
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
 
+
   
See [[Protocol Encryption]] for details.
 
 
 
=== Login Start ===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x00 || rowspan=1 | Login || rowspan=1 | Client to Server
+
| rowspan=2 | 0x02 || rowspan=2 | Play || rowspan=2 | Client
| Name || String ||  
+
| JSON Data || String || [[Chat]] , Limited to 32767 bytes
 +
|-
 +
| Position || Byte || 0 - Chat (chat box) ,1 - System Message (chat box), 2 - Above action bar
 
|}
 
|}
 +
{{Warning|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 <code>20</code> every second.
  
=== Disconnect ===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x00 || rowspan=1 | Login || rowspan=1 | Server to Client
+
| rowspan=2 | 0x03 || rowspan=2 | Play || rowspan=2 | Client
| JSON Data || String ||
+
| 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
 
|}
 
|}
  
=== Encryption Request ===
+
==== Entity Equipment ====
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=5 | 0x01  || rowspan=5 | Login || rowspan=5 | Server to Client
+
| rowspan=3 | 0x04 || rowspan=3 | Play || rowspan=3 | Client
| Server ID || String || appears to be empty as of 1.7.x
+
| EntityID || VarInt || Entity's ID
 
|-
 
|-
| Length || VarInt || length of public key
+
| Slot || Short || Equipment slot: 0=held, 1-4=armor slot (1 - boots, 2 - leggings, 3 - chestplate, 4 - helmet)
 
|-
 
|-
| Public Key || Byte array ||  
+
| Item || [[Slot_Data|Slot]] || Item in slot format
|-
 
| Length || VarInt || length of verify token
 
|-
 
| Verify Token || Byte array ||
 
|-
 
 
|}
 
|}
  
=== Encryption Response ===
+
==== Spawn Position ====
 +
 
 +
Sent by the server after login to specify the coordinates of the spawn point (the point at which players spawn at, and which the compass points to). It can be sent at any time to update the point compasses point at.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=4 | 0x01 || rowspan=4 | Login || rowspan=4 | Client to Server
+
| rowspan=1 | 0x05 || rowspan=1 | Play || rowspan=1 | Client
| Length || VarInt || length of shared secret
+
| Location || Position || Spawn location
|-
+
|}
| Shared Secret || Byte array ||
+
 
|-
+
==== Update Health ====
| Length || VarInt || length of verify token
+
 
|-
+
Sent by the server to update/set the health of the player it is sent to.
| Verify Token || Byte array ||
+
 
|-
+
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.
|}
 
  
=== Login Success ===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x02 || rowspan=2 | Login || rowspan=2 | Server to Client
+
| rowspan=3 | 0x06 || rowspan=3 | Play || rowspan=3 | Client
| UUID || String ||
+
| Health || Float || 0 or less = dead, 20 = full HP
 
|-
 
|-
| Username || String ||
+
| Food || VarInt || 0 - 20
 +
|-
 +
| Food Saturation || Float || Seems to vary from 0.0 to 5.0 in integer increments
 
|}
 
|}
  
=== Set Compression ===
+
==== Respawn ====
 +
 
 +
To change the player's dimension (overworld/nether/end), send them a respawn packet with the appropriate dimension, followed by prechunks/chunks for the new dimension, and finally a position and look packet.  You do not need to unload chunks, the client will do it automatically.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x03 || rowspan=1 | Login || rowspan=1 | Server to Client
+
| rowspan=4 | 0x07 || rowspan=4 | Play || rowspan=4 | Client
| Threshold || VarInt || Threshold is the max size of a packet before its compressed
+
| 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 [[Protocol#Join_Game|Join Game]]
 
|}
 
|}
 +
{{Warning|If the Dimension isn't valid then the client will crash}}
  
== Play ==
+
{{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)}}
  
=== Keep Alive ===
+
==== Player Position And Look ====  
  
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.
+
Updates the players position on the server.
 +
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 units will result in the client being kicked for "You moved too quickly :( (Hacking?)"
 +
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for "Illegal position"
 +
 
 +
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0,-1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
 +
 
 +
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 +
 
 +
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
 +
  l = x-x0
 +
  w = z-z0
 +
  c = sqrt( l*l + w*w )
 +
  alpha1 = -arcsin(l/c)/PI*180
 +
  alpha2 =  arccos(w/c)/PI*180
 +
  if alpha2 > 90 then
 +
    yaw = 180 - alpha1
 +
  else
 +
    yaw = alpha1
  
{| class="wikitable"
+
You can get a unit vector from a given yaw/pitch via:
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
  x = -cos(pitch) * sin(yaw)
|-
+
  y = -sin(pitch)
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Both
+
  z = cos(pitch) * cos(yaw)
| Keep Alive ID || VarInt ||
 
|}
 
  
=== Join Game ===
+
About the flags field:
See [[Protocol Encryption]] for information on logging in.
+
  <Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=7 | 0x01 || rowspan=7 | Play || rowspan=7 | Server to Client
+
| rowspan=6| 0x08 || rowspan=6 | Play || rowspan=6 | Client
| Entity ID || Int || The player's Entity ID
+
| X || Double || Absolute/Relative position
 
|-
 
|-
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. Bit 3 (0x8) is the hardcore flag
+
| Y || Double || Absolute/Relative position
 +
|-
 +
| Z || Double || Absolute/Relative position
 +
|-
 +
| Yaw || Float || Absolute/Relative rotation on the X Axis, in degrees
 +
|-
 +
| Pitch || Float || Absolute/Relative rotation on the Y Axis, in degrees
 
|-
 
|-
| Dimension || Byte || -1: nether, 0: overworld, 1: end
+
| Flags || Byte ||  
 +
{| class="wikitable"
 +
| X || 0x01
 
|-
 
|-
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard
+
| Y || 0x02
 
|-
 
|-
| Max Players || Unsigned Byte || Used by the client to draw the player list
+
| Z || 0x04
 
|-
 
|-
| Level Type || String || default, flat, largeBiomes, amplified, default_1_1
+
| Y_ROT || 0x08
 
|-
 
|-
| Reduced Debug Info || Boolean ||
+
| X_ROT || 0x10
 +
|}
 
|}
 
|}
{{Warning|If the Dimension isn't valid then the client will crash}}
 
  
=== Chat Message ===
+
==== Held Item Change ====
  
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 to change the player's slot selection
 
 
For more information, see [[Chat]].
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x01 || rowspan=1 | Play || rowspan=1 | Client to Server
+
| rowspan=1 | 0x09 || rowspan=1 | Play || rowspan=1 | Client
| Message || String ||  
+
| Slot || Byte || The slot which the player has selected (0-8)
 
|}
 
|}
  
=== Chat Message ===  
+
==== 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.
  
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options. While position 2 accepts json formatting it will not display, old style formatting works
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x02 || rowspan=2 | Play || rowspan=2 | Server to Client
+
| rowspan=2 | 0x0A || rowspan=2 | Play || rowspan=2 | Client
| JSON Data || String || [[Chat]] , Limited to 32767 bytes
+
| Entity ID || VarInt || Player ID
 
|-
 
|-
| Position || Byte || 0 - Chat (chat box) ,1 - System Message (chat box), 2 - Above action bar
+
| Location || Position || Block location of the head part of the bed
 
|}
 
|}
{{Warning|Malformed JSON will disconnect the client}}
 
  
=== Use Entity ===
+
==== Animation ====
  
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
+
Sent whenever an entity should change animation.
  
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.
+
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=2 | 0x0B || rowspan=2 | Play || rowspan=2 | Client
 +
| Entity ID || VarInt || Player ID
 +
|-
 +
| Animation || Unsigned Byte || Animation ID
 +
|}
  
Note that middle-click in creative mode is interpreted by the client and sent as a Creative Inventory Action packet instead.
+
Animation can be one of the following values:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! ID !! Animation
 
|-
 
|-
| rowspan=5 | 0x02 || rowspan=5 | Play || rowspan=5 | Client to Server
+
| 0 || Swing arm
| Target || VarInt ||
 
 
|-
 
|-
| Type || VarInt || 0 = INTERACT, 1 = ATTACK, 2 = INTERACT_AT
+
| 1 || Damage animation
 
|-
 
|-
| Target X || Float || Only if Type == INTERACT_AT
+
| 2 || Leave bed
 
|-
 
|-
| Target Y || Float || Only if Type == INTERACT_AT
+
| 3 || Eat food
 
|-
 
|-
| Target Z || Float || Only if Type == INTERACT_AT
+
| 4 || Critical effect
|}
+
|-
 +
| 5 || Magic critical effect
 +
|-
 +
| 102 || (unknown)
 +
|-
 +
| 104 || Crouch
 +
|-
 +
| 105 || Uncrouch
 +
|}
  
=== Time Update ===
+
==== Spawn Player ====
  
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 packet is sent by the server when a player comes into visible range, '''not''' when a player joins.
  
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
+
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
  
The default SMP server increments the time by <code>20</code> every second.
+
When in online-mode the UUIDs must be valid and have valid skin blobs, in offline-mode UUID v3 is used.
  
{| class="wikitable"
+
For NPCs UUID v2 should be used. Note:
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
  <+Grum> i will never confirm this as a feature you know that :)
|-
 
| rowspan=2 | 0x03 || rowspan=2 | Play || rowspan=2 | Server to 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
 
|}
 
  
=== Player ===
+
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>.
 
 
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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID !! Category !! Bound To !!colspan=2 | Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x03 || rowspan=1 | Play || rowspan=1 | Client to Server
+
| rowspan=9 | 0x0C || rowspan=9 | Play || rowspan=9 | Client
| On Ground || Bool || True if the client is on the ground, False otherwise
+
| colspan=2 | Entity ID || VarInt || Player's Entity ID
|}
+
|-
 
+
| colspan=2 | Player UUID || UUID || Player's UUID
=== Entity Equipment ===
+
|-
{| class="wikitable"
+
| colspan=2 | X || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|-
 +
| 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
 
|-
 
|-
| rowspan=3 | 0x04 || rowspan=3 | Play || rowspan=3 | Server to Client
+
| colspan=2 | Pitch || Byte || Player rotation as a packet byte
| EntityID || VarInt || Entity's ID
 
 
|-
 
|-
| Slot || Short || Equipment slot: 0=held, 1-4=armor slot (1 - boots, 2 - leggings, 3 - chestplate, 4 - helmet)
+
| 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.
 
|-
 
|-
| Item || [[Slot_Data|Slot]] || Item in slot format
+
| 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}}
  
=== Player Position ===
+
==== Collect Item ====
  
Updates the players XYZ position on the server.
+
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.
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=4 | 0x04 || rowspan=4 | Play || rowspan=4 | Client to Server
+
| rowspan=2 | 0x0D || rowspan=2 | Play || rowspan=2 | Client
| X || Double || Absolute position
+
| Collected Entity ID || VarInt ||
|-
+
|-  
| FeetY || Double || Absolute feet position, normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
+
| Collector Entity ID || VarInt ||
|-
 
| Z || Double || Absolute position
 
|-
 
| On Ground || Bool || True if the client is on the ground, False otherwise
 
 
|}
 
|}
  
=== Spawn Position ===
+
==== Spawn Object ====
  
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.
+
Sent by the server when an Object/Vehicle is created.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x05 || rowspan=1 | Play || rowspan=1 | Server to Client
+
| rowspan=8| 0x0E || rowspan=8 | Play || rowspan=8 | Client
| Location || Position || Spawn location
+
| Entity ID || VarInt || Entity ID of the object
 +
|-
 +
| Type || Byte || The type of object (See [[Entities#Objects|Objects]])
 +
|-
 +
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| Pitch || Byte || The pitch in steps of 2p/256
 +
|-
 +
| Yaw || Byte || The yaw in steps of 2p/256
 +
|-
 +
| Data || [[Object_Data|Object Data]] ||
 
|}
 
|}
  
=== Player Look ===
+
==== Spawn Mob ====
  
[[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]]
+
Sent by the server when a Mob Entity is Spawned
  
[[File:Yaw.png|thumb|The unit circle of yaw, redrawn]]
+
{| class="wikitable"
 
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
Updates the direction the player is looking in.
+
|-
 +
| rowspan=12 | 0x0F || rowspan=12 | Play || rowspan=12 | Client
 +
| Entity ID || VarInt || Entity's ID
 +
|-
 +
| Type || Unsigned Byte || The type of mob. See [[Entities#Mobs|Mobs]]
 +
|-
 +
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| Yaw || 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 || [[Entities#Entity_Metadata_Format|Metadata]] ||
 +
|}
  
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.
+
==== Spawn Painting ====
  
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
+
This packet shows location, name, and type of painting.
  
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
+
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.
  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.
+
2x1 (1, 0)
 +
4x4 (1, 2)
  
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=3| 0x05 || rowspan=3 | Play || rowspan=3 | Client to Server
+
| rowspan=4 | 0x10 || rowspan=4 | Play || rowspan=4 | Client
| Yaw || Float || Absolute rotation on the X Axis, in degrees
+
| Entity ID || VarInt || Entity's ID
 +
|-
 +
| Title || String || Name of the painting. Max length 13
 
|-
 
|-
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
+
| Location || Position || Center coordinates
 
|-
 
|-
| On Ground || Bool || True if the client is on the ground, False otherwise
+
| Direction || Unsigned Byte || Direction the painting faces (0 -z, 1 -x, 2 +z, 3 +x)
 
|}
 
|}
  
=== Update Health ===
+
==== Spawn Experience Orb ====
  
Sent by the server to update/set the health of the player it is sent to.
+
Spawns one or more experience orbs.
 
 
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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=3 | 0x06 || rowspan=3 | Play || rowspan=3 | Client
+
| rowspan=5 | 0x11 || rowspan=5 | Play || rowspan=5 | Client
| Health || Float || 0 or less = dead, 20 = full HP
+
| Entity ID || VarInt || Entity's ID
 +
|-
 +
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
|-
| Food || VarInt || 0 - 20
+
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
|-  
+
|-
| Food Saturation || Float || Seems to vary from 0.0 to 5.0 in integer increments
+
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| Count || Short || The amount of experience this orb will reward once collected
 
|}
 
|}
  
=== Player Position And Look ===
+
==== Entity Velocity ====
  
A combination of Player Look and Player position.  
+
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=6 | 0x06 || rowspan=6 | Play || rowspan=6 | Client to Server
+
| rowspan=4 | 0x12 || rowspan=4 | Play || rowspan=4 | Client
| X || Double || Absolute position
+
| Entity ID || VarInt || Entity's ID
 
|-
 
|-
| FeetY || Double || Absolute feet position. Is normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
+
| Velocity X || Short || Velocity on the X axis
 
|-
 
|-
| Z || Double || Absolute position
+
| Velocity Y || Short || Velocity on the Y axis
 
|-
 
|-
| Yaw || Float || Absolute rotation on the X Axis, in degrees
+
| Velocity Z || Short || Velocity on the Z axis
|-
 
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
 
|-
 
| On Ground || Bool || True if the client is on the ground, False otherwise
 
 
|}
 
|}
  
=== Respawn ===
+
==== Destroy Entities ====
  
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 list of Entities is to be destroyed on the client.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=4 | 0x07 || rowspan=4 | Play || rowspan=4 | Server to Client
+
| rowspan=2 | 0x13 || rowspan=2 | Play || rowspan=2 | Client
| Dimension || Int || -1: The Nether, 0: The Overworld, 1: The End
+
| Count || VarInt || Length of following array
 
|-
 
|-
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard.
+
| Entity IDs || Array of VarInt || The list of entities of destroy
|-
 
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
 
|-
 
| Level Type || String || Same as [[Protocol#Join_Game|Join Game]]
 
 
|}
 
|}
{{Warning|If the Dimension isn't valid then the client will crash}}
 
  
{{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)}}
+
==== Entity ====
  
=== Player Digging ===
+
Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.
  
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.
+
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="3" | 0x07 || rowspan="3" | Play || rowspan="3" | Client to Server
+
| rowspan=1 | 0x14 || rowspan=1 | Play || rowspan=1 | Client
| Status || Byte || The action the player is taking against the block (see below)
+
| Entity ID || VarInt || Entity's ID
|-
 
| Location || Position || Block position
 
|-
 
| Face || Byte || The face being hit (see below)
 
 
|}
 
|}
  
Status can (currently) be one of six values:
+
==== 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.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Meaning !! Value
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| Started digging || <code>0</code>
+
| rowspan=5| 0x15 || rowspan=5 | Play || rowspan=5 | Client
 +
| Entity ID || VarInt || Entity's ID
 
|-
 
|-
| Cancelled digging || <code>1</code>
+
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
|-
| Finished digging || <code>2</code>
+
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
|-
| Drop item stack || <code>3</code>
+
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
|-
| Drop item || <code>4</code>
+
| On Ground || Boolean ||
|-
 
| Shoot arrow / finish eating || <code>5</code>
 
 
|}
 
|}
  
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).
+
==== Entity Look ====
  
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.
+
This packet is sent by the server when an entity rotates. Example: "Yaw" field 64 means a 90 degree turn.
 
 
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:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=5 | 0x16 || rowspan=5 | Play || rowspan=5 | Client
 +
| Entity ID || VarInt || Entity's ID
 +
|-
 +
| Yaw || Byte || The X Axis rotation as a fraction of 360
 
|-
 
|-
| Value || 0 || 1 || 2 || 3 || 4 || 5
+
| Pitch || Byte || The Y Axis rotation as a fraction of 360
 
|-
 
|-
| Offset || -Y || +Y || -Z || +Z || -X || +X
+
| On Ground || Boolean ||  
 
|}
 
|}
  
In 1.7.3, when a player opens a door with left click the server receives Packet 0xE+start digging and opens the door.
+
==== Entity Look and Relative Move ====
  
=== Player Position And Look ===
+
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)
  
Updates the players position on the server.
+
{| class="wikitable"
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?)"
+
! 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=7 | 0x17 || rowspan=7 | Play || rowspan=7 | 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.
+
| Entity ID || VarInt || Entity's ID
 
+
|-
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
+
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
+
|-
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
+
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
  l = x-x0
+
|-
  w = z-z0
+
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
  c = sqrt( l*l + w*w )
+
|-
  alpha1 = -arcsin(l/c)/PI*180
+
| Yaw || Byte || The X Axis rotation as a fraction of 360
  alpha2 =  arccos(w/c)/PI*180
+
|-
  if alpha2 > 90 then
+
| Pitch || Byte || The Y Axis rotation as a fraction of 360
    yaw = 180 - alpha1
+
|-
  else
+
| On Ground || Boolean ||
    yaw = alpha1
+
|}
  
You can get a unit vector from a given yaw/pitch via:
+
==== Entity Teleport ====
  x = -cos(pitch) * sin(yaw)
 
  y = -sin(pitch)
 
  z = cos(pitch) * cos(yaw)
 
  
About the flags field:
+
This packet is sent by the server when an entity moves more than 4 blocks.
  <Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=6| 0x08 || rowspan=6 | Play || rowspan=6 | Server to Client
+
| rowspan=7 | 0x18 || rowspan=7 | Play || rowspan=7 | Client
| X || Double || Absolute/Relative position
+
| Entity ID || VarInt || Entity's ID
 
|-
 
|-
| Y || Double || Absolute/Relative position
+
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
|-
| Z || Double || Absolute/Relative position
+
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 +
|-
 +
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
|-
| Yaw || Float || Absolute/Relative rotation on the X Axis, in degrees
+
| Yaw || Byte || The X Axis rotation as a fraction of 360
 
|-
 
|-
| Pitch || Float || Absolute/Relative rotation on the Y Axis, in degrees
+
| Pitch || Byte || The Y Axis rotation as a fraction of 360
 
|-
 
|-
| Flags || Byte ||  
+
| On Ground || Boolean ||
 +
|}
 +
 
 +
==== Entity Head Look ====
 +
 
 +
Changes the direction an entity's head is facing.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
| X || 0x01
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| Y || 0x02
+
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Client
 +
| Entity ID || VarInt || Entity's ID
 
|-
 
|-
| Z || 0x04
+
| Head Yaw || Byte || Head yaw in steps of 2p/256
 +
|}
 +
 
 +
==== Entity Status ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| Y_ROT || 0x08
+
| rowspan=2 | 0x1A || rowspan=2 | Play || rowspan=2 | Client
 +
| Entity ID || Int || Entity's ID
 
|-
 
|-
| X_ROT || 0x10
+
| Entity Status || Byte || See below
|}
 
 
|}
 
|}
  
=== Player Block Placement ===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Entity Status !! Meaning
 
|-
 
|-
| rowspan=6 | 0x08 || rowspan=6 | Play || rowspan=6 | Client to Server
+
| 0 || Something related to living entities?
| Location || Position || Block position
+
|-
 +
| 1 || Something related to the player entity?
 
|-
 
|-
| Direction || Byte || The offset to use for block/item placement (see below)
+
| 2 || Living Entity hurt
 
|-
 
|-
| Held item || [[Slot_Data|Slot]] ||
+
| 3 || Living Entity dead
 
|-
 
|-
| Cursor position X || Byte || The position of the crosshair on the block
+
| 4 || Iron Golem throwing up arms
 
|-
 
|-
| Cursor position Y || Byte ||
+
| 6 || Wolf/Ocelot/Horse taming - Spawn "heart" particles
 
|-
 
|-
| Cursor position Z || Byte ||
+
| 7 || Wolf/Ocelot/Horse tamed - Spawn "smoke" particles
|}
 
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, pulling back 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 to change the player's slot selection
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=1 | 0x09 || rowspan=1 | Play || rowspan=1 | Server to Client
+
| 8 || Wolf shaking water - Trigger the shaking animation
| Slot || Byte || The slot which the player has selected (0-8)
+
|-
|}
+
| 9 || (of self) Eating accepted by server
 
+
|-
=== Held Item Change ===
+
| 10 || Sheep eating grass
 
+
|-
Sent when the player changes the slot selection
+
| 11 || Iron Golem handing over a rose
 
+
|-
{| class="wikitable"
+
| 12 || Villager mating - Spawn "heart" particles
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|-
 +
| 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
 
|-
 
|-
| rowspan=1 | 0x09 || rowspan=1 | Play || rowspan=1 | Client to Server
+
| 18 || Animal in love (ready to mate) - Spawn "heart" particles
| Slot || Short || The slot which the player has selected (0-8)
 
 
|}
 
|}
  
=== Use Bed ===  
+
==== Attach Entity ====
  
This packet tells that a player goes to bed.
+
This packet is sent when a player has been attached to an entity (e.g. Minecart)
 
 
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x0A || rowspan=2 | Play || rowspan=2 | Server to Client
+
| rowspan=3 | 0x1B || rowspan=3 | Play || rowspan=3 | Client
| Entity ID || VarInt || Player ID
+
| Entity ID || Int || Entity's ID
 +
|-
 +
| Vehicle ID || Int || Vechicle's Entity ID
 
|-
 
|-
| Location || Position || Block location of the head part of the bed
+
| Leash || Bool || If true leashes the entity to the vehicle
 
|}
 
|}
  
=== Animation ===
+
==== Entity Metadata ====
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x0A  || rowspan=1 | Play || rowspan=1 | Client to Server
+
| rowspan=2 | 0x1C || rowspan=2 | Play || rowspan=2 | Client
 +
| Entity ID || VarInt || Entity's ID
 +
|-
 +
| Metadata || [[Entities#Entity_Metadata_Format|Metadata]] ||
 
|}
 
|}
  
=== Animation ===
+
==== Entity Effect ====
 
+
{| class="wikitable"
Sent whenever an entity should change animation.
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=5 | 0x1D || rowspan=5 | Play || rowspan=5 | Client
 +
| Entity ID || VarInt || Entity's ID
 +
|-
 +
| Effect ID || Byte || See [[http://www.minecraftwiki.net/wiki/Potion_effect#Parameters]]
 +
|-
 +
| Amplifier || Byte ||
 +
|-
 +
| Duration || VarInt ||
 +
|-
 +
| Hide Particles || Boolean ||
 +
|}
  
 +
==== Remove Entity Effect ====
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x0B || rowspan=2 | Play || rowspan=2 | Server to Client
+
| rowspan=2 | 0x1E || rowspan=2 | Play || rowspan=2 | Client
| Entity ID || VarInt || Player ID
+
| Entity ID || VarInt || Entity's ID
 
|-
 
|-
| Animation || Unsigned Byte || Animation ID
+
| Effect ID || Byte ||
 
|}
 
|}
  
Animation can be one of the following values:
+
==== Set Experience ====
 +
 
 +
Sent by the server when the client should change experience levels.
  
 
{| class="wikitable"
 
{| class="wikitable"
! ID !! Animation
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 0 || Swing arm
+
| rowspan=3 | 0x1F || rowspan=3 | Play || rowspan=3 | Client
 +
| Experience bar || Float || Between 0 and 1
 
|-
 
|-
| 1 || Damage animation
+
| Level || VarInt ||
 
|-
 
|-
| 2 || Leave bed
+
| Total Experience || VarInt ||
|-
 
| 3 || Eat food
 
|-
 
| 4 || Critical effect
 
|-
 
| 5 || Magic critical effect
 
|-
 
| 102 || (unknown)
 
|-
 
| 104 || Crouch
 
|-
 
| 105 || Uncrouch
 
 
|}
 
|}
  
=== Entity Action ===
+
==== Entity Properties ====
 
 
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.
 
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="3" | 0x0B || rowspan="3" | Play || rowspan="3" | Client to Server
+
| rowspan=3 | 0x20 || rowspan=3 | Play || rowspan=3 | Client
| Entity ID || VarInt || Player ID
+
| Entity ID || VarInt || Entity's ID
 
|-
 
|-
| Action ID || VarInt || The ID of the action, see below.
+
| Count || Int || Length of following array
 
|-
 
|-
| Jump Boost || VarInt || Horse jump boost. Ranged from 0 -> 100.
+
| Properties || Array of Property Data ||
 
|}
 
|}
  
Action ID can be one of the following values:
+
'''Property Data''' structure:
 
 
 
{| class="wikitable"
 
{| class="wikitable"
! ID !! Action
 
 
|-
 
|-
| 0 || Crouch
+
! Field Name !! Field Type !! Notes
 
|-
 
|-
| 1 || Uncrouch
+
| Key || String ||  
 
|-
 
|-
| 2 || Leave bed
+
| Value || Double ||  
 
|-
 
|-
| 3 || Start sprinting
+
| List Length || VarInt || Number of list elements that follow.
 
|-
 
|-
| 4 || Stop sprinting
+
| Modifiers || Array of Modifier Data || http://www.minecraftwiki.net/wiki/Attribute#Modifiers
|-
 
| 5 || Jump with horse
 
|-
 
| 6 || Open inventory
 
 
|}
 
|}
  
=== Spawn Player ===
+
Known key values:
 
 
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 :)
 
 
 
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>.
 
 
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !!colspan=2 | Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=9 | 0x0C || rowspan=9 | Play || rowspan=9 | Server to Client
+
! Key !! Default !! Min !! Max !! Label
| colspan=2 | Entity ID || VarInt || Player's Entity ID
 
 
|-
 
|-
| colspan=2 | Player UUID || UUID || Player's UUID
+
| generic.maxHealth || 20.0 || 0.0 || Double.MaxValue || Max Health
 
|-
 
|-
| colspan=2 | X || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| generic.followRange || 32.0 || 0.0 || 2048.0 || Follow Range
 
|-
 
|-
| colspan=2 | Y || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| generic.knockbackResistance || 0.0 || 0.0 || 1.0 || Knockback Resistance
 
|-
 
|-
| colspan=2 | Z || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| generic.movementSpeed || 0.699999988079071 || 0.0 || Double.MaxValue || Movement Speed
 
|-
 
|-
| colspan=2 | Yaw || Byte || Player rotation as a packed byte
+
| generic.attackDamage || 2.0 || 0.0 || Double.MaxValue ||  
 
|-
 
|-
| colspan=2 | Pitch || Byte || Player rotation as a packet byte
+
| horse.jumpStrength || 0.7 || 0.0 || 2.0 || Jump Strength
 
|-
 
|-
| 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.
+
| zombie.spawnReinforcements || 0.0 || 0.0 || 1.0 || Spawn Reinforcements Chance
|-
 
| 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}}
 
  
=== Steer Vehicle ===
+
'''Modifier Data''' structure:
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=3 | 0x0C || rowspan=3 | Play || rowspan=3 | Client to Server
+
! Field Name !! Field Type !! Notes
| Sideways || Float || Positive to the left of the player
+
|-
 +
| UUID || 128-bit integer ||
 
|-
 
|-
| Forward || Float || Positive forward
+
| Amount || Double ||
 
|-
 
|-
| Flags|| Unsigned Byte || 0x1 Jump, 0x2 Unmount
+
| Operation || Byte ||
 
|}
 
|}
  
=== Collect Item ===
+
==== 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.
  
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.
+
See also: [[SMP Map Format]]
  
{| class="wikitable"
+
Changes in 1.8:
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x0D || rowspan=2 | Play || rowspan=2 | Server to Client
 
| Collected Entity ID || VarInt ||
 
|-
 
| Collector Entity ID || VarInt ||
 
|}
 
  
=== Close Window ===
+
* Data value section removed
 
+
* Extended id section removed
This packet is sent by the client when closing a window.
+
* Block id section is now a unsigned short (little endian) per a block
 
+
* The block id is equal to <code>(id << 4) | data</code>
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 0x0D || rowspan=1 | Play || rowspan=1 | Client to Server
+
| rowspan=6 | 0x21 || rowspan=6 | Play || rowspan=6 | Client
| Window id || byte || This is the id of the window that was closed. 0 for inventory.
+
| 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.
 +
|-
 +
| Size || VarInt || Size of chunk data
 +
|-
 +
| Data || Byte array || The chunk data is not compressed as of 14w28a
 
|}
 
|}
  
=== Spawn Object ===
+
==== Multi Block Change ====
 
 
Sent by the server when an Object/Vehicle is created.
 
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=8| 0x0E || rowspan=8 | Play || rowspan=8 | Server to Client
+
| rowspan=4 | 0x22 || rowspan=4 | Play || rowspan=4 | Client
| Entity ID || VarInt || Entity ID of the object
+
| Chunk X || Int || Chunk X coordinate
 
|-
 
|-
| Type || Byte || The type of object (See [[Entities#Objects|Objects]])
+
| Chunk Z || Int || Chunk Z Coordinate
 +
|-
 +
| Record count || VarInt || The number of blocks affected
 
|-
 
|-
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Records || Array of Records ||  
 +
|}
 +
 
 +
'''Record'''
 +
{| class="wikitable"
 
|-
 
|-
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
! Bit mask !! Width !! Meaning
 
|-
 
|-
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| 00 FF || 8 bits || Y co-ordinate
 
|-
 
|-
| Pitch || Byte || The pitch in steps of 2p/256
+
| 0F 00 || 4 bits || Z co-ordinate, relative to chunk
 
|-
 
|-
| Yaw || Byte || The yaw in steps of 2p/256
+
| F0 00 || 4 bits || X co-ordinate, relative to chunk
 
|-
 
|-
| Data || [[Object_Data|Object Data]] ||
+
| ? || VarInt || Block ID
 
|}
 
|}
  
=== Click Window ===
+
==== Block Change ====
 
 
This packet is sent by the player when it clicks on a slot in a window.
 
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="6" | 0x0E || rowspan=6 | Play || rowspan=6 | Client to Server
+
| rowspan=2 | 0x23 || rowspan=2 | Play || rowspan=2 | Client
| Window ID || Byte || The id of the window which was clicked. 0 for player inventory.
+
| Location || Position|| Block Coordinates
 
|-
 
|-
| Slot || Short || The clicked slot. See below.
+
| Block ID || VarInt || The new block ID for the block. <code>id << 4 &#124; data</code>
|-
+
|}
| Button || Byte || The button used in the click. See below.
+
 
|-
+
==== Block Action ====
| Action number || Short || A unique number for the action, used for transaction handling (See the Transaction packet).
+
 
 +
This packet is used for a number of things:
 +
* <div class="li">Chests opening and closing
 +
* Pistons pushing and pulling
 +
* Note blocks playing
 +
* Update Beacons
 +
 
 +
See Also: [[Block Actions]]
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan=4 | 0x24 || rowspan=4 | Play || rowspan=4 | Client
 +
| Location || Position || Block Coordinates
 +
|-
 +
| Byte 1 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
 
|-
 
|-
| Mode || Byte || Inventory operation mode. See below.
+
| Byte 2 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
 
|-
 
|-
| Clicked item || [[Slot_Data|Slot]] ||
+
| Block Type || VarInt || The block type for the block
 
|}
 
|}
  
See [[Inventory#Windows|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.
+
==== 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.
  
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]].
+
Also if you set the coordinates to a special block like water etc. it won't show the actual break animation but some other interesting effects. (Water will lose it's transparency)
  
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
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
! rowspan="2" | 0
+
| rowspan=3 | 0x25 || rowspan=3 | Play || rowspan=3 | Client
| 0 || Normal || Left mouse click
+
| Entity ID || VarInt || Entity's ID
 
|-
 
|-
| 1 || Normal || Right mouse click
+
| Location || Position || Block Position
 
|-
 
|-
! rowspan="2" | 1
+
| Destroy Stage || Byte || 0 - 9
| 0 || Normal || Shift + left mouse click
+
|}
 +
 
 +
==== Map Chunk Bulk ====
 +
 
 +
See also: [[SMP Map Format]]
 +
 
 +
1.8 changes at [[#Chunk_Data]]
 +
 
 +
To reduce the number of bytes this packet is used to send chunks together for better compression results.
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 1 || Normal || Shift + right mouse click ''(Identical behavior)''
+
| rowspan=4 | 0x26 || rowspan=4 | Play || rowspan=4 | Client
 +
| 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" | 2
+
| Chunk column count || VarInt || The number of chunk in this packet
| 0 || Normal || Number key 1
 
 
|-
 
|-
| 1 || Normal || Number key 2
+
| Meta information || Meta || See below
 
|-
 
|-
| 2 || Normal || Number key 3
+
| Data || Byte Array || Chunk data. Uncompressed as of 14w28a
|-
+
|}
| ...
+
 
| ...
+
'''Meta'''
| ...
+
{| class="wikitable"
 +
! Field Name !! Field Type !! Notes
 
|-
 
|-
| 8 || Normal || Number key 9
+
|Chunk X || Int || The X Coordinate of the chunk
 
|-
 
|-
! rowspan="1" | 3
+
|Chunk Z || Int || The Z Coordinate of the chunk
| 2 || Normal || Middle click
 
 
|-
 
|-
! rowspan="4" | 4
+
|Primary bitmap || Unsigned Short || A bitmap which specifies which sections are not empty in this chunk
| 0 || Normal || Drop key (Q)
+
|}
 +
 
 +
==== Explosion ====
 +
 
 +
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
 +
 
 +
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 1 || Normal || Ctrl + Drop key (Ctrl-Q)
+
| rowspan="9" | 0x27 || rowspan=9 | Play || rowspan=9 | Client
 +
| X || Float ||
 
|-
 
|-
| 0 || -999 || Left click outside inventory holding nothing ''(No-op)''
+
| Y || Float ||
 
|-
 
|-
| 1 || -999 || Right click outside inventory holding nothing ''(No-op)''
+
| Z || Float ||
 
|-
 
|-
! rowspan="6" | 5
+
| Radius || Float || Currently unused in the client
| 0 || -999 || Starting left mouse drag ''(Or middle mouse)''
 
 
|-
 
|-
| 4 || -999 || Starting right mouse drag
+
| Record count || Int || This is the count, not the size. The size is 3 times this value.
 
|-
 
|-
| 1 || Normal || Add slot for left-mouse drag
+
| Records || (Byte, Byte, Byte) × count || Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
 
|-
 
|-
| 5 || Normal || Add slot for right-mouse drag
+
| Player Motion X || Float || X velocity of the player being pushed by the explosion
 
|-
 
|-
| 2 || -999 || Ending left mouse drag
+
| Player Motion Y || Float || Y velocity of the player being pushed by the explosion
 
|-
 
|-
| 6 || -999 || Ending right mouse drag
+
| Player Motion Z || Float || Z velocity of the player being pushed by the explosion
|-
 
! 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):
+
==== Effect ====
  
# packet with mode 5, slot -999 , button (0 for left | 4 for right);
+
Sent when a client is to play a sound or particle effect.
# 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.
+
By default, the minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1013 (mob.wither.spawn), and is ignored for any other value by the client.
 
 
=== Spawn Mob ===
 
 
 
Sent by the server when a Mob Entity is Spawned
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=12 | 0x0F || rowspan=12 | Play || rowspan=12 | Server to Client
+
| rowspan=4 | 0x28 || rowspan=4 | Play || rowspan=4 | Client
| Entity ID || VarInt || Entity's ID
+
| Effect ID || Int || The ID of the effect, see below.
 
|-
 
|-
| Type || Unsigned Byte || The type of mob. See [[Entities#Mobs|Mobs]]
+
| Location || Position|| The location of the effect
 
|-
 
|-
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Data || Int || Extra data for certain effects, see below.
 
|-
 
|-
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Disable relative volume || Bool || See above
|-
+
|}
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
 
 +
===== Effects =====
 +
 
 +
{| class="wikitable"
 +
! ID !! Name
 +
|-
 +
| colspan=2 | '''Sound'''
 
|-
 
|-
| Yaw || Byte || The yaw in steps of 2p/256
+
| 1000|| <code>random.click</code>
 
|-
 
|-
| Pitch || Byte || The pitch in steps of 2p/256
+
| 1001|| <code>random.click</code>
 
|-
 
|-
| Head Pitch || Byte || The pitch in steps of 2p/256
+
| 1002|| <code>random.bow</code>
 
|-
 
|-
| Velocity X || Short ||
+
| 1003|| <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
 
|-
 
|-
| Velocity Y || Short ||
+
| 1004|| <code>random.fizz</code>
 
|-
 
|-
| Velocity Z || Short ||
+
| 1005|| Play a music disc. '''Data''' [http://www.minecraftwiki.net/wiki/Music_Discs Record ID]
 
|-
 
|-
| Metadata || [[Entities#Entity_Metadata_Format|Metadata]] ||
+
| ''(1006 not assigned)'' ||
|}
 
 
 
=== Confirm Transaction ===
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan="3" | 0x0F || rowspan=3 | Play || rowspan=3 | Client to Server
+
| 1007|| <code>mob.ghast.charge</code>
| 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.
+
| 1008|| <code>mob.ghast.fireball</code>
 
|-
 
|-
| Accepted || Bool || Whether the action was accepted.
+
| 1009|| <code>mob.ghast.fireball</code>, but with a lower volume.
|}
 
 
 
=== Spawn Painting ===
 
 
 
This packet shows location, name, and type of painting.
 
 
 
Calculating the center of an image: given a (width x height) grid of cells, with (0, 0) being the top left corner, the center is (max(0, width / 2 - 1), height / 2). E.g.
 
 
 
2x1 (1, 0)
 
4x4 (1, 2)
 
 
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=4 | 0x10 || rowspan=4 | Play || rowspan=4 | Server to Client
+
| 1010|| <code>mob.zombie.wood</code>
| Entity ID || VarInt || Entity's ID
 
 
|-
 
|-
| Title || String || Name of the painting. Max length 13
+
| 1011|| <code>mob.zombie.metal</code>
 
|-
 
|-
| Location || Position || Center coordinates
+
| 1012|| <code>mob.zombie.woodbreak</code>
 
|-
 
|-
| Direction || Unsigned Byte || Direction the painting faces (0 -z, 1 -x, 2 +z, 3 +x)
+
| 1013|| <code>mob.wither.spawn</code>
|}
 
 
 
=== 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)
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan="2" | 0x10 || rowspan=2 | Play || rowspan=2 | Client to Server
+
| 1014|| <code>mob.wither.shoot</code>
| Slot || Short || Inventory slot
 
 
|-
 
|-
| Clicked item || [[Slot_Data|Slot]] ||
+
| 1015|| <code>mob.bat.takeoff</code>
|}
+
|-
 
+
| 1016|| <code>mob.zombie.infect</code>
=== Spawn Experience Orb ===
+
|-
 
+
| 1017|| <code>mob.zombie.unfect</code>
Spawns one or more experience orbs.
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=5 | 0x11 || rowspan=5 | Play || rowspan=5 | Server to Client
+
| 1018|| <code>mob.enderdragon.end</code>
| Entity ID || VarInt || Entity's ID
 
 
|-
 
|-
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| 1020|| <code>random.anvil_break</code>
 
|-
 
|-
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| 1021|| <code>random.anvil_use</code>
 
|-
 
|-
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| 1022|| <code>random.anvil_land</code>
 
|-
 
|-
| Count || Short || The amount of experience this orb will reward once collected
+
| colspan=2 | '''Particle'''
|}
 
 
 
=== Enchant Item ===
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan="2" | 0x11 || rowspan=2 | Play || rowspan=2 | Client to Server
+
| 2000|| Spawns 10 smoke particles, e.g. from a fire. '''Data''' direction, see below
| Window ID || Byte || The ID 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.
+
| 2001|| Block break. '''Data''' [http://www.minecraftwiki.net/wiki/Data_values Block ID]
|}
 
 
 
=== Entity Velocity ===
 
 
 
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms);
 
for example, -1343 would move (-1343 / 8000) = −0.167875 blocks per tick (or −3,3575 blocks per second).
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=4 | 0x12 || rowspan=4 | Play || rowspan=4 | Server to Client
+
| 2002|| Splash potion. Particle effect + glass break sound. '''Data''' [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
| Entity ID || VarInt || Entity's ID
 
 
|-
 
|-
| Velocity X || Short || Velocity on the X axis
+
| 2003|| Eye of ender entity break animation - particles and sound
 
|-
 
|-
| Velocity Y || Short || Velocity on the Y axis
+
| 2004|| Mob spawn particle effect: smoke + flames
 
|-
 
|-
| Velocity Z || Short || Velocity on the Z axis
+
| 2005|| Spawn "happy villager" effect (green crosses), used for bonemealing vegetation.
 
|}
 
|}
  
=== Update Sign ===
+
Smoke directions:
 
 
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! ID !! Direction
 +
|-
 +
| 0 || South - East
 
|-
 
|-
| rowspan=5 | 0x12 || rowspan=5 | Play || rowspan=5 | Client to Server
+
| 1 || South
| Location || Position || Block Coordinates
 
 
|-
 
|-
| Line 1 || [[Chat]] || First line of text in the sign
+
| 2 || South - West
 
|-
 
|-
| Line 2 || [[Chat]] || Second line of text in the sign
+
| 3 || East
 
|-
 
|-
| Line 3 || [[Chat]] || Third line of text in the sign
+
| 4 || (Up or middle ?)
 
|-
 
|-
| Line 4 || [[Chat]] || Fourth line of text in the sign
+
| 5 || West
|}
+
|-
 
+
| 6 || North - East
=== Destroy Entities ===
 
 
 
Sent by the server when an list of Entities is to be destroyed on the client.
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=2 | 0x13 || rowspan=2 | Play || rowspan=2 | Server to Client
+
| 7 || North
| Count || VarInt || Length of following array
 
 
|-
 
|-
| Entity IDs || Array of VarInt || The list of entities of destroy
+
| 8 || North - West
 
|}
 
|}
  
=== Player Abilities ===
+
==== Sound Effect ====
 +
 
 +
Used to play a sound effect on the client.
 +
 
 +
All known sound effect names can be seen [https://github.com/SirCmpwn/Craft.Net/blob/master/source/Craft.Net.Common/SoundEffect.cs here].
  
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.
+
Custom sounds may be added by resource packs
 
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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="3" | 0x13 || rowspan=3 | Play || rowspan=3 | Client to Server
+
| rowspan="6" | 0x29 || rowspan=6 | Play || rowspan=6 | Client
| Flags || Byte ||
+
| Sound name || String ||  
 +
|-
 +
| Effect position X || Int || Effect X multiplied by 8
 
|-
 
|-
| Flying speed || Float|| previous integer value divided by 250
+
| Effect position Y || Int || Effect Y multiplied by 8
 
|-
 
|-
| Walking speed || Float || previous integer value divided by 250
+
| Effect position Z || Int || Effect Z multiplied by 8
|}
+
|-
 
+
| Volume || Float || 1 is 100%, can be more
=== 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.
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=1 | 0x14 || rowspan=1 | Play || rowspan=1 | Server to Client
+
| Pitch || Unsigned Byte || 63 is 100%, can be more
| Entity ID || VarInt || Entity's ID
 
 
|}
 
|}
  
=== Tab-Complete ===
+
==== Particle ====
  
Sent when the user presses [tab] while writing text. The payload contains all text behind the cursor.
+
Displays the named particle
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=3 | 0x14  || rowspan=3 | Play || rowspan=3 | Client to Server
+
| rowspan=11 | 0x2A || rowspan=11 | Play || rowspan=11 | Client
| Text || String ||
+
| Particle Id || Int ||  
 
|-
 
|-
| Has Position || Boolean ||
+
| Long Distance || Boolean || If true, particle distance increases from 256 to 65536.
 
|-
 
|-
| Looked at block || Position || The position of the block being looked at. Only sent if the previous field is true
+
| X || Float || X position of the particle
|}
 
 
 
=== 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.
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=5| 0x15 || rowspan=5 | Play || rowspan=5 | Server to Client
+
| Y || Float || Y position of the particle
| Entity ID || VarInt || Entity's ID
+
|-
 +
| 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()
 
|-
 
|-
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Offset Z || Float || This is added to the Z position after being multiplied by random.nextGaussian()
 
|-
 
|-
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Particle data || Float || The data of each particle
 
|-
 
|-
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Number of particles || Int || The number of particles to create
 
|-
 
|-
| On Ground || Boolean ||
+
| Data || Array of VarInt || Length depends on particle. ICON_CRACK, BLOCK_CRACK, and BLOCK_DUST have lengths of 2, the rest have 0.
 
|}
 
|}
  
=== Client Settings ===
+
Particle Ids
 
 
Sent when the player connects, or when settings are changed.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Particle Name
 +
! Particle Id
 
|-
 
|-
| rowspan=5 | 0x15 || rowspan=5 | Play || rowspan=5 | Client to Server
+
| explode
| Locale || String || en_GB
+
| 0
 
|-
 
|-
| View distance || Byte || Client-side render distance(chunks)
+
| largeexplosion
 +
| 1
 
|-
 
|-
| Chat flags || Byte || Chat settings. See notes below.
+
| hugeexplosion
 +
| 2
 
|-
 
|-
| Chat colours || Bool || "Colours" multiplayer setting
+
| fireworksSpark
 +
| 3
 +
|-
 +
| bubble
 +
| 4
 +
|-
 +
| wake
 +
| 5
 +
|-
 +
| splash
 +
| 6
 +
|-
 +
| suspended
 +
| 7
 +
|-
 +
| townaura
 +
| 8
 
|-
 
|-
| Displayed skin parts || Unsigned Byte || Skin parts. See note below
+
| crit
|}
+
| 9
 
+
|-
Chat flags has several values packed into one byte.
+
| magicCrit
 
+
| 10
'''Chat Enabled:''' Bits 0-1. 00: Enabled.  01: Commands only.  10: Hidden.
 
 
 
Displayed skin parts also packs several values into one byte.
 
 
 
Bit 0: Cape enabled
 
 
 
Bit 1: Jacket enabled
 
 
 
Bit 2: Left Sleeve enabled
 
 
 
Bit 3: Right Sleeve enabled
 
 
 
Bit 4: Left Pants Leg enabled
 
 
 
Bit 5: Right Pants Leg enabled
 
 
 
Bit 6: Hat enabled
 
 
 
The most significant bit (bit 7) appears to be unused.
 
 
 
=== Entity Look ===
 
 
 
This packet is sent by the server when an entity rotates.  Example: "Yaw" field 64 means a 90 degree turn.
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=5 | 0x16 || rowspan=5 | Play || rowspan=5 | Server to Client
+
| smoke
| Entity ID || VarInt || Entity's ID
+
| 11
 
|-
 
|-
| Yaw || Byte || The X Axis rotation as a fraction of 360
+
| largesmoke
 +
| 12
 
|-
 
|-
| Pitch || Byte || The Y Axis rotation as a fraction of 360
+
| mobSpell?
 +
| 13
 
|-
 
|-
| On Ground || Boolean ||  
+
| instantSpell
|}
+
| 14
 
+
|-
=== Client Status ===
+
| spell
 
+
| 15
Sent when the client is ready to complete login and when the client is ready to respawn after death.
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=1 | 0x16 || rowspan=1 | Play || rowspan=1 | Client to Server
+
| witchMagic
| Action ID || VarInt || See below
+
| 17
|}
 
 
 
Action ID values:
 
{| class="wikitable"
 
 
|-
 
|-
! Action ID !! Name
+
| dripWater
 +
| 18
 
|-
 
|-
| 0 || Perform respawn
+
| dripLava
 +
| 19
 
|-
 
|-
| 1 || Request stats
+
| angryVillager
 +
| 20
 
|-
 
|-
| 2 || Open inventory achievement
+
| happyVillager
|}
+
| 21
 
+
|-
=== Entity Look and Relative Move ===
+
| depthsuspend
 
+
| 22
This packet is sent by the server when an entity rotates and moves.
 
Since a byte range is limited from -128 to 127, and movement is offset of fixed-point numbers,
 
this packet allows at most four blocks movement in any direction. (-128/32 == -4)
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=7 | 0x17 || rowspan=7 | Play || rowspan=7 | Server to Client
+
| note
| Entity ID || VarInt || Entity's ID
+
| 23
 
|-
 
|-
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| portal
 +
| 24
 
|-
 
|-
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| enchantmenttable
 +
| 25
 
|-
 
|-
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| flame
 +
| 26
 
|-
 
|-
| Yaw || Byte || The X Axis rotation as a fraction of 360
+
| lava
 +
| 27
 
|-
 
|-
| Pitch || Byte || The Y Axis rotation as a fraction of 360
+
| footstep
 +
| 28
 
|-
 
|-
| On Ground || Boolean ||
+
| cloud
|}
+
| 29
 
+
|-
=== Plugin Message ===
+
| reddust
 
+
| 30
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>.
+
|-
 +
| snowballpoof
 +
| 31
 +
|-
 +
| snowshovel
 +
| 32
 +
|-
 +
| slime
 +
| 33
 +
|-
 +
| heart
 +
| 34
 +
|-
 +
| barrier
 +
| 35
 +
|}
 +
 
 +
==== Change Game State ====
  
More documentation on this: http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/
+
It appears when a bed can't be used as a spawn point and when the rain state changes.  
  
Note that the data length is known from the packet length, so there is no need for a length member being sent.
+
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.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x17 || rowspan=2 | Play || rowspan=2 | Client to Server
+
| rowspan="2" | 0x2B || rowspan=2 | Play || rowspan=2 | Client
| Channel || String || Name of the "channel" used to send the data.
+
| Reason || Unsigned Byte ||
 
|-
 
|-
| Data || Byte Array || Any data.
+
| Value || Float || Depends on reason
 
|}
 
|}
  
=== Entity Teleport ===
+
'''Reason codes'''
 
 
This packet is sent by the server when an entity moves more than 4 blocks.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Code !! Effect !! Notes
 
|-
 
|-
| rowspan=7 | 0x18 || rowspan=7 | Play || rowspan=7 | Server to Client
+
| 0 || Invalid Bed || "tile.bed.notValid"
| Entity ID || VarInt || Entity's ID
 
 
|-
 
|-
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| 1 || End raining ||  
 
|-
 
|-
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| 2 || Begin raining ||  
 
|-
 
|-
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| 3 || Change game mode || "gameMode.changed" 0 - Survival, 1 - Creative, 2 - Adventure, 3 - Spectator
 
|-
 
|-
| Yaw || Byte || The X Axis rotation as a fraction of 360
+
| 4 || Enter credits ||
 
|-
 
|-
| Pitch || Byte || The Y Axis rotation as a fraction of 360
+
| 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
 
|-
 
|-
| On Ground || Boolean ||
+
| 7 || Fade value || The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
|}
 
 
 
=== Spectate ===
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=1 | 0x18 || rowspan=1 | Play || rowspan=1 | Client to Server
+
| 8 || Fade time || Time in ticks for the sky to fade
| Target Player || UUID ||
 
 
|}
 
|}
  
=== Entity Head Look ===
+
==== Spawn Global Entity ====
  
Changes the direction an entity's head is facing.
+
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
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Server to Client
+
| rowspan="5" | 0x2C || rowspan=5 | Play || rowspan=5 | Client
| Entity ID || VarInt || Entity's ID
+
| Entity ID || VarInt || The entity ID of the thunderbolt
 +
|-
 +
| Type || Byte || The global entity type, currently always 1 for thunderbolt.
 
|-
 
|-
| Head Yaw || Byte || Head yaw in steps of 2p/256
+
| X || Int || Thunderbolt X a [[Data_Types#Fixed-point_numbers|fixed-point number]]
 +
|-
 +
| Y || Int || Thunderbolt Y a [[Data_Types#Fixed-point_numbers|fixed-point number]]
 +
|-
 +
| Z || Int || Thunderbolt Z a [[Data_Types#Fixed-point_numbers|fixed-point number]]
 
|}
 
|}
  
=== Resource Pack Status ===  
+
==== Open Window ====
 +
 
 +
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Client to Server
+
| rowspan=5 | 0x2D || rowspan=5 | Play || rowspan=5 | Client
| Hash || String || The hash sent in the [[#Resource Pack Send|Resource Pack Send]] packet.
+
| 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 || String || The window type to use for display.  Check below
 +
|-
 +
| 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).
 
|-
 
|-
| Result || VarInt || Successfully loaded: 0, Declined: 1, Failed download: 2, Accepted: 3
+
| Entity ID || Int || EntityHorse's entityId. Only sent when window type is equal to "EntityHorse".
 
|}
 
|}
  
=== Entity Status ===
+
See [[Inventory#Windows|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.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x1A || rowspan=2 | Play || rowspan=2 | Server to Client
+
| 0x2E || rowspan=1 | Play || rowspan=1 | Client
| Entity ID || Int || Entity's ID
+
| Window ID || Unsigned Byte || This is the id of the window that was closed. 0 for inventory.
|-
 
| Entity Status || Byte || See below
 
 
|}
 
|}
 +
 +
==== Set Slot ====
 +
 +
Sent by the server when an item in a slot (in a window) is added/removed.
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
! Entity Status !! Meaning
+
| rowspan="3" | 0x2F || rowspan=3 | Play || rowspan=3 | 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).
 
|-
 
|-
| 0 || Something related to living entities?
+
| Slot || Short || The slot that should be updated
 
|-
 
|-
| 1 || Something related to the player entity?
+
| Slot data || [[Slot_Data|Slot]] ||
 +
|}
 +
 
 +
==== Window Items ====
 +
 
 +
[[File:Inventory-slots.png|thumb|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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 2 || Living Entity hurt
+
| rowspan="3" | 0x30 || rowspan=3 | Play || rowspan=3 | Client
 +
| Window ID || Unsigned Byte || The id of window which items are being sent for. 0 for player inventory.
 
|-
 
|-
| 3 || Living Entity dead
+
| Count || Short || The number of slots (see below)
 
|-
 
|-
| 4 || Iron Golem throwing up arms
+
| Slot data || Array of [[Slot_Data|Slot]]s ||
 +
|}
 +
 
 +
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 +
 
 +
==== Window Property ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 6 || Wolf/Ocelot/Horse taming - Spawn "heart" particles
+
| rowspan="3" | 0x31 || rowspan=3 | Play || rowspan=3 | Client
 +
| Window ID || Unsigned Byte || The id of the window.
 
|-
 
|-
| 7 || Wolf/Ocelot/Horse tamed - Spawn "smoke" particles
+
| Property || Short || Which property should be updated.
 
|-
 
|-
| 8 || Wolf shaking water - Trigger the shaking animation
+
| Value || Short || The new value for the property.
|-
 
| 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 ===
+
'''Furnace'''
 +
 
 +
Properties:
  
This packet is sent when a player has been attached to an entity (e.g. Minecart)
+
* 0: Progress arrow
 +
* 1: Fire icon (fuel)
  
{| class="wikitable"
+
Values:
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
 
|-
+
* 0-200 for progress arrow
| rowspan=3 | 0x1B || rowspan=3 | Play || rowspan=3 | Server to Client
+
* 0-200 for fuel indicator
| 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 ===
+
Ranges are presumably in in-game ticks
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x1C || rowspan=2 | Play || rowspan=2 | Server to Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Metadata || [[Entities#Entity_Metadata_Format|Metadata]] ||
 
|}
 
  
=== Entity Effect ===
+
'''Enchantment Table'''
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=5 | 0x1D || rowspan=5 | Play || rowspan=5 | Server to Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Effect ID || Byte || See [[http://www.minecraftwiki.net/wiki/Potion_effect#Parameters]]
 
|-
 
| Amplifier || Byte ||
 
|-
 
| Duration || VarInt ||
 
|-
 
| Hide Particles || Boolean ||
 
|}
 
  
=== Remove Entity Effect ===
+
Properties: 0, 1 or 2 depending on the "enchantment slot" being given.
{| class="wikitable"
+
 
 +
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.
 +
 
 +
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x1E || rowspan=2 | Play || rowspan=2 | Server to Client
+
| rowspan="3" | 0x32 || rowspan=3 | Play || rowspan=3 | Client
| Entity ID || VarInt || Entity's ID
+
| 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.
 
|-
 
|-
| Effect ID || Byte ||
+
| Accepted || Bool || Whether the action was accepted.
 
|}
 
|}
  
=== Set Experience ===
+
==== Update Sign ====
  
Sent by the server when the client should change experience levels.
+
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=3 | 0x1F || rowspan=3 | Play || rowspan=3 | Server to Client
+
| rowspan=5 | 0x33 || rowspan=5 | Play || rowspan=5 | Client
| Experience bar || Float || Between 0 and 1
+
| Location || Position || Block Coordinates
 +
|-
 +
| Line 1 || [[Chat]] || First line of text in the sign
 +
|-
 +
| Line 2 || [[Chat]] || Second line of text in the sign
 
|-
 
|-
| Level || VarInt ||
+
| Line 3 || [[Chat]] || Third line of text in the sign
 
|-
 
|-
| Total Experience || VarInt ||
+
| Line 4 || [[Chat]] || Fourth line of text in the sign
 
|}
 
|}
  
=== Entity Properties ===
+
==== Maps ====
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=3 | 0x20 || rowspan=3 | Play || rowspan=3 | Server to Client
+
| rowspan=10 | 0x34 || rowspan=10 | Play || rowspan=10 | Client
| Entity ID || VarInt || Entity's ID
+
| Item Damage || VarInt || The damage value of the map being modified
 
|-
 
|-
| Count || Int || Length of following array
+
| Scale || Byte ||
 +
|-
 +
| Length || VarInt ||
 
|-
 
|-
| Properties || Array of Property Data ||
+
| Icons || 3 * length bytes || First byte, 0xF0 = Direction, 0x0F = Type. Second byte, X. Third byte, Y
|}
+
|-
 
+
| Columns || Byte ||
'''Property Data''' structure:
 
{| class="wikitable"
 
 
|-
 
|-
! Field Name !! Field Type !! Notes
+
| Rows || Byte || Only if Columns is more than 0
 
|-
 
|-
| Key || String ||  
+
| X || Byte || Only if Columns is more than 0
 
|-
 
|-
| Value || Double ||  
+
| Y || Byte || Only if Columns is more than 0
 
|-
 
|-
| List Length || VarInt || Number of list elements that follow.
+
| Length || VarInt || Only if Columns is more than 0
 
|-
 
|-
| Modifiers || Array of Modifier Data || http://www.minecraftwiki.net/wiki/Attribute#Modifiers
+
| Data || Length bytes || Only if Columns is more than 0
 
|}
 
|}
  
Known key values:
+
==== Update Block Entity ====
 +
 
 +
Essentially a block update on a block entity.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
! Key !! Default !! Min !! Max !! Label
+
| rowspan=3 | 0x35 || rowspan=3 | Play || rowspan=3 | Client
 +
| Location || Position ||
 
|-
 
|-
| generic.maxHealth || 20.0 || 0.0 || Double.MaxValue || Max Health
+
| Action || Unsigned Byte || The type of update to perform
 
|-
 
|-
| generic.followRange || 32.0 || 0.0 || 2048.0 || Follow Range
+
| NBT Data || Byte Array || If not present then its TAG_END (0)
|-
 
| 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:
+
'''Actions'''
{| class="wikitable"
+
 
|-
+
* '''1''': Set SpawnPotentials of a mob spawner
! Field Name !! Field Type !! Notes
+
* '''2''': Set command block text (command and last execution status)
|-
+
* '''3''': Set the level, primary, and secondary powers of a beacon
| UUID || 128-bit integer ||
+
* '''4''': Set rotation and skin of mob head
|-
+
* '''5''': Set type of flower in flower pot
| Amount || Double ||
+
* '''6''': Set base color and patterns on a banner
|-
 
| Operation || Byte ||
 
|}
 
  
=== Chunk Data ===
+
==== Sign Editor Open ====
  
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.
+
Sent on placement of sign.
 
 
See also: [[SMP Map Format]]
 
 
 
Changes in 1.8:
 
 
 
* Data value section removed
 
* Extended id section removed
 
* Block id section is now a unsigned short (little endian) per a block
 
* The block id is equal to <code>(id << 4) | data</code>
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=6 | 0x21 || rowspan=6 | Play || rowspan=6 | Server to Client
+
| rowspan=1 | 0x36 || rowspan=1 | Play || rowspan=1 | Client
| Chunk X || Int || Chunk X coordinate
+
| Location || Position || Block coordinates
 +
|}
 +
 
 +
==== Statistics ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To
 +
! colspan="2" | Field Name
 +
! Field Type !! Notes
 
|-
 
|-
| Chunk Z || Int || Chunk Z coordinate
+
| rowspan="3" | 0x37 || rowspan=3 | Play || rowspan=3 | Client
 +
| colspan="2" | Count || VarInt || Number of entries
 
|-
 
|-
| 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=2 | Entry
 +
| Statistic's name || String || https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0
 
|-
 
|-
| Primary bit map || Unsigned Short || Bitmask with 1 for every 16x16x16 section which data follows in the compressed data.
+
| Value || VarInt || The amount to set it to
|-
 
| Size || VarInt || Size of chunk data
 
|-
 
| Data || Byte array || The chunk data is not compressed as of 14w28a
 
 
|}
 
|}
  
=== Multi Block Change ===
+
==== Player List Item ====
 +
 
 +
Sent by the notchian server to update the user list (<tab> in the client).
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID !! Category !! Bound To !! colspan=3 | Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=4 | 0x22 || rowspan=4 | Play || rowspan=4 | Server to Client
+
| rowspan=19 | 0x38 || rowspan=19 | Play || rowspan=19 | Client
| Chunk X || Int || Chunk X coordinate
+
| colspan=3 | Action || VarInt ||  
 
|-
 
|-
| Chunk Z || Int || Chunk Z Coordinate
+
| colspan=3 | Length || VarInt || The following fields are repeated ''length'' times
 
|-
 
|-
| Record count || VarInt || The number of blocks affected
+
| colspan=3 | UUID || UUID || The uuid of the player
 
|-
 
|-
| Records || Array of Records ||
+
! Action !! colspan=4 |  
|}
 
 
 
'''Record'''
 
{| class="wikitable"
 
 
|-
 
|-
! Bit mask !! Width !! Meaning
+
| rowspan=10 | 0 (ADD_PLAYER)
 +
| colspan=2 | Name || String ||
 
|-
 
|-
| 00 FF || 8 bits || Y co-ordinate
+
| colspan=2 | Number of properties || VarInt ||  
 
|-
 
|-
| 0F 00 || 4 bits || Z co-ordinate, relative to chunk
+
| rowspan=4 | Properties 
 +
| Name || String ||
 +
|-
 +
| Value || String ||
 +
|-
 +
| Is Signed || Boolean ||
 +
|-
 +
| Signature || String || Only if Is Signed is true
 +
|-
 +
| colspan=2 | Gamemode || VarInt ||
 +
|-
 +
| colspan=2 | Ping || VarInt ||
 +
|-
 +
| colspan=2 | Has Display Name || Boolean ||
 +
|-
 +
| colspan=2 | Display Name || [[Chat]] || Only send if Has Diplay Name is true
 
|-
 
|-
| F0 00 || 4 bits || X co-ordinate, relative to chunk
+
| 1 (UPDATE_GAMEMODE) || colspan=2 | Gamemode || VarInt ||
 +
|-  
 +
| 2 (UPDATE_LATENCY) || colspan=2 | Ping || VarInt ||
 
|-
 
|-
| ? || VarInt || Block ID
+
| rowspan=2 | 3 (UPDATE_DISPLAY_NAME)
|}
+
| colspan=2 | Has Display Name || Boolean ||
 
 
=== Block Change ===
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=2 | 0x23 || rowspan=2 | Play || rowspan=2 | Server to Client
+
| colspan=2 | Display Name || [[Chat]] || Only send if Has Diplay Name is true
| Location || Position|| Block Coordinates
 
 
|-
 
|-
| Block ID || VarInt || The new block ID for the block. <code>id << 4 &#124; data</code>
+
| 4 (REMOVE_PLAYER) || colspan=2 | || ||
 
|}
 
|}
  
=== Block Action ===
+
==== Player Abilities ====
  
This packet is used for a number of things:
+
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.
* <div class="li">Chests opening and closing
+
* Pistons pushing and pulling
+
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).
* Note blocks playing
+
* Update Beacons
+
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.
 
 
See Also: [[Block Actions]]
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=4 | 0x24 || rowspan=4 | Play || rowspan=4 | Server to Client
+
| rowspan="3" | 0x39 || rowspan=3 | Play || rowspan=3 | Client
| Location || Position || Block Coordinates
+
| Flags || Byte ||
 
|-
 
|-
| Byte 1 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
+
| Flying speed || Float|| previous integer value divided by 250
 
|-
 
|-
| Byte 2 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
+
| Walking speed || Float || previous integer value divided by 250
|-
 
| Block Type || VarInt || The block type for the block
 
 
|}
 
|}
  
 +
==== Tab-Complete ====
  
=== Block Break Animation ===
+
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.
  
0-9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
+
{| class="wikitable"
 
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
You can also set an animation to air! The animation will still be visible.
+
|-
 +
| rowspan=2| 0x3A  || rowspan=2 | Play || rowspan=2 | 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
 +
|}
  
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
+
==== Scoreboard Objective ====
  
Also if you set the coordinates to a special block like water etc. it won't show the actual break animation but some other interesting effects. (Water will lose it's transparency)
+
This is sent to the client when it should create a new scoreboard or remove one.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=3 | 0x25 || rowspan=3 | Play || rowspan=3 | Server to Client
+
| rowspan=4 | 0x3B || rowspan=4 | Play || rowspan=4 | Client
| Entity ID || VarInt || Entity's ID
+
| 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.
 
|-
 
|-
| Location || Position || Block Position
+
| Objective value || String || Only if mode is 0 or 2. The text to be displayed for the score.
 
|-
 
|-
| Destroy Stage || Byte || 0 - 9
+
| Type || String || Only if mode is 0 or 2. "integer" or "hearts"
 
|}
 
|}
  
=== Map Chunk Bulk ===
+
==== Update Score ====
  
See also: [[SMP Map Format]]
+
This is sent to the client when it should update a scoreboard item.  
 
 
1.8 changes at [[#Chunk_Data]]
 
 
 
To reduce the number of bytes this packet is used to send chunks together for better compression results.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=4 | 0x26 || rowspan=4 | Play || rowspan=4 | Server to Client
+
| rowspan=4 | 0x3C || rowspan=4 | Play || rowspan=4 | Client
| 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
+
| Score name|| String || The name of the score to be updated or removed.
 
|-
 
|-
| Chunk column count || VarInt || The number of chunk in this packet
+
| Update/Remove || Byte || 0 to create/update an item. 1 to remove an item.
 
|-
 
|-
| Meta information || Meta || See below
+
| Objective Name || String || The name of the objective the score belongs to.
 
|-
 
|-
| Data || Byte Array || Chunk data. Uncompressed as of 14w28a
+
| Value || VarInt || The score to be displayed next to the entry. Only sent when Update/Remove does not equal 1.
 
|}
 
|}
  
'''Meta'''
+
==== Display Scoreboard ====
 +
 
 +
This is sent to the client when it should display a scoreboard.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
! Field Name !! Field Type !! Notes
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
|Chunk X || Int || The X Coordinate of the chunk
+
| rowspan="2" | 0x3D || rowspan=2 | Play || rowspan=2 | Client
 +
| Position || Byte || The position of the scoreboard. 0 = list, 1 = sidebar, 2 = belowName.
 
|-
 
|-
|Chunk Z || Int || The Z Coordinate of the chunk
+
| Score Name || String || The unique name for the scoreboard to be displayed.
|-
 
|Primary bitmap || Unsigned Short || A bitmap which specifies which sections are not empty in this chunk
 
 
|}
 
|}
  
=== Explosion ===
+
==== Teams ====
  
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
+
Creates and updates teams.
 
 
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="9" | 0x27 || rowspan=9 | Play || rowspan=9 | Server to Client
+
| rowspan=10 | 0x3E || rowspan=10 | Play || rowspan=10 | Client
| X || Float ||
+
| 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.
 
|-
 
|-
| Y || Float ||
+
| Team Display Name || String || Only if Mode = 0 or 2.
 
|-
 
|-
| Z || Float ||
+
| Team Prefix || String || Only if Mode = 0 or 2. Displayed before the players' name that are part of this team.
 
|-
 
|-
| Radius || Float || Currently unused in the client
+
| Team Suffix || String || Only if Mode = 0 or 2. Displayed after the players' name that are part of this team.
 
|-
 
|-
| Record count || Int || This is the count, not the size. The size is 3 times this value.
+
| Friendly fire || Byte || Only if Mode = 0 or 2; 0 for off, 1 for on, 3 for seeing friendly invisibles
 
|-
 
|-
| Records || (Byte, Byte, Byte) × count || Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
+
| Name Tag Visibility || String || Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never.
 
|-
 
|-
| Player Motion X || Float || X velocity of the player being pushed by the explosion
+
| Color || Byte || Only if Mode = 0 or 2. Same as [[Chat]] colors.
 
|-
 
|-
| Player Motion Y || Float || Y velocity of the player being pushed by the explosion
+
| Player count || VarInt || Only if Mode = 0 or 3 or 4. Number of players in the array
 
|-
 
|-
| Player Motion Z || Float || Z velocity of the player being pushed by the explosion
+
| Players || Array of strings || Only if Mode = 0 or 3 or 4. Players to be added/remove from the team. Max 40 characters so may be uuid's later
 
|}
 
|}
  
=== Effect ===
+
==== Plugin Message ====
  
Sent when a client is to play a sound or particle effect.
+
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>.
  
By default, the minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1013 (mob.wither.spawn), and is ignored for any other value by the client.
+
More documentation on this: http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=4 | 0x28 || rowspan=4 | Play || rowspan=4 | Server to Client
+
| rowspan=2 | 0x3F || rowspan=2 | Play || rowspan=2 | Client
| Effect ID || Int || The ID of the effect, see below.
+
| Channel || String || Name of the "channel" used to send the data.
 
|-
 
|-
| Location || Position|| The location of the effect
+
| 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| Data || Int || Extra data for certain effects, see below.
+
| 0x40 || rowspan=1 | Play || rowspan=1 | Client
 +
| Reason || String || Displayed to the client when the connection terminates. Must be valid JSON.
 +
|}
 +
 
 +
==== Server Difficulty ====
 +
 
 +
Changes the difficulty setting in the client's option menu
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| Disable relative volume || Bool || See above
+
| rowspan=1 | 0x41 || rowspan=1 | Play || rowspan=1 | Client
 +
| Difficulty || Unsigned Byte || 0:PEACEFUL, 1:EASY, 2:NORMAL, 3: HARD
 
|}
 
|}
 +
 +
 +
==== Combat Event ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! ID !! Name
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| colspan=2 | '''Sound'''
+
| rowspan=6 | 0x42 || rowspan=6 | Play || rowspan=6 | Client
 +
| Event || VarInt || 0 ENTER_COMBAT, 1 END_COMBAT, 2 ENTITY_DEAD
 
|-
 
|-
| 1000|| <code>random.click</code>
+
| Duration || VarInt || Only for END_COMBAT
 
|-
 
|-
| 1001|| <code>random.click</code>
+
| Entity ID || Int || Only for END_COMBAT
 
|-
 
|-
| 1002|| <code>random.bow</code>
+
| Player ID || VarInt || Only for ENTITY_DEAD
 
|-
 
|-
| 1003|| <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
+
| Entity ID || Int || Only for ENTITY_DEAD
 
|-
 
|-
| 1004|| <code>random.fizz</code>
+
| Message || String || Only for ENTITY_DEAD
 +
|}
 +
 
 +
==== Camera ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 1005|| Play a music disc. '''Data''' [http://www.minecraftwiki.net/wiki/Music_Discs Record ID]
+
| rowspan=1 | 0x43 || rowspan=1 | Play || rowspan=1 | Client
 +
| Camera ID || VarInt ||
 +
|}
 +
 
 +
==== World Border ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
 
|-
 
|-
| ''(1006 not assigned)'' ||
+
| rowspan=18 | 0x44 || rowspan=18 | Play || rowspan=18 | Client
 +
| colspan=2 | Action || VarInt ||
 
|-
 
|-
| 1007|| <code>mob.ghast.charge</code>
+
! Action !! Name !! !!
 
|-
 
|-
| 1008|| <code>mob.ghast.fireball</code>
+
| 0 (SET_SIZE)
 +
| Radius || Double ||
 
|-
 
|-
| 1009|| <code>mob.ghast.fireball</code>, but with a lower volume.
+
| rowspan=3 | 1 (LERP_SIZE)
 +
| Old radius || Double ||
 
|-
 
|-
| 1010|| <code>mob.zombie.wood</code>
+
| New radius || Double ||
 
|-
 
|-
| 1011|| <code>mob.zombie.metal</code>
+
| Speed || VarLong ||
 
|-
 
|-
| 1012|| <code>mob.zombie.woodbreak</code>
+
| rowspan=2 | 2 (SET_CENTER)
 +
| X || Double ||  
 
|-
 
|-
| 1013|| <code>mob.wither.spawn</code>
+
| Z || Double ||
 
|-
 
|-
| 1014|| <code>mob.wither.shoot</code>
+
| rowspan=8 | 3 (INITIALIZE)
 +
| X || Double ||
 
|-
 
|-
| 1015|| <code>mob.bat.takeoff</code>
+
| Z || Double ||
 
|-
 
|-
| 1016|| <code>mob.zombie.infect</code>
+
| Old radius || Double ||
 
|-
 
|-
| 1017|| <code>mob.zombie.unfect</code>
+
| New radius || Double ||
 
|-
 
|-
| 1018|| <code>mob.enderdragon.end</code>
+
| Speed || VarLong ||
 
|-
 
|-
| 1020|| <code>random.anvil_break</code>
+
| Portal Teleport Boundary || VarInt || Resulting coordinates from a portal teleport are limited to +-value. Usually 29999984.
 
|-
 
|-
| 1021|| <code>random.anvil_use</code>
+
| Warning time || VarInt ||
 
|-
 
|-
| 1022|| <code>random.anvil_land</code>
+
| Warning blocks || VarInt ||
 
|-
 
|-
| colspan=2 | '''Particle'''
+
| rowspan=1 | 4 (SET_WARNING_TIME)
 +
| Warning time || VarInt ||
 
|-
 
|-
| 2000|| Spawns 10 smoke particles, e.g. from a fire. '''Data''' direction, see below
+
| rowspan=1 | 5 (SET_WARNING_BLOCKS)
|-
+
| Warning blocks || VarInt ||
| 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.
 
 
|}
 
|}
  
Smoke directions:
+
==== Title ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! ID !! Direction
+
! Packet ID !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
 
|-
 
|-
| 0 || South - East
+
| rowspan=9 | 0x45 || rowspan=9 | Play || rowspan=9 | Client
 +
| colspan=2 | Action || VarInt ||
 
|-
 
|-
| 1 || South
+
! Action !! Name !! !!
 
|-
 
|-
| 2 || South - West
+
| 0 (TITLE) || Text || [[Chat]] ||
 
|-
 
|-
| 3 || East
+
| 1 (SUBTITLE) || Text || [[Chat]] ||
 
|-
 
|-
| 4 || (Up or middle ?)
+
| rowspan=3 | 2 (TIMES)  
 +
| Fade In || Int ||
 
|-
 
|-
| 5 || West
+
| Stay || Int ||  
 
|-
 
|-
| 6 || North - East
+
| Fade Out || Int ||
 
|-
 
|-
| 7 || North
+
| 3 (CLEAR) || || ||
 
|-
 
|-
| 8 || North - West
+
| 4 (RESET) || || ||
 
|}
 
|}
  
=== Sound Effect ===
+
==== Set Compression ====
  
Used to play a sound effect on the client.
+
{| class="wikitable"
 
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
All known sound effect names can be seen [https://github.com/SirCmpwn/Craft.Net/blob/master/source/Craft.Net.Common/SoundEffect.cs here].
+
|-
 +
| rowspan=1 | 0x46 || rowspan=1 | Play || rowspan=1 | Client
 +
| Threshold || VarInt || Threshold is the max size of a packet before its compressed
 +
|}
  
Custom sounds may be added by resource packs
+
==== Player List Header/Footer ====
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="6" | 0x29 || rowspan=6 | Play || rowspan=6 | Server to Client
+
| rowspan=2 | 0x47 || rowspan=2 | Play || rowspan=2 | Client
| Sound name || String ||  
+
| Header || [[Chat]] ||  
 
|-
 
|-
| Effect position X || Int || Effect X multiplied by 8
+
| Footer || [[Chat]] ||  
 +
|}
 +
 
 +
==== Resource Pack Send ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| Effect position Y || Int || Effect Y multiplied by 8
+
| rowspan=2 | 0x48 || rowspan=2 | Play || rowspan=2 | Client
 +
| URL || String || The URL to the resource pack.
 
|-
 
|-
| Effect position Z || Int || Effect Z multiplied by 8
+
| Hash || String || A 40 character hexadecimal and lower-case 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
| Volume || Float || 1 is 100%, can be more
 
|-
 
| Pitch || Unsigned Byte || 63 is 100%, can be more
 
 
|}
 
|}
  
=== Particle ===
+
==== Update Entity NBT ====  
 
 
Displays the named particle
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=11 | 0x2A || rowspan=11 | Play || rowspan=11 | Server to Client
+
| rowspan=2 | 0x49 || rowspan=2 | Play || rowspan=2 | Client
| Particle Id || Int ||  
+
| Entity ID || VarInt ||  
 
|-
 
|-
| Long Distance || Boolean || If true, particle distance increases from 256 to 65536.
+
| Tag || NBT Tag ||
|-
 
| 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
 
|-
 
| Data || Array of VarInt || Length depends on particle. ICON_CRACK, BLOCK_CRACK, and BLOCK_DUST have lengths of 2, the rest have 0.
 
 
|}
 
|}
  
Particle Ids
+
=== Serverbound ===
 +
 
 +
==== Keep Alive ====
 +
 
 +
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Particle Name
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! Particle Id
 
 
|-
 
|-
| explode
+
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Server
| 0
+
| Keep Alive ID || VarInt ||
 +
|}
 +
 
 +
==== 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]].
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| largeexplosion
+
| rowspan=1 | 0x01 || rowspan=1 | Play || rowspan=1 | Server
| 1
+
| 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| hugeexplosion
+
| rowspan=5 | 0x02 || rowspan=5 | Play || rowspan=5 | Server
| 2
+
| Target || VarInt ||
 
|-
 
|-
| fireworksSpark
+
| Type || VarInt || 0 = INTERACT, 1 = ATTACK, 2 = INTERACT_AT
| 3
 
 
|-
 
|-
| bubble
+
| Target X || Float || Only if Type == INTERACT_AT
| 4
 
 
|-
 
|-
| wake
+
| Target Y || Float || Only if Type == INTERACT_AT
| 5
 
 
|-
 
|-
| splash
+
| Target Z || Float || Only if Type == INTERACT_AT
| 6
+
|}
 +
 
 +
==== 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| suspended
+
| rowspan=1 | 0x03 || rowspan=1 | Play || rowspan=1 | Server
| 7
+
| On Ground || Bool || True if the client is on the ground, False otherwise
 +
|}
 +
 
 +
==== Player Position ====
 +
 
 +
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"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| townaura
+
| rowspan=4 | 0x04 || rowspan=4 | Play || rowspan=4 | Server
| 8
+
| X || Double || Absolute position
 
|-
 
|-
| crit
+
| FeetY || Double || Absolute feet position, normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
| 9
 
 
|-
 
|-
| magicCrit
+
| Z || Double || Absolute position
| 10
 
 
|-
 
|-
| smoke
+
| On Ground || Bool || True if the client is on the ground, False otherwise
| 11
+
|}
|-
+
 
| largesmoke
+
==== Player Look ====
| 12
+
 
|-
+
[[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]]
| mobSpell?
+
 
| 13
+
[[File:Yaw.png|thumb|The unit circle of yaw, redrawn]]
|-
+
 
| instantSpell
+
Updates the direction the player is looking in.
| 14
+
 
|-
+
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.
| spell
+
 
| 15
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
|-
+
 
| witchMagic
+
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
| 17
+
  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)
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| dripWater
+
| rowspan=3| 0x05 || rowspan=3 | Play || rowspan=3 | Server
| 18
+
| Yaw || Float || Absolute rotation on the X Axis, in degrees
 
|-
 
|-
| dripLava
+
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
| 19
 
 
|-
 
|-
| angryVillager
+
| On Ground || Bool || True if the client is on the ground, False otherwise
| 20
+
|}
|-
+
 
| happyVillager
+
==== Player Position And Look ====
| 21
+
 
 +
A combination of Player Look and Player position.
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| depthsuspend
+
| rowspan=6 | 0x06 || rowspan=6 | Play || rowspan=6 | Server
| 22
+
| X || Double || Absolute position
 
|-
 
|-
| note
+
| FeetY || Double || Absolute feet position. Is normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
| 23
 
 
|-
 
|-
| portal
+
| Z || Double || Absolute position
| 24
 
 
|-
 
|-
| enchantmenttable
+
| Yaw || Float || Absolute rotation on the X Axis, in degrees
| 25
 
 
|-
 
|-
| flame
+
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
| 26
 
 
|-
 
|-
| lava
+
| On Ground || Bool || True if the client is on the ground, False otherwise
| 27
+
|}
 +
 
 +
==== 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| footstep
+
| rowspan="3" | 0x07 || rowspan="3" | Play || rowspan="3" | Server
| 28
+
| Status || Byte || The action the player is taking against the block (see below)
 +
|-
 +
| Location || Position || Block position
 
|-
 
|-
| cloud
+
| Face || Byte || The face being hit (see below)
| 29
+
|}
 +
 
 +
Status can (currently) be one of six values:
 +
 
 +
{| class="wikitable"
 +
! Meaning !! Value
 
|-
 
|-
| reddust
+
| Started digging || <code>0</code>
| 30
 
 
|-
 
|-
| snowballpoof
+
| Cancelled digging || <code>1</code>
| 31
 
 
|-
 
|-
| snowshovel
+
| Finished digging || <code>2</code>
| 32
 
 
|-
 
|-
| slime
+
| Drop item stack || <code>3</code>
| 33
 
 
|-
 
|-
| heart
+
| Drop item || <code>4</code>
| 34
 
 
|-
 
|-
| barrier
+
| Shoot arrow / finish eating || <code>5</code>
| 35
 
 
|}
 
|}
  
=== Change Game State ===
+
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.
  
It appears when a bed can't be used as a spawn point and when the rain state changes.  
+
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 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.
+
The face can be one of six values, representing the face being hit:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan="2" | 0x2B || rowspan=2 | Play || rowspan=2 | Server to Client
+
| Value || 0 || 1 || 2 || 3 || 4 || 5
| Reason || Unsigned Byte ||
 
 
|-
 
|-
| Value || Float || Depends on reason
+
| Offset || -Y || +Y || -Z || +Z || -X || +X
 
|}
 
|}
  
'''Reason codes'''
+
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 ====
 
{| class="wikitable"
 
{| class="wikitable"
! Code !! Effect !! Notes
 
 
|-
 
|-
| 0 || Invalid Bed || "tile.bed.notValid"
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 1 || End raining ||  
+
| rowspan=6 | 0x08 || rowspan=6 | Play || rowspan=6 | Server
 +
| Location || Position || Block position
 
|-
 
|-
| 2 || Begin raining ||  
+
| Direction || Byte || The offset to use for block/item placement (see below)
 
|-
 
|-
| 3 || Change game mode || "gameMode.changed" 0 - Survival, 1 - Creative, 2 - Adventure, 3 - Spectator
+
| Held item || [[Slot_Data|Slot]] ||
 
|-
 
|-
| 4 || Enter credits ||
+
| Cursor position X || Byte || The position of the crosshair on the block
 
|-
 
|-
| 5 || Demo messages || 0 - Show welcome to demo screen, 101 - Tell movement controls, 102 - Tell jump control, 103 - Tell inventory control
+
| Cursor position Y || Byte ||
|-
 
| 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
+
| Cursor position Z || Byte ||
|-
+
|}
| 8 || Fade time || Time in ticks for the sky to fade
+
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, pulling back 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.
  
=== Spawn Global Entity ===
+
==== Held Item Change ====
  
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.
+
Sent when the player changes the slot selection
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="5" | 0x2C || rowspan=5 | Play || rowspan=5 | Server to Client
+
| rowspan=1 | 0x09 || rowspan=1 | Play || rowspan=1 | Server
| Entity ID || VarInt || The entity ID of the thunderbolt
+
| Slot || Short || The slot which the player has selected (0-8)
|-
+
|}
| Type || Byte || The global entity type, currently always 1 for thunderbolt.
+
 
|-
+
==== Animation ====
| X || Int || Thunderbolt X a [[Data_Types#Fixed-point_numbers|fixed-point number]]
+
{| class="wikitable"
|-
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
| Y || Int || Thunderbolt Y a [[Data_Types#Fixed-point_numbers|fixed-point number]]
 
 
|-
 
|-
| Z || Int || Thunderbolt Z a [[Data_Types#Fixed-point_numbers|fixed-point number]]
+
| rowspan=1 | 0x0A  || rowspan=1 | Play || rowspan=1 | Server
 
|}
 
|}
  
=== Open Window ===
+
==== Entity Action ====
  
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.
+
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.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=5 | 0x2D || rowspan=5 | Play || rowspan=5 | Server to Client
+
| rowspan="3" | 0x0B || rowspan="3" | Play || rowspan="3" | Server
| Window id || Unsigned Byte || A unique id number for the window to be displayed.  Notchian server implementation is a counter, starting at 1.
+
| Entity ID || VarInt || Player ID
 
|-
 
|-
| Inventory Type || String || The window type to use for display. Check below
+
| Action ID || VarInt || The ID of the action, see below.
 
|-
 
|-
| Window title || [[Chat]] || The title of the window.
+
| Jump Boost || VarInt || Horse jump boost. Ranged from 0 -> 100.
|-
 
| Number of Slots || Unsigned Byte || Number of slots in the window (excluding the number of slots in the player inventory).
 
|-
 
| Entity ID || Int || EntityHorse's entityId. Only sent when window type is equal to "EntityHorse".
 
 
|}
 
|}
  
See [[Inventory#Windows|inventory windows]] for further information.
+
Action ID can be one of the following values:
 
 
=== 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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! ID !! Action
 
|-
 
|-
| 0x2E || rowspan=1 | Play || rowspan=1 | Server to Client
+
| 0 || Crouch
| 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.
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan="3" | 0x2F || rowspan=3 | Play || rowspan=3 | Server to Client
+
| 1 || Uncrouch
| 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
+
| 2 || Leave bed
 
|-
 
|-
| Slot data || [[Slot_Data|Slot]] ||
+
| 3 || Start sprinting
 +
|-
 +
| 4 || Stop sprinting
 +
|-
 +
| 5 || Jump with horse
 +
|-
 +
| 6 || Open inventory
 
|}
 
|}
  
=== Window Items ===
+
==== Steer Vehicle ====
 
 
[[File:Inventory-slots.png|thumb|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.
 
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="3" | 0x30 || rowspan=3 | Play || rowspan=3 | Server to Client
+
| rowspan=3 | 0x0C || rowspan=3 | Play || rowspan=3 | Server
| Window ID || Unsigned Byte || The id of window which items are being sent for. 0 for player inventory.
+
| Sideways || Float || Positive to the left of the player
 
|-
 
|-
| Count || Short || The number of slots (see below)
+
| Forward || Float || Positive forward
 
|-
 
|-
| Slot data || Array of [[Slot_Data|Slot]]s ||
+
| Flags|| Unsigned Byte || 0x1 Jump, 0x2 Unmount
 
|}
 
|}
  
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
+
==== 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.  
  
=== Window Property ===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="3" | 0x31 || rowspan=3 | Play || rowspan=3 | Server to Client
+
| 0x0D || rowspan=1 | Play || rowspan=1 | Server
| Window ID || Unsigned Byte || The id of the window.
+
| Window id || byte || This is the id of the window that was closed. 0 for inventory.
|-
 
| Property || Short || Which property should be updated.
 
|-
 
| Value || Short || The new value for the property.
 
 
|}
 
|}
  
'''Furnace'''
 
  
Properties:
+
==== Click Window ====
  
* 0: Progress arrow
+
This packet is sent by the player when it clicks on a slot in a window.
* 1: Fire icon (fuel)
 
  
Values:
+
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 +
|-
 +
| rowspan="6" | 0x0E || rowspan=6 | Play || rowspan=6 | 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_Data|Slot]] ||
 +
|}
  
* 0-200 for progress arrow
+
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
* 0-200 for fuel indicator
 
  
Ranges are presumably in in-game ticks
+
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.
  
'''Enchantment Table'''
+
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]].
  
Properties: 0, 1 or 2 depending on the "enchantment slot" being given.
+
The distinct type of click performed by the client is determined by the combination of the "Mode" and "Button" fields.
 
+
{| class="wikitable"
Values: The enchantment's level.
+
! Mode !! Button !! Slot !! Trigger
 
+
|-
'''Beacon'''
+
! rowspan="2" | 0
 
+
| 0 || Normal || Left mouse click
* 0: Power level
+
|-
* 1: Potion effect one
+
| 1 || Normal || Right mouse click
* 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.
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan="3" | 0x32 || rowspan=3 | Play || rowspan=3 | Server to Client
+
! rowspan="2" | 1
| Window ID || Byte || The id of the window that the action occurred in.
+
| 0 || Normal || Shift + left mouse click
 
|-
 
|-
| Action number || Short || Every action that is to be accepted has a unique number. This field corresponds to that number.
+
| 1 || Normal || Shift + right mouse click ''(Identical behavior)''
 
|-
 
|-
| Accepted || Bool || Whether the action was accepted.
+
! rowspan="5" | 2
|}
+
| 0 || Normal || Number key 1
 
+
|-
=== Update Sign ===
+
| 1 || Normal || Number key 2
 
 
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"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=5 | 0x33 || rowspan=5 | Play || rowspan=5 | Server to Client
+
| 2 || Normal || Number key 3
| Location || Position || Block Coordinates
 
 
|-
 
|-
| Line 1 || [[Chat]] || First line of text in the sign
+
| ...
 +
| ...
 +
| ...
 
|-
 
|-
| Line 2 || [[Chat]] || Second line of text in the sign
+
| 8 || Normal || Number key 9
 
|-
 
|-
| Line 3 || [[Chat]] || Third line of text in the sign
+
! rowspan="1" | 3
 +
| 2 || Normal || Middle click
 
|-
 
|-
| Line 4 || [[Chat]] || Fourth line of text in the sign
+
! rowspan="4" | 4
|}
+
| 0 || Normal || Drop key (Q)
 
 
=== Maps ===
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=10 | 0x34 || rowspan=10 | Play || rowspan=10 | Server to Client
+
| 1 || Normal || Ctrl + Drop key (Ctrl-Q)
| Item Damage || VarInt || The damage value of the map being modified
 
 
|-
 
|-
| Scale || Byte ||  
+
| 0 || -999 || Left click outside inventory holding nothing ''(No-op)''
|-  
+
|-
| Length || VarInt ||
+
| 1 || -999 || Right click outside inventory holding nothing ''(No-op)''
 +
|-
 +
! rowspan="6" | 5
 +
| 0 || -999 || Starting left mouse drag ''(Or middle mouse)''
 
|-
 
|-
| Icons || 3 * length bytes || First byte, 0xF0 = Direction, 0x0F = Type. Second byte, X. Third byte, Y
+
| 4 || -999 || Starting right mouse drag
|-  
 
| Columns || Byte ||
 
 
|-
 
|-
| Rows || Byte || Only if Columns is more than 0
+
| 1 || Normal || Add slot for left-mouse drag
 
|-
 
|-
| X || Byte || Only if Columns is more than 0
+
| 5 || Normal || Add slot for right-mouse drag
 
|-
 
|-
| Y || Byte || Only if Columns is more than 0
+
| 2 || -999 || Ending left mouse drag
 
|-
 
|-
| Length || VarInt || Only if Columns is more than 0
+
| 6 || -999 || Ending right mouse drag
 
|-
 
|-
| Data || Length bytes || Only if Columns is more than 0
+
! 6
 +
| 0 || Normal || Double click
 
|}
 
|}
  
=== Update Block Entity ===
+
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):
 +
 
 +
# 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);
 +
# packet with mode 5, slot -999, button (2 | 6);
  
Essentially a block update on a block entity.
+
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"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=3 | 0x35 || rowspan=3 | Play || rowspan=3 | Server to Client
+
| rowspan="3" | 0x0F || rowspan=3 | Play || rowspan=3 | Server
| Location || Position ||
+
| Window ID || Byte || The id of the window that the action occurred in.
 
|-
 
|-
| Action || Unsigned Byte || The type of update to perform
+
| Action number || Short || Every action that is to be accepted has a unique number. This field corresponds to that number.
 
|-
 
|-
| NBT Data || Byte Array || If not present then its TAG_END (0)
+
| Accepted || Bool || Whether the action was accepted.
 
|}
 
|}
  
'''Actions'''
+
==== Creative Inventory Action ====
  
* '''1''': Set SpawnPotentials of a mob spawner
+
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:
* '''2''': Set command block text (command and last execution status)
 
* '''3''': Set the level, primary, and secondary powers of a beacon
 
* '''4''': Set rotation and skin of mob head
 
* '''5''': Set type of flower in flower pot
 
* '''6''': Set base color and patterns on a banner
 
  
=== Sign Editor Open ===
+
* If an item is dropped into the quick bar
 
+
* If an item is picked up from the quick bar (item id is -1)
Sent on placement of sign.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x36 || rowspan=1 | Play || rowspan=1 | Server to Client
+
| rowspan="2" | 0x10 || rowspan=2 | Play || rowspan=2 | Server
| Location || Position || Block coordinates
+
| Slot || Short || Inventory slot
 +
|-
 +
| Clicked item || [[Slot_Data|Slot]] ||
 
|}
 
|}
  
=== Statistics ===
+
==== Enchant Item ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To  
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
! colspan="2" | Field Name
 
! Field Type !! Notes
 
 
|-
 
|-
| rowspan="3" | 0x37 || rowspan=3 | Play || rowspan=3 | Server to Client
+
| rowspan="2" | 0x11 || rowspan=2 | Play || rowspan=2 | Server
| colspan="2" | Count || VarInt || Number of entries
+
| Window ID || Byte || The ID sent by [[#Open Window|Open Window]]
 
|-
 
|-
| rowspan=2 | Entry
+
| Enchantment || Byte || The position of the enchantment on the enchantment table window, starting with 0 as the topmost one.
| Statistic's name || String || https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0
 
|-
 
| Value || VarInt || The amount to set it to
 
 
|}
 
|}
  
=== Player List Item ===
+
==== Update Sign ====
  
Sent by the notchian server to update the user list (<tab> in the client).
+
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 !! Category !! Bound To !! colspan=3 | Field Name !! Field Type !! Notes
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=19 | 0x38 || rowspan=19 | Play || rowspan=19 | Server to Client
+
| rowspan=5 | 0x12 || rowspan=5 | Play || rowspan=5 | Server
| colspan=3 | Action || VarInt ||  
+
| Location || Position || Block Coordinates
 
|-
 
|-
| colspan=3 | Length || VarInt || The following fields are repeated ''length'' times
+
| Line 1 || [[Chat]] || First line of text in the sign
 
|-
 
|-
| colspan=3 | UUID || UUID || The uuid of the player
+
| Line 2 || [[Chat]] || Second line of text in the sign
 
|-
 
|-
! Action !! colspan=4 |  
+
| Line 3 || [[Chat]] || Third line of text in the sign
 
|-
 
|-
| rowspan=10 | 0 (ADD_PLAYER)  
+
| Line 4 || [[Chat]] || Fourth line of text in the sign
| colspan=2 | Name || String ||
+
|}
 +
 
 +
==== 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| colspan=2 | Number of properties || VarInt ||  
+
| rowspan="3" | 0x13 || rowspan=3 | Play || rowspan=3 | Server
 +
| Flags || Byte ||
 
|-
 
|-
| rowspan=4 | Properties 
+
| Flying speed || Float|| previous integer value divided by 250
| Name || String ||
 
 
|-
 
|-
| Value || String ||
+
| Walking speed || Float || previous integer value divided by 250
|-
 
| Is Signed || Boolean ||
 
|-
 
| Signature || String || Only if Is Signed is true
 
|-
 
| colspan=2 | Gamemode || VarInt ||
 
|-
 
| colspan=2 | Ping || VarInt ||
 
|-
 
| colspan=2 | Has Display Name || Boolean ||
 
|-
 
| colspan=2 | Display Name || [[Chat]] || Only send if Has Diplay Name is true
 
|-
 
| 1 (UPDATE_GAME_MODE) || colspan=2 | Gamemode || VarInt ||
 
|-
 
| 2 (UPDATE_LATENCY) || colspan=2 | Ping || VarInt ||
 
|-
 
| rowspan=2 | 3 (UPDATE_DISPLAY_NAME)
 
| colspan=2 | Has Display Name || Boolean ||
 
|-
 
| colspan=2 | Display Name || [[Chat]] || Only send if Has Diplay Name is true
 
|-
 
| 4 (REMOVE_PLAYER) || colspan=2 | || ||
 
 
|}
 
|}
  
=== Player Abilities ===
+
==== Tab-Complete ====
  
The latter 2 floats are used to indicate the walking and flying speeds respectively, while the first byte is used to determine the value of 4 booleans.
+
Sent when the user presses [tab] while writing text. The payload contains all text behind the cursor.
 
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan="3" | 0x39 || rowspan=3 | Play || rowspan=3 | Server to Client
+
| rowspan=3 | 0x14  || rowspan=3 | Play || rowspan=3 | Server
| Flags || Byte ||
+
| Text || String ||
 
|-
 
|-
| Flying speed || Float|| previous integer value divided by 250
+
| Has Position || Boolean ||
 
|-
 
|-
| Walking speed || Float || previous integer value divided by 250
+
| Looked at block || Position || The position of the block being looked at. Only sent if the previous field is true
 
|}
 
|}
  
=== Tab-Complete ===
+
==== Client Settings ====
  
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 when the player connects, or when settings are changed.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2| 0x3A  || rowspan=2 | Play || rowspan=2 | Server to Client
+
| rowspan=5 | 0x15 || rowspan=5 | Play || rowspan=5 | Server
| Count || VarInt || Number of following strings
+
| Locale || String || en_GB
 
|-
 
|-
| Match || String || One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
+
| View distance || Byte || Client-side render distance(chunks)
|}
 
 
 
=== Scoreboard Objective ===
 
 
 
This is sent to the client when it should create a new scoreboard or remove one.
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
 
|-
 
|-
| rowspan=4 | 0x3B || rowspan=4 | Play || rowspan=4 | Server to Client
+
| Chat flags || Byte || Chat settings. See notes below.
| 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.
+
| Chat colours || Bool || "Colours" multiplayer setting
 
|-
 
|-
| Objective value || String || Only if mode is 0 or 2. The text to be displayed for the score.
+
| Displayed skin parts || Unsigned Byte || Skin parts. See note below
|-
 
| Type || String || Only if mode is 0 or 2. "integer" or "hearts"
 
 
|}
 
|}
  
=== Update Score ===
+
Chat flags has several values packed into one byte.
 +
 
 +
'''Chat Enabled:''' Bits 0-1. 00: Enabled.  01: Commands only.  10: Hidden.
  
This is sent to the client when it should update a scoreboard item.  
+
Displayed skin parts also packs several values into one byte.
  
{| class="wikitable"
+
Bit 0: Cape enabled
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
 
|-
+
Bit 1: Jacket enabled
| rowspan=4 | 0x3C || rowspan=4 | Play || rowspan=4 | Server to Client
+
 
| Score name|| String || The name of the score to be updated or removed.
+
Bit 2: Left Sleeve enabled
|-
+
 
| Update/Remove || Byte || 0 to create/update an item. 1 to remove an item.
+
Bit 3: Right Sleeve enabled
|-
+
 
| Objective Name || String || The name of the objective the score belongs to.
+
Bit 4: Left Pants Leg enabled
|-
 
| Value || VarInt || The score to be displayed next to the entry. Only sent when Update/Remove does not equal 1.
 
|}
 
  
=== Display Scoreboard ===
+
Bit 5: Right Pants Leg enabled
  
This is sent to the client when it should display a scoreboard.
+
Bit 6: Hat enabled
  
{| class="wikitable"
+
The most significant bit (bit 7) appears to be unused.
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan="2" | 0x3D || rowspan=2 | Play || rowspan=2 | Server to 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 ===
+
==== Client Status ====
  
Creates and updates teams.
+
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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=10 | 0x3E || rowspan=10 | Play || rowspan=10 | Server to Client
+
| rowspan=1 | 0x16 || rowspan=1 | Play || rowspan=1 | Server
| Team Name || String || A unique name for the team. (Shared with scoreboard).
+
| Action ID || VarInt || See below
|-
+
|}
| Mode || Byte || If 0 then the team is created.
 
If 1 then the team is removed.
 
  
If 2 the team team information is updated.
+
Action ID values:
 
+
{| class="wikitable"
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.
+
! Action ID !! Name
 
|-
 
|-
| Team Prefix || String || Only if Mode = 0 or 2. Displayed before the players' name that are part of this team.
+
| 0 || Perform respawn
 
|-
 
|-
| Team Suffix || String || Only if Mode = 0 or 2. Displayed after the players' name that are part of this team.
+
| 1 || Request stats
 
|-
 
|-
| Friendly fire || Byte || Only if Mode = 0 or 2; 0 for off, 1 for on, 3 for seeing friendly invisibles
+
| 2 || Open inventory achievement
|-
 
| Name Tag Visibility || String || Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never. 
 
|-
 
| Color || Byte ||  Only if Mode = 0 or 2. Same as [[Chat]] colors.
 
|-
 
| Player count || VarInt || 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. Max 40 characters so may be uuid's later
 
 
|}
 
|}
  
=== Plugin Message ===
+
==== Plugin Message ====
  
 
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>.
 
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/
 
More documentation on this: http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/
 +
 +
Note that the data length is known from the packet length, so there is no need for a length member being sent.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=2 | 0x3F || rowspan=2 | Play || rowspan=2 | Server to Client
+
| rowspan=2 | 0x17 || rowspan=2 | Play || rowspan=2 | Server
 
| Channel || String || Name of the "channel" used to send the data.
 
| Channel || String || Name of the "channel" used to send the data.
 
|-
 
|-
Line 2,432: Line 2,476:
 
|}
 
|}
  
=== Disconnect ===
+
==== Spectate ====
 
 
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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 0x40 || rowspan=1 | Play || rowspan=1 | Server to Client
+
| rowspan=1 | 0x18 || rowspan=1 | Play || rowspan=1 | Server
| Reason || String || Displayed to the client when the connection terminates. Must be valid JSON.
+
| Target Player || UUID ||
 
|}
 
|}
  
=== Server Difficulty ===
+
==== Resource Pack Status ====  
  
Changes the difficulty setting in the client's option menu
 
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x41 || rowspan=1 | Play || rowspan=1 | Server to Client
+
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Server
| Difficulty || Unsigned Byte || 0:PEACEFUL, 1:EASY, 2:NORMAL, 3: HARD
+
| Hash || String || The hash sent in the [[#Resource Pack Send|Resource Pack Send]] packet.
 +
|-
 +
| Result || VarInt ||  Successfully loaded: 0, Declined: 1, Failed download: 2, Accepted: 3
 
|}
 
|}
  
 +
== Status ==
 +
The status ping works as follows.
 +
    C->S : Handshake State=1
 +
    C->S : Request
 +
    S->C : Response
 +
    C->S : Ping
 +
    S->C : Ping
  
=== Combat Event ===
+
=== Clientbound ===
  
 +
==== Response ====
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=6 | 0x42 || rowspan=6 | Play || rowspan=6 | Server to Client
+
| rowspan=1 | 0x00  || rowspan=1 | Status || rowspan=1 | Client
| Event || VarInt || 0 ENTER_COMBAT, 1 END_COMBAT, 2 ENTITY_DEAD
+
| JSON Response || String || https://gist.github.com/thinkofdeath/6927216
|-
 
| Duration || VarInt || Only for END_COMBAT
 
|-
 
| Entity ID || Int || Only for END_COMBAT
 
|-
 
| Player ID || VarInt || Only for ENTITY_DEAD
 
|-
 
| Entity ID || Int || Only for ENTITY_DEAD
 
|-
 
| Message || String || Only for ENTITY_DEAD
 
 
|}
 
|}
  
=== Camera ===
 
  
 +
==== Ping ====
 
{| class="wikitable"
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=1 | 0x43 || rowspan=1 | Play || rowspan=1 | Server to Client
+
| rowspan=1 | 0x01  || rowspan=1 | Status || rowspan=1 | Client
| Camera ID || VarInt ||
+
| Time || Long || Should be the same as sent by the client
 
|}
 
|}
  
=== World Border ===  
+
=== Serverbound ===
  
 +
==== Request ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=18 | 0x44 || rowspan=18 | Play || rowspan=18 | Server to Client
+
| rowspan=1 | 0x00 || Status || Server || || ||
| colspan=2 | Action || VarInt ||
+
|}
 +
 
 +
 
 +
==== Ping ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
! Action !! Name !! !!
+
| rowspan=1 | 0x01  || rowspan=1 | Status || rowspan=1 | 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.
 +
 
 +
<nowiki>*</nowiki> It could be that only one of the two conditions is enough for an unencrypted connection.
 +
 
 +
See [[Protocol Encryption]] for details.
 +
 
 +
=== Clientbound ===
 +
 
 +
==== Disconnect ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| 0 (SET_SIZE)
+
| rowspan=1 | 0x00 || rowspan=1 | Login || rowspan=1 | Client
| Radius || Double ||
+
| JSON Data || String ||
 +
|}
 +
 
 +
==== Encryption Request ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=3 | 1 (LERP_SIZE)
+
| rowspan=5 | 0x01  || rowspan=5 | Login || rowspan=5 | Client
| Old radius || Double ||
+
| Server ID || String || appears to be empty as of 1.7.x
 
|-
 
|-
| New radius || Double ||
+
| Length || VarInt || length of public key
 
|-
 
|-
| Speed || VarLong ||
+
| Public Key || Byte array ||  
 
|-
 
|-
| rowspan=2 | 2 (SET_CENTER)
+
| Length || VarInt || length of verify token
| X || Double ||  
 
 
|-
 
|-
| Z || Double ||
+
| Verify Token || Byte array ||  
 +
|-
 +
|}
 +
 
 +
See [[Protocol Encryption]] for details.
 +
 
 +
==== Login Success ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=8 | 3 (INITIALIZE)
+
| rowspan=2 | 0x02 || rowspan=2 | Login || rowspan=2 | Client
| X || Double ||
+
| UUID || String ||
 
|-
 
|-
| Z || Double ||
+
| Username || String ||
 +
|}
 +
 
 +
==== Set Compression ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| Old radius || Double ||
+
| rowspan=1 | 0x03 || rowspan=1 | Login || rowspan=1 | Client
|-
+
| Threshold || VarInt || Threshold is the max size of a packet before its compressed
| New radius || Double ||
 
|-
 
| Speed || VarLong ||
 
|-
 
| Portal Teleport Boundary || VarInt || Resulting coordinates from a portal teleport are limited to +-value. Usually 29999984.
 
|-
 
| Warning time || VarInt ||
 
|-
 
| Warning blocks || VarInt ||
 
|-
 
| rowspan=1 | 4 (SET_WARNING_TIME)
 
| Warning time || VarInt ||
 
|-
 
| rowspan=1 | 5 (SET_WARNING_BLOCKS)
 
| Warning blocks || VarInt ||
 
 
|}
 
|}
  
=== Title ===  
+
=== Serverbound ===
  
 +
==== Login Start  ====
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
+
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
| rowspan=9 | 0x45 || rowspan=9 | Play || rowspan=9 | Server to Client
+
| rowspan=1 | 0x00 || rowspan=1 | Login || rowspan=1 | Server
| colspan=2 | Action || VarInt ||
+
| Name || String ||  
 +
|}
 +
 
 +
==== Encryption Response ====
 +
{| class="wikitable"
 +
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
|-
! Action !! Name !! !!
+
| rowspan=4 | 0x01 || rowspan=4 | Login || rowspan=4 | Server
 +
| Length || VarInt || length of shared secret
 
|-
 
|-
| 0 (TITLE) || Text || [[Chat]] ||
+
| Shared Secret || Byte array ||  
 
|-
 
|-
| 1 (SUBTITLE) || Text || [[Chat]] ||
+
| Length || VarInt || length of verify token
 
|-
 
|-
| rowspan=3 | 2 (TIMES)
+
| Verify Token || Byte array ||
| Fade In || Int ||
+
|-  
|-
 
| Stay || Int ||
 
|-
 
| Fade Out || Int ||
 
|-
 
| 3 (CLEAR) || || ||
 
|-
 
| 4 (RESET) || || ||
 
|}
 
 
 
=== Set Compression ===
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x46 || rowspan=1 | Play || rowspan=1 | Server to Client
 
| Threshold || VarInt || Threshold is the max size of a packet before its compressed
 
|}
 
 
 
=== Player List Header/Footer ===
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x47 || rowspan=2 | Play || rowspan=2 | Server to Client
 
| Header || [[Chat]] ||
 
|-
 
| Footer || [[Chat]] ||
 
|}
 
 
 
=== Resource Pack Send ===
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x48 || rowspan=2 | Play || rowspan=2 | Server to Client
 
| URL || String || The URL to the resource pack.
 
|-
 
| Hash || String || A 40 character hexadecimal and lower-case SHA-1 hash of the resource pack file. (must be lower case in order to work)<br>
 
If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth - but it will still treat it as a unique id
 
|}
 
 
 
=== Update Entity NBT ===
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x49 || rowspan=2 | Play || rowspan=2 | Server to Client
 
| Entity ID || VarInt ||
 
|-
 
| Tag || NBT Tag ||
 
 
|}
 
|}
  
 +
See [[Protocol Encryption]] for details.
  
 
== See Also ==
 
== See Also ==

Revision as of 15:42, 31 December 2014

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 shown in the debug screen (F3). Y points upwards, X points East, and Z points South.
See also: Units of Measurement

Packets

Protocol Version

See the Protocol version numbers for details and links to previous versions' documentation.

1.7.2 - 4

1.7.6 - 5

1.8 - 47

Packet format

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

Post compression

Once a Set Compression packet is sent, zlib compression is enabled for all following packets. The format of a packet changes slighty to include the size of the uncompressed packet.

Name Type Notes
Packet Length VarInt Length of Data + length of Data Length
Data Length VarInt Length of uncompressed Data or 0
Data zlib compressed packet, including Packet ID

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 data's length must be equal to or over the threshold set in the Set Compression packet, otherwise the client/server will disconnect.

Compression can be disabled by sending a threshold of -1.

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 VarInt

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
Reduced Debug Info Boolean

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

Chat Message

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

Packet ID Category Bound To Field Name Field Type Notes
0x02 Play Client JSON Data String Chat , Limited to 32767 bytes
Position Byte 0 - Chat (chat box) ,1 - System Message (chat box), 2 - Above action bar

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 VarInt 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 Location Position Spawn location

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 VarInt 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)

About the flags field:

 <Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
Packet ID Category Bound To Field Name Field Type Notes
0x08 Play Client X Double Absolute/Relative position
Y Double Absolute/Relative position
Z Double Absolute/Relative position
Yaw Float Absolute/Relative rotation on the X Axis, in degrees
Pitch Float Absolute/Relative rotation on the Y Axis, in degrees
Flags Byte
X 0x01
Y 0x02
Z 0x04
Y_ROT 0x08
X_ROT 0x10

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 VarInt Player ID
Location Position Block location of the head part of the bed

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 :)

In an example UUID, xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx, the UUID version is specified by Y. So, for UUID v3, Y will always be 3, and for UUID v2, Y will always be 2.

Packet ID Category Bound To Field Name Field Type Notes
0x0C Play Client Entity ID VarInt Player's Entity ID
Player UUID UUID Player's UUID
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

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 VarInt
Collector Entity ID VarInt

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
Location Position Center coordinates
Direction Unsigned Byte 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 VarInt 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 VarInt Length of following array
Entity IDs Array of VarInt 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 VarInt 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 VarInt 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
On Ground Boolean

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 VarInt 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
On Ground Boolean

Entity Look and Relative Move

This packet is sent by the server when an entity rotates and moves. Since a byte range is limited from -128 to 127, and movement is offset of fixed-point numbers, this packet allows at most four blocks movement in any direction. (-128/32 == -4)

Packet ID Category Bound To Field Name Field Type Notes
0x17 Play Client Entity ID VarInt 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
On Ground Boolean

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 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
Yaw Byte The X Axis rotation as a fraction of 360
Pitch Byte The Y Axis rotation as a fraction of 360
On Ground Boolean

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 VarInt 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 VarInt Entity's ID
Metadata Metadata

Entity Effect

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

Remove Entity Effect

Packet ID Category Bound To Field Name Field Type Notes
0x1E Play Client Entity ID VarInt 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 VarInt
Total Experience VarInt

Entity Properties

Packet ID Category Bound To Field Name Field Type Notes
0x20 Play Client Entity ID VarInt 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 VarInt 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

Changes in 1.8:

  • Data value section removed
  • Extended id section removed
  • Block id section is now a unsigned short (little endian) per a block
  • The block id is equal to (id << 4) | data
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.
Size VarInt Size of chunk data
Data Byte array The chunk data is not compressed as of 14w28a

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 VarInt The number of blocks affected
Records Array of Records

Record

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

Block Change

Packet ID Category Bound To Field Name Field Type Notes
0x23 Play Client Location Position Block Coordinates
Block ID VarInt The new block ID for the block. id << 4 | data

Block Action

This packet is used for a number of things:

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

See Also: Block Actions

Packet ID Category Bound To Field Name Field Type Notes
0x24 Play Client 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 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 etc. it won't show the actual break animation but some other interesting effects. (Water will lose it's transparency)

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

Map Chunk Bulk

See also: SMP Map Format

1.8 changes at #Chunk_Data

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 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
Chunk column count VarInt The number of chunk in this packet
Meta information Meta See below
Data Byte Array Chunk data. Uncompressed as of 14w28a

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

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 effect 1013 (mob.wither.spawn), 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.
Location Position The 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.

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 Id Int
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
Number of particles Int The number of particles to create
Data Array of VarInt Length depends on particle. ICON_CRACK, BLOCK_CRACK, and BLOCK_DUST have lengths of 2, the rest have 0.

Particle Ids

Particle Name Particle Id
explode 0
largeexplosion 1
hugeexplosion 2
fireworksSpark 3
bubble 4
wake 5
splash 6
suspended 7
townaura 8
crit 9
magicCrit 10
smoke 11
largesmoke 12
mobSpell? 13
instantSpell 14
spell 15
witchMagic 17
dripWater 18
dripLava 19
angryVillager 20
happyVillager 21
depthsuspend 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

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, 3 - Spectator
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 String The window type to use for display. Check below
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 Int EntityHorse's entityId. Only sent when window type is equal to "EntityHorse".

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 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 Location Position Block Coordinates
Line 1 Chat First line of text in the sign
Line 2 Chat Second line of text in the sign
Line 3 Chat Third line of text in the sign
Line 4 Chat Fourth line of text in the sign

Maps

Packet ID Category Bound To Field Name Field Type Notes
0x34 Play Client Item Damage VarInt The damage value of the map being modified
Scale Byte
Length VarInt
Icons 3 * length bytes First byte, 0xF0 = Direction, 0x0F = Type. Second byte, X. Third byte, Y
Columns Byte
Rows Byte Only if Columns is more than 0
X Byte Only if Columns is more than 0
Y Byte Only if Columns is more than 0
Length VarInt Only if Columns is more than 0
Data Length bytes Only if Columns is more than 0

Update Block Entity

Essentially a block update on a block entity.

Packet ID Category Bound To Field Name Field Type Notes
0x35 Play Client Location Position
Action Unsigned Byte The type of update to perform
NBT Data Byte Array If not present then its TAG_END (0)

Actions

  • 1: Set SpawnPotentials of a mob spawner
  • 2: Set command block text (command and last execution status)
  • 3: Set the level, primary, and secondary powers of a beacon
  • 4: Set rotation and skin of mob head
  • 5: Set type of flower in flower pot
  • 6: Set base color and patterns on a banner

Sign Editor Open

Sent on placement of sign.

Packet ID Category Bound To Field Name Field Type Notes
0x36 Play Client Location Position 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 Action VarInt
Length VarInt The following fields are repeated length times
UUID UUID The uuid of the player
Action
0 (ADD_PLAYER) Name String
Number of properties VarInt
Properties Name String
Value String
Is Signed Boolean
Signature String Only if Is Signed is true
Gamemode VarInt
Ping VarInt
Has Display Name Boolean
Display Name Chat Only send if Has Diplay Name is true
1 (UPDATE_GAMEMODE) Gamemode VarInt
2 (UPDATE_LATENCY) Ping VarInt
3 (UPDATE_DISPLAY_NAME) Has Display Name Boolean
Display Name Chat Only send if Has Diplay Name is true
4 (REMOVE_PLAYER)

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
Mode Byte 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
Objective value String Only if mode is 0 or 2. The text to be displayed for the score.
Type String Only if mode is 0 or 2. "integer" or "hearts"

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 Score name String The name of the score to be updated or removed.
Update/Remove 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 VarInt The score to be displayed next to the entry. Only sent when Update/Remove 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
Name Tag Visibility String Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never.
Color Byte Only if Mode = 0 or 2. Same as Chat colors.
Player count VarInt 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. Max 40 characters so may be uuid's later

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

Server Difficulty

Changes the difficulty setting in the client's option menu

Packet ID Category Bound To Field Name Field Type Notes
0x41 Play Client Difficulty Unsigned Byte 0:PEACEFUL, 1:EASY, 2:NORMAL, 3: HARD


Combat Event

Packet ID Category Bound To Field Name Field Type Notes
0x42 Play Client Event VarInt 0 ENTER_COMBAT, 1 END_COMBAT, 2 ENTITY_DEAD
Duration VarInt Only for END_COMBAT
Entity ID Int Only for END_COMBAT
Player ID VarInt Only for ENTITY_DEAD
Entity ID Int Only for ENTITY_DEAD
Message String Only for ENTITY_DEAD

Camera

Packet ID Category Bound To Field Name Field Type Notes
0x43 Play Client Camera ID VarInt

World Border

Packet ID Category Bound To Field Name Field Type Notes
0x44 Play Client Action VarInt
Action Name
0 (SET_SIZE) Radius Double
1 (LERP_SIZE) Old radius Double
New radius Double
Speed VarLong
2 (SET_CENTER) X Double
Z Double
3 (INITIALIZE) X Double
Z Double
Old radius Double
New radius Double
Speed VarLong
Portal Teleport Boundary VarInt Resulting coordinates from a portal teleport are limited to +-value. Usually 29999984.
Warning time VarInt
Warning blocks VarInt
4 (SET_WARNING_TIME) Warning time VarInt
5 (SET_WARNING_BLOCKS) Warning blocks VarInt

Title

Packet ID Category Bound To Field Name Field Type Notes
0x45 Play Client Action VarInt
Action Name
0 (TITLE) Text Chat
1 (SUBTITLE) Text Chat
2 (TIMES) Fade In Int
Stay Int
Fade Out Int
3 (CLEAR)
4 (RESET)

Set Compression

Packet ID Category Bound To Field Name Field Type Notes
0x46 Play Client Threshold VarInt Threshold is the max size of a packet before its compressed

Player List Header/Footer

Packet ID Category Bound To Field Name Field Type Notes
0x47 Play Client Header Chat
Footer Chat

Resource Pack Send

Packet ID Category Bound To Field Name Field Type Notes
0x48 Play Client URL String The URL to the resource pack.
Hash String A 40 character hexadecimal and lower-case SHA-1 hash of the resource pack file. (must be lower case in order to work)

If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth - but it will still treat it as a unique id

Update Entity NBT

Packet ID Category Bound To Field Name Field Type Notes
0x49 Play Client Entity ID VarInt
Tag NBT Tag

Serverbound

Keep Alive

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

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

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 VarInt
Type VarInt 0 = INTERACT, 1 = ATTACK, 2 = INTERACT_AT
Target X Float Only if Type == INTERACT_AT
Target Y Float Only if Type == INTERACT_AT
Target Z Float Only if Type == INTERACT_AT

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…
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…
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)
Location Position 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 Location Position 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, pulling back 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 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 VarInt Player ID
Action ID VarInt The ID of the action, see below.
Jump Boost VarInt Horse jump boost. Ranged from 0 -> 100.

Action ID can be one of the following values:

ID Action
0 Crouch
1 Uncrouch
2 Leave bed
3 Start sprinting
4 Stop sprinting
5 Jump with horse
6 Open inventory

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
Flags Unsigned Byte 0x1 Jump, 0x2 Unmount

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 Location Position Block Coordinates
Line 1 Chat First line of text in the sign
Line 2 Chat Second line of text in the sign
Line 3 Chat Third line of text in the sign
Line 4 Chat 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
Has Position Boolean
Looked at block Position The position of the block being looked at. Only sent if the previous field is true

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
Displayed skin parts Unsigned Byte Skin parts. See note below

Chat flags has several values packed into one byte.

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

Displayed skin parts also packs several values into one byte.

Bit 0: Cape enabled

Bit 1: Jacket enabled

Bit 2: Left Sleeve enabled

Bit 3: Right Sleeve enabled

Bit 4: Left Pants Leg enabled

Bit 5: Right Pants Leg enabled

Bit 6: Hat enabled

The most significant bit (bit 7) appears to be unused.

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 VarInt 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/

Note that the data length is known from the packet length, so there is no need for a length member being sent.

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

Spectate

Packet ID Category Bound To Field Name Field Type Notes
0x18 Play Server Target Player UUID

Resource Pack Status

Packet ID Category Bound To Field Name Field Type Notes
0x19 Play Server Hash String The hash sent in the Resource Pack Send packet.
Result VarInt Successfully loaded: 0, Declined: 1, Failed download: 2, Accepted: 3

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 VarInt length of public key
Public Key Byte array
Length VarInt 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

Set Compression

Packet ID Category Bound To Field Name Field Type Notes
0x03 Login Client Threshold VarInt Threshold is the max size of a packet before its compressed

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 VarInt length of shared secret
Shared Secret Byte array
Length VarInt length of verify token
Verify Token Byte array

See Protocol Encryption for details.

See Also