Difference between revisions of "Protocol"

From wiki.vg
Jump to navigation Jump to search
(removed the See Also section — Data Types is transcluded and the other two are linked in the article proper)
(packets overhaul including some cleanup and clarification, and slightly more consistent table format. Also renamed Category to State)
Line 80: Line 80:
 
  |-
 
  |-
 
  | Data
 
  | Data
  |  
+
  | Byte Array
  | Depends on the packet category and ID, see the sections below
+
  | Depends on the connection state and packet ID, see the sections below
 
  |}
 
  |}
  
Line 102: Line 102:
 
  |-
 
  |-
 
  | Data
 
  | Data
  |  
+
  | Byte Array
  | zlib compressed packet, including Packet ID (see the sections below)
+
  | zlib compressed packet, including packet ID (see the sections below)
 
  |}
 
  |}
  
Line 124: Line 124:
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
  ! Category
+
  ! State
 
  ! Bound To
 
  ! Bound To
 
  ! Field Name
 
  ! Field Name
Line 137: Line 137:
 
  | See [[protocol version numbers]] (currently 47)
 
  | See [[protocol version numbers]] (currently 47)
 
  |-
 
  |-
  | Server Address (hostname or IP)
+
  | Server Address
 
  | String
 
  | String
  | e.g. localhost or 127.0.0.1<!-- does this support IPv6? -->
+
  | hostname or IP, e.g. localhost or 127.0.0.1<!-- does this support IPv6? -->
 
  |-  
 
  |-  
 
  | Server Port
 
  | Server Port
Line 159: Line 159:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Client
+
! Bound To
| Keep Alive ID || VarInt ||
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x00
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Keep Alive ID
 +
| VarInt
 +
|  
 +
|}
  
 
==== Join Game ====
 
==== Join Game ====
 +
 
See [[Protocol Encryption]] for information on logging in.
 
See [[Protocol Encryption]] for information on logging in.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=7 | 0x01 || rowspan=7 | Play || rowspan=7 | Client
+
! Bound To
| Entity ID || Int || The player's Entity ID
+
! Field Name
|-
+
! Field Type
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. Bit 3 (0x8) is the hardcore flag
+
! Notes
|-
+
|-
| Dimension || Byte || -1: nether, 0: overworld, 1: end
+
|rowspan="7"| 0x01
|-
+
|rowspan="7"| Play
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard
+
|rowspan="7"| Client
|-
+
| Entity ID
| Max Players || Unsigned Byte || Used by the client to draw the player list
+
| Int
|-
+
| The player's Entity ID (EID)
| Level Type || String || default, flat, largeBiomes, amplified, default_1_1
+
|-
|-
+
| Gamemode
| Reduced Debug Info || Boolean ||
+
| Unsigned Byte
|}
+
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
{{Warning|If the Dimension isn't valid then the client will crash}}
+
|-
 
+
| Dimension
==== Chat Message ====
+
| Byte
 
+
| -1: Nether, 0: Overworld, 1: End
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
+
|-
   
+
| Difficulty
{| class="wikitable"
+
| Unsigned Byte
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
| 0: peaceful, 1: easy, 2: normal, 3: hard
|-
+
|-
| rowspan=2 | 0x02 || rowspan=2 | Play || rowspan=2 | Client
+
| Max Players
| JSON Data || String || [[Chat]] , Limited to 32767 bytes
+
| Unsigned Byte
|-
+
| Used by the client to draw the player list
| Position || Byte || 0 - Chat (chat box) ,1 - System Message (chat box), 2 - Above action bar
+
|-
|}
+
| Level Type
{{Warning|Malformed JSON will disconnect the client}}
+
| String
 
+
| default, flat, largeBiomes, amplified, default_1_1
==== Time Update ====
+
|-
 +
| Reduced Debug Info
 +
| Boolean
 +
|  
 +
  |}
  
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.
+
{{Warning|If the Dimension isn't valid then the client will crash}}
  
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
+
==== Chat Message ====
  
The default SMP server increments the time by <code>20</code> every second.
+
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
|-
+
! State
| rowspan=2 | 0x03 || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Age of the world || Long || In ticks; not changed by server commands
+
! Field Name
|-
+
! Field Type
| 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
+
! Notes
|}
+
|-
 +
|rowspan="2"| 0x02
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| JSON Data
 +
| [[Chat]]
 +
| Limited to 32767 bytes
 +
|-
 +
| Position
 +
| Byte
 +
| 0: chat (chat box), 1: system message (chat box), 2: above action bar
 +
|}
  
==== Entity Equipment ====
+
{{Warning|Malformed JSON will disconnect the client}}
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=3 | 0x04 || rowspan=3 | Play || rowspan=3 | 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_Data|Slot]] || Item in slot format
 
|}
 
  
==== Spawn Position ====
+
==== Time Update ====
  
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.
+
Time is based on ticks, where 20 ticks happen every second. There are 24000 ticks in a day, making Minecraft days exactly 20 minutes long.
  
{| class="wikitable"
+
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x05 || rowspan=1 | Play || rowspan=1 | Client
 
| Location || Position || Spawn location
 
|}
 
  
==== Update Health ====
+
The default SMP server increments the time by <code>20</code> every second.
 
 
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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x06 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Health || Float || 0 or less = dead, 20 = full HP
+
! Field Name
|-
+
! Field Type
| Food || VarInt || 0 - 20
+
! Notes
|-
+
|-
| Food Saturation || Float || Seems to vary from 0.0 to 5.0 in integer increments
+
|rowspan="2"| 0x03
|}
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| World Age
 +
| Long
 +
| In ticks; not changed by server commands
 +
|-
 +
| Time of day
 +
| Long
 +
| The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
 +
|}
  
==== Respawn ====
+
==== Entity Equipment ====
 
 
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
|-
+
! State
| rowspan=4 | 0x07 || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| Dimension || Int || -1: The Nether, 0: The Overworld, 1: The End
+
! Field Name
|-
+
! Field Type
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard.
+
! Notes
|-
+
|-
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
+
|rowspan="3"| 0x04
|-
+
|rowspan="3"| Play
| Level Type || String || Same as [[Protocol#Join_Game|Join Game]]
+
|rowspan="3"| Client
|}
+
| Entity ID
{{Warning|If the Dimension isn't valid then the client will crash}}
+
| VarInt
 
+
| Entity's EID
{{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)}}
+
|-
 +
| Slot
 +
| Short
 +
| Equipment slot. 0: held, 1–4: armor slot (1: boots, 2: leggings, 3: chestplate, 4: helmet)
 +
|-
 +
| Item
 +
| [[Slot Data|Slot]]
 +
| Item in slot format
 +
|}
  
==== Player Position And Look ====  
+
==== Spawn Position ====
  
Updates the players position on the server.
+
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.
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.
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x05
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Location
 +
| Position
 +
| Spawn location
 +
|}
  
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
+
==== Update Health ====
  
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
+
Sent by the server to update/set the health of the player it is sent to.
  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:
+
Food {{Minecraft Wiki|Food#Hunger vs. Saturation|saturation}} acts as a food “overcharge”. Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
  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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=6| 0x08 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| X || Double || Absolute/Relative position
+
! Field Name
|-
+
! Field Type
| Y || Double || Absolute/Relative position
+
! Notes
|-
+
|-
| Z || Double || Absolute/Relative position
+
|rowspan="3"| 0x06
|-
+
|rowspan="3"| Play
| Yaw || Float || Absolute/Relative rotation on the X Axis, in degrees
+
|rowspan="3"| Client
|-
+
| Health
| Pitch || Float || Absolute/Relative rotation on the Y Axis, in degrees
+
| Float
|-
+
| 0 or less = dead, 20 = full HP
| Flags || Byte ||
+
|-
{| class="wikitable"
+
| Food
| X || 0x01
+
| VarInt
|-
+
| 0–20
| Y || 0x02
+
|-  
|-
+
| Food Saturation
| Z || 0x04
+
| Float
|-
+
| Seems to vary from 0.0 to 5.0 in integer increments
| Y_ROT || 0x08
+
|}
|-
 
| X_ROT || 0x10
 
|}
 
|}
 
  
==== Held Item Change ====
+
==== Respawn ====
  
Sent to change the player's slot selection
+
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
|-
+
! State
| rowspan=1 | 0x09 || rowspan=1 | Play || rowspan=1 | Client
+
! Bound To
| Slot || Byte || The slot which the player has selected (0-8)
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="4"| 0x07
 +
|rowspan="4"| Play
 +
|rowspan="4"| Client
 +
| Dimension
 +
| Int
 +
| -1: The Nether, 0: The Overworld, 1: The End
 +
|-
 +
| Difficulty
 +
| Unsigned Byte
 +
| 0: Peaceful, 1: Easy, 2: Normal, 3: Hard
 +
|-
 +
| Gamemode
 +
| Unsigned Byte
 +
| 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
 +
|-
 +
| Level Type
 +
| String
 +
| Same as [[#Join Game|Join Game]]
 +
|}
  
==== Use Bed ====
+
{{Warning|If the Dimension isn't valid then the client will crash}}
  
This packet tells that a player goes to bed.
+
{{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)}}
  
The client with the matching  Entity ID will go into bed mode.
+
==== Player Position And Look ====
  
This Packet is sent to all nearby players including the one sent to bed.
+
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
 
|-
 
| rowspan=2 | 0x0A || rowspan=2 | Play || rowspan=2 | 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.
+
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for “Illegal position”
  
{| class="wikitable"
+
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
! Packet ID !! 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
 
|}
 
  
Animation can be one of the following values:
+
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
  
{| class="wikitable"
+
The yaw of player (in degrees), standing at point (x0, z0) and looking towards point (x, z) one can be calculated with:
! 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 ====
+
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
  
This packet is sent by the server when a player comes into visible range, '''not''' when a player joins.
+
You can get a unit vector from a given yaw/pitch via:
 
 
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:
+
x = -cos(pitch) * sin(yaw)
  <+Grum> i will never confirm this as a feature you know that :)
+
y = -sin(pitch)
 
+
z =  cos(pitch) * cos(yaw)
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
+
! Packet ID
|-
+
! State
| rowspan=9 | 0x0C || rowspan=9 | Play || rowspan=9 | Client
+
! Bound To
| colspan=2 | Entity ID || VarInt || Player's Entity ID
+
! Field Name
|-
+
! Field Type
| colspan=2 | Player UUID || UUID || Player's UUID
+
! Notes
|-
+
|-
| colspan=2 | X || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="6"| 0x08
|-
+
|rowspan="6"| Play
| colspan=2 | Y || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="6"| Client
|-
+
| X
| colspan=2 | Z || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Double
|-
+
| Absolute or relative position, depending on Flags
| colspan=2 | Yaw || Byte || Player rotation as a packed byte
+
|-
|-
+
| Y
| colspan=2 | Pitch || Byte || Player rotation as a packet byte
+
| Double
|-
+
| Absolute or relative position, depending on Flags
| 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.
+
|-
|-
+
| Z
| colspan=2 | Metadata || [[Entities#Entity_Metadata_Format|Metadata]] || The client will crash if no metadata is sent
+
| Double
|}
+
| Absolute or relative position, depending on Flags
{{Warning|The client will crash if no metadata is sent}}
+
|-
 
+
| Yaw
==== Collect Item ====
+
| Float
 
+
| Absolute or relative rotation on the X Axis, in degrees
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.
+
|-
 +
| Pitch
 +
| Float
 +
| Absolute or relative rotation on the Y Axis, in degrees
 +
|-
 +
| Flags
 +
| Byte
 +
| Bit field, see below
 +
|}
  
{| class="wikitable"
+
About the Flags field:
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x0D || rowspan=2 | Play || rowspan=2 | Client
 
| Collected Entity ID || VarInt ||
 
|-
 
| Collector Entity ID || VarInt ||
 
|}
 
  
==== Spawn Object ====
+
<Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.
 
 
Sent by the server when an Object/Vehicle is created.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|-
|-
+
! Field
| rowspan=8| 0x0E || rowspan=8 | Play || rowspan=8 | Client
+
! Bit
| Entity ID || VarInt || Entity ID of the object
+
|-
|-
+
| X
| Type || Byte || The type of object (See [[Entities#Objects|Objects]])
+
| 0x01
|-
+
|-
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Y
|-
+
| 0x02
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|-
|-
+
| Z
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| 0x04
|-
+
|-
| Pitch || Byte || The pitch in steps of 2p/256
+
| Y_ROT
|-
+
| 0x08
| Yaw || Byte || The yaw in steps of 2p/256
+
|-
|-
+
| X_ROT
| Data || [[Object_Data|Object Data]] ||
+
| 0x10
|}
+
|}
  
==== Spawn Mob ====
+
==== Held Item Change ====
  
Sent by the server when a Mob Entity is Spawned
+
Sent to change the player's slot selection.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=12 | 0x0F || rowspan=12 | Play || rowspan=12 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| Type || Unsigned Byte || The type of mob. See [[Entities#Mobs|Mobs]]
+
! Notes
|-
+
|-
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="1"| 0x09
|-
+
|rowspan="1"| Play
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="1"| Client
|-
+
| Slot
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Byte
|-
+
| The slot which the player has selected (0–8)
| 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]] ||
 
|}
 
 
 
==== Spawn Painting ====
 
  
This packet shows location, name, and type of painting.
+
==== Use Bed ====
  
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.
+
This packet tells that a player goes to bed.
  
2x1 (1, 0)
+
The client with the matching Entity ID will go into bed mode.
4x4 (1, 2)
 
  
 +
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
|-
+
! State
| rowspan=4 | 0x10 || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| Title || String || Name of the painting. Max length 13
+
! Notes
|-
+
|-
| Location || Position || Center coordinates
+
|rowspan="2"| 0x0A
|-
+
|rowspan="2"| Play
| Direction || Unsigned Byte || Direction the painting faces (0 -z, 1 -x, 2 +z, 3 +x)
+
|rowspan="2"| Client
|}
+
| Entity ID
 +
| VarInt
 +
| Sleeping player's EID
 +
|-
 +
| Location
 +
| Position
 +
| Block location of the head part of the bed
 +
|}
  
==== Spawn Experience Orb ====
+
==== Animation ====
  
Spawns one or more experience orbs.
+
Sent whenever an entity should change animation.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=5 | 0x11 || rowspan=5 | Play || rowspan=5 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
! Notes
|-
+
|-
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="2"| 0x0B
|-
+
|rowspan="2"| Play
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="2"| Client
|-
+
| Entity ID
| Count || Short || The amount of experience this orb will reward once collected
+
| VarInt
|}
+
| Player ID
 
+
|-
==== Entity Velocity ====
+
| Animation
 +
| Unsigned Byte
 +
| Animation ID (see below)
 +
|}
  
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms);
+
Animation can be one of the following values:
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
+
! ID
|-
+
! Animation
| rowspan=4 | 0x12 || rowspan=4 | Play || rowspan=4 | Client
+
|-
| Entity ID || VarInt || Entity's ID
+
| 0
|-
+
| Swing arm
| Velocity X || Short || Velocity on the X axis
+
|-
|-
+
| 1
| Velocity Y || Short || Velocity on the Y axis
+
| Take damage
|-
+
|-
| Velocity Z || Short || Velocity on the Z axis
+
| 2
|}
+
| Leave bed
 +
|-
 +
| 3
 +
| Eat food
 +
|-
 +
| 4
 +
| Critical effect
 +
|-
 +
| 5
 +
| Magic critical effect
 +
|-
 +
| 102
 +
| ''unknown''
 +
|-
 +
| 104
 +
| Crouch
 +
|-
 +
| 105
 +
| Uncrouch
 +
|}
  
==== Destroy Entities ====
+
==== Spawn Player ====
  
Sent by the server when an list of Entities is to be destroyed on the client.
+
This packet is sent by the server when a player comes into visible range, ''not'' when a player joins.
  
{| class="wikitable"
+
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x13 || rowspan=2 | Play || rowspan=2 | Client
 
| Count || VarInt || Length of following array
 
|-
 
| Entity IDs || Array of VarInt || The list of entities of destroy
 
|}
 
  
==== Entity ====
+
When in online-mode the UUIDs must be valid and have valid skin blobs, in offline-mode UUID v3 is used.
  
Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.
+
For NPCs UUID v2 should be used. Note:
  
For player entities, either this packet or any move/look packet is sent every game tick.
+
<+Grum> i will never confirm this as a feature you know that :)
So the meaning of this packet is basically that the entity did not move/look since the last such packet.
+
 
 +
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 !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x14 || rowspan=1 | Play || rowspan=1 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="9"| 0x0C
 +
|rowspan="9"| Play
 +
|rowspan="9"| Client
 +
| Entity ID
 +
| VarInt
 +
| Player's EID
 +
|-
 +
| Player UUID
 +
| UUID
 +
|
 +
|-
 +
| X
 +
| Int
 +
| Player X as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 +
|-
 +
| Y
 +
| Int
 +
| Player Y as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 +
|-
 +
| Z
 +
| Int
 +
| Player Z as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 +
|-
 +
| Yaw
 +
| Angle
 +
|
 +
|-
 +
| Pitch
 +
| Angle
 +
|
 +
|-
 +
| 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.
 +
|-
 +
| Metadata
 +
| [[Entities#Entity Metadata Format|Metadata]]
 +
|
 +
|}
  
==== Entity Relative Move ====
+
{{Warning|A negative Current Item crashes clients}}
  
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.
+
{{Warning|The client will crash if no Metadata is sent}}
  
This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.
+
==== Collect Item ====
  
{| class="wikitable"
+
Sent by the server when someone picks up an item lying on the ground — its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each [[#Player Position|Player Position]] (and [[#Player Position And Look|Player Position And Look]]) packet sent by the client.
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=5| 0x15 || rowspan=5 | Play || rowspan=5 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=5 | 0x16 || rowspan=5 | Play || rowspan=5 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| Yaw || Byte || The X Axis rotation as a fraction of 360
+
! Notes
|-
+
|-
| Pitch || Byte || The Y Axis rotation as a fraction of 360
+
|rowspan="2"| 0x0D
|-
+
|rowspan="2"| Play
| On Ground || Boolean ||  
+
|rowspan="2"| Client
|}
+
| Collected Entity ID
 +
| VarInt
 +
|  
 +
|-  
 +
| Collector Entity ID
 +
| VarInt
 +
|  
 +
|}
  
==== Entity Look and Relative Move ====
+
==== Spawn Object ====
  
This packet is sent by the server when an entity rotates and moves.
+
Sent by the server when an Object/Vehicle is created.
Since a byte range is limited from -128 to 127, and movement is offset of fixed-point numbers,
 
this packet allows at most four blocks movement in any direction. (-128/32 == -4)
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=7 | 0x17 || rowspan=7 | Play || rowspan=7 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| DX || Byte || Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
! Notes
|-
+
|-
| DY || Byte || Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="8"| 0x0E
|-
+
|rowspan="8"| Play
| DZ || Byte || Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|rowspan="8"| Client
|-
+
| Entity ID  
| Yaw || Byte || The X Axis rotation as a fraction of 360
+
| VarInt
|-
+
| EID of the object
| Pitch || Byte || The Y Axis rotation as a fraction of 360
+
|-
|-
+
| Type
| On Ground || Boolean ||
+
| Byte
|}
+
| The type of object (See [[Entities#Objects|Objects]])
 
+
|-
==== Entity Teleport ====
+
| X
 
+
| Int
This packet is sent by the server when an entity moves more than 4 blocks.
+
| X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
+
|-
{| class="wikitable"
+
| Y
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
| Int
|-
+
| Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
| rowspan=7 | 0x18 || rowspan=7 | Play || rowspan=7 | Client
+
|-
| Entity ID || VarInt || Entity's ID
+
| Z
|-
+
| Int
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
| Z 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]]
+
| Pitch
|-
+
| Angle
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
+
|  
|-
+
|-
| Yaw || Byte || The X Axis rotation as a fraction of 360
+
| Yaw
|-
+
| Angle
| Pitch || Byte || The Y Axis rotation as a fraction of 360
+
|  
|-
+
|-
| On Ground || Boolean ||
+
| Data
|}
+
| [[Object Data]]
 +
|  
 +
|}
  
==== Entity Head Look ====
+
==== Spawn Mob ====
  
Changes the direction an entity's head is facing.
+
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
|-
+
  ! State
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Client
+
  ! Bound To
| Entity ID || VarInt || Entity's ID
+
  ! Field Name
|-
 
| Head Yaw || Byte || Head yaw in steps of 2p/256
 
|}
 
 
 
==== Entity Status ====
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x1A || rowspan=2 | Play || rowspan=2 | Client
 
| Entity ID || Int || Entity's ID
 
|-
 
| Entity Status || Byte || See below
 
|}
 
 
 
{| class="wikitable"
 
|-
 
! 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
 
|-
 
| 10 || Play tnt minecraft ignite sound.
 
|-
 
| 11 || Iron Golem handing over a rose
 
|-
 
| 12 || Villager mating - Spawn "heart" particles
 
|-
 
| 13 || Spawn particles indicating that a villager is angry and seeking revenge
 
|-
 
| 14 || Spawn happy particles near a villager
 
|-
 
| 15 || Witch animation - Spawn "magic" particles
 
|-
 
| 16 || Play zombie converting into a villager sound.
 
|-
 
| 17 || Firework exploding
 
|-
 
| 18 || Animal in love (ready to mate) - Spawn "heart" particles
 
|-
 
| 19 || Reset squid rotation.
 
|-
 
| 20 || Spawn explosion particle. - Works for some living entities.
 
|-
 
| 21 || Play guardian sound. - Works for every entity.
 
|-
 
| 22 || Enables reduced debug for players.
 
|-
 
| 23 || Disables reduced debug for players.
 
|}
 
 
 
==== Attach Entity ====
 
 
 
This packet is sent when a player has been attached to an entity (e.g. Minecart)
 
 
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Category
 
  ! Bound To
 
  ! Field Name
 
 
  ! Field Type
 
  ! Field Type
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="3"| 0x1B
+
  |rowspan="12"| 0x0F
  |rowspan="3"| Play
+
  |rowspan="12"| Play
  |rowspan="3"| Client
+
  |rowspan="12"| Client
 
  | Entity ID
 
  | Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| 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
 
  | Int
  | Entity's ID
+
  | Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
  |-
 
  |-
  | Vehicle ID
+
  | Z
 
  | Int
 
  | Int
  | Vechicle's Entity ID
+
  | Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
  |-
 
  |-
  | Leash
+
  | Yaw
  | Boolean
+
  | Angle
  | If true leashes the entity to the vehicle
+
|
 +
|-
 +
| Pitch
 +
| Angle
 +
|
 +
|-
 +
| Head Pitch
 +
| Angle
 +
|
 +
|-
 +
| Velocity X
 +
| Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 +
|-
 +
| Velocity Y
 +
| Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 +
|-
 +
| Velocity Z
 +
| Short
 +
| Same units as [[#Entity Velocity|Entity Velocity]]
 +
|-
 +
| Metadata
 +
| [[Entities#Entity Metadata Format|Metadata]]
 +
  |  
 
  |}
 
  |}
  
==== Entity Metadata ====
+
==== Spawn Painting ====
{| class="wikitable"
+
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
This packet shows location, name, and type of painting.
|-
+
 
| rowspan=2 | 0x1C || rowspan=2 | Play || rowspan=2 | Client
+
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.
| Entity ID || VarInt || Entity's ID
 
|-
 
| Metadata || [[Entities#Entity_Metadata_Format|Metadata]] ||
 
|}
 
  
==== Entity Effect ====
+
2x1 (1, 0)
 +
4x4 (1, 2)
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! Packet ID
 
  ! Packet ID
  ! Category
+
  ! State
 
  ! Bound To
 
  ! Bound To
 
  ! Field Name
 
  ! Field Name
Line 806: Line 802:
 
  ! Notes
 
  ! Notes
 
  |-
 
  |-
  |rowspan="5"| 0x1D
+
  |rowspan="4"| 0x10
  |rowspan="5"| Play
+
  |rowspan="4"| Play
  |rowspan="5"| Client
+
  |rowspan="4"| Client
 
  | Entity ID
 
  | Entity ID
 
  | VarInt
 
  | VarInt
  | Entity's ID
+
  |  
 +
|-
 +
| Title
 +
| String
 +
| Name of the painting. Max length 13
 
  |-
 
  |-
  | Effect ID
+
  | Location
  | Byte
+
  | Position
  | See {{Minecraft Wiki|Status effect#List of effects|this table}}
+
  | Center coordinates
 
  |-
 
  |-
  | Amplifier
+
  | Direction
  | Byte
+
  | Unsigned Byte
  | Notchian client displays effect level as Amplifier + 1
+
  | Direction the painting faces. 0: north (-z), 1: west (-x), 2: south (+z), 3: east (+x)
|-
 
| Duration
 
| VarInt
 
| Seconds
 
|-
 
| Hide Particles
 
| Boolean
 
|
 
 
  |}
 
  |}
  
==== Remove Entity Effect ====
+
==== Spawn Experience Orb ====
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x1E || rowspan=2 | Play || rowspan=2 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Effect ID || Byte ||
 
|}
 
  
==== Set Experience ====
+
Spawns one or more experience orbs.
 
 
Sent by the server when the client should change experience levels.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x1F || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Experience bar || Float || Between 0 and 1
+
! Field Name
|-
+
! Field Type
| Level || VarInt ||
+
! Notes
|-
+
|-
| Total Experience || VarInt ||
+
|rowspan="5"| 0x11
|}
+
|rowspan="5"| Play
 
+
|rowspan="5"| Client
==== Entity Properties ====
+
| Entity ID
{| class="wikitable"
+
| VarInt
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
| Entity's ID
|-
+
|-
| rowspan=3 | 0x20 || rowspan=3 | Play || rowspan=3 | Client
+
| X
| Entity ID || VarInt || Entity's ID
+
| Int
|-
+
| X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
| Count || Int || Length of following array
+
|-
|-
+
| Y
| Properties || Array of Property Data ||
+
| Int
|}
+
| Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
+
|-
'''Property Data''' structure:
+
| Z
{| class="wikitable"
+
| Int
|-
+
| Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
! Field Name !! Field Type !! Notes
+
|-
|-
+
| Count
| Key || String ||
+
| Short
|-
+
| The amount of experience this orb will reward once collected
| 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:
+
==== Entity Velocity ====
{| class="wikitable"
 
|-
 
! Key !! Default !! Min !! Max !! Label
 
|-
 
| generic.maxHealth || 20.0 || 0.0 || Double.MaxValue || Max Health
 
|-
 
| generic.followRange || 32.0 || 0.0 || 2048.0 || Follow Range
 
|-
 
| generic.knockbackResistance || 0.0 || 0.0 || 1.0 || Knockback Resistance
 
|-
 
| generic.movementSpeed || 0.699999988079071 || 0.0 || Double.MaxValue || Movement Speed
 
|-
 
| generic.attackDamage || 2.0 || 0.0 || Double.MaxValue ||
 
|-
 
| horse.jumpStrength || 0.7 || 0.0 || 2.0 || Jump Strength
 
|-
 
| zombie.spawnReinforcements || 0.0 || 0.0 || 1.0 || Spawn Reinforcements Chance
 
|}
 
 
 
'''Modifier Data''' structure:
 
{| class="wikitable"
 
|-
 
! 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:
+
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).
 
 
* 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
|-
+
! State
| rowspan=6 | 0x21 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| Chunk X || Int || Chunk X coordinate
+
! Field Name
|-
+
! Field Type
| Chunk Z || Int || Chunk Z coordinate
+
! Notes
|-
+
|-
| 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="4"| 0x12
|-
+
|rowspan="4"| Play
| Primary bit map || Unsigned Short || Bitmask with 1 for every 16x16x16 section which data follows in the compressed data.
+
|rowspan="4"| Client
|-  
+
| Entity ID
| Size || VarInt || Size of chunk data
+
| VarInt
|-
+
|  
| Data || Byte array || The chunk data is not compressed as of 14w28a
+
|-
|}
+
| Velocity X
 +
| Short
 +
| Velocity on the X axis
 +
|-
 +
| Velocity Y
 +
| Short
 +
| Velocity on the Y axis
 +
|-
 +
| Velocity Z
 +
| Short
 +
| Velocity on the Z axis
 +
|}
  
==== Multi Block Change ====
+
==== Destroy Entities ====
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x22 || rowspan=4 | Play || rowspan=4 | 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'''
+
Sent by the server when a list of entities is to be destroyed on the client.
{| class="wikitable"
 
|-
 
! 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 ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x23 || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Location || Position|| Block Coordinates
+
! Field Name
|-
+
! Field Type
| Block ID || VarInt || The new block ID for the block. <code>id << 4 &#124; data</code>
+
! Notes
|}
+
|-
 +
|rowspan="2"| 0x13
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Count
 +
| VarInt
 +
| Length of the following array
 +
|-
 +
| Entity IDs
 +
| Array of VarInt
 +
| The list of entities of destroy
 +
|}
  
==== Block Action ====
+
==== Entity ====
  
This packet is used for a number of things:
+
Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.
* <div class="li">Chests opening and closing
 
* Pistons pushing and pulling
 
* Note blocks playing
 
* Update Beacons
 
  
See Also: [[Block Actions]]
+
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
|-
+
! State
| rowspan=4 | 0x24 || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| Location || Position || Block Coordinates
+
! Field Name
|-
+
! Field Type
| Byte 1 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
+
! Notes
|-
+
|-
| Byte 2 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
+
|rowspan="1"| 0x14
|-
+
|rowspan="1"| Play
| Block Type || VarInt || The block type for the block
+
|rowspan="1"| Client
|}
+
| Entity ID
 +
| VarInt
 +
|  
 +
|}
  
 +
==== Entity Relative Move ====
  
==== Block Break Animation ====
+
This packet is sent by the server when an entity moves less then 4 blocks; if an entity moves more than 4 blocks [[#Entity Teleport|Entity Teleport]] should be sent instead.
  
0-9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
+
This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.
 
 
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)
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x25 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Entity ID || VarInt || Entity's ID
+
! Field Name
|-
+
! Field Type
| Location || Position || Block Position
+
! Notes
|-
+
|-
| Destroy Stage || Byte || 0 - 9 and any other value to remove it
+
|rowspan="5"| 0x15
|}
+
|rowspan="5"| Play
 
+
|rowspan="5"| Client
==== Map Chunk Bulk ====
+
| Entity ID
 +
| VarInt
 +
|  
 +
|-
 +
| Delta X
 +
| Byte
 +
| Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 +
|-
 +
| DY
 +
| Byte
 +
| Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 +
|-
 +
| DZ
 +
| Byte
 +
| Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 +
|-
 +
| On Ground
 +
| Boolean
 +
|
 +
|}
  
See also: [[SMP Map Format]]
+
==== Entity Look ====
 
 
1.8 changes at [[#Chunk_Data]]
 
  
To reduce the number of bytes this packet is used to send chunks together for better compression results.
+
This packet is sent by the server when an entity rotates.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=4 | 0x26 || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| 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
+
! Field Name
|-
+
! Field Type
| Chunk column count || VarInt || The number of chunk in this packet
+
! Notes
|-
+
|-
| Meta information || Meta || See below
+
|rowspan="5"| 0x16
|-
+
|rowspan="5"| Play
| Data || Byte Array || Chunk data. Uncompressed as of 14w28a
+
|rowspan="5"| Client
|}
+
| Entity ID
 
+
| VarInt
'''Meta'''
+
|  
{| class="wikitable"
+
|-
! Field Name !! Field Type !! Notes
+
| Yaw
|-
+
| Angle
|Chunk X || Int || The X Coordinate of the chunk
+
| New angle, not a delta
|-
+
|-
|Chunk Z || Int || The Z Coordinate of the chunk
+
| Pitch
|-
+
| Angle
|Primary bitmap || Unsigned Short || A bitmap which specifies which sections are not empty in this chunk
+
| New angle, not a delta
|}
+
|-
 
+
| On Ground
==== Explosion ====
+
| Boolean
 +
|  
 +
|}
  
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
+
==== Entity Look And Relative Move ====
  
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
+
This packet is sent by the server when an entity rotates and moves. Since a byte range is limited from -128 to 127, and movement is offset of fixed-point numbers, this packet allows at most four blocks movement in any direction. (-128/32 == -4)
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="9" | 0x27 || rowspan=9 | Play || rowspan=9 | Client
+
! Bound To
| X || Float ||
+
! Field Name
|-
+
! Field Type
| Y || Float ||
+
! Notes
|-
+
|-
| Z || Float ||
+
|rowspan="7"| 0x17
|-
+
|rowspan="7"| Play
| Radius || Float || Currently unused in the client
+
|rowspan="7"| Client
|-
+
| Entity ID
| Record count || Int || This is the count, not the size. The size is 3 times this value.
+
| VarInt
|-
+
|  
| Records || (Byte, Byte, Byte) × count || Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
+
|-
|-
+
| Delta X
| Player Motion X || Float || X velocity of the player being pushed by the explosion
+
| Byte
|-
+
| Change in X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
| Player Motion Y || Float || Y velocity of the player being pushed by the explosion
+
|-
|-
+
| Delta Y
| Player Motion Z || Float || Z velocity of the player being pushed by the explosion
+
| Byte
|}
+
| Change in Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
+
|-
==== Effect ====
+
| Delta Z
 
+
| Byte
Sent when a client is to play a sound or particle effect.
+
| Change in Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
 
+
|-
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.
+
| Yaw
 +
| Angle
 +
| New angle, not a delta
 +
|-
 +
| Pitch
 +
| Byte
 +
| New angle, not a delta
 +
|-
 +
| On Ground
 +
| Boolean
 +
|  
 +
|}
  
{| class="wikitable"
+
==== Entity Teleport ====
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x28 || rowspan=4 | Play || rowspan=4 | 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 =====
+
This packet is sent by the server when an entity moves more than 4 blocks.
  
 
{| class="wikitable"
 
{| class="wikitable"
! ID !! Name
+
! Packet ID
|-
+
! State
| colspan=2 | '''Sound'''
+
! Bound To
|-
+
! Field Name
| 1000|| <code>random.click</code>
+
! Field Type
|-
+
! Notes
| 1001|| <code>random.click</code>
+
|-
|-
+
|rowspan="7"| 0x18
| 1002|| <code>random.bow</code>
+
|rowspan="7"| Play
|-
+
|rowspan="7"| Client
| 1003|| <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
+
| Entity ID
|-
+
| VarInt
| 1004|| <code>random.fizz</code>
+
|  
|-
+
|-
| 1005|| Play a music disc. '''Data''' [http://www.minecraftwiki.net/wiki/Music_Discs Record ID]
+
| X
|-
+
| Int
| ''(1006 not assigned)'' ||
+
| X position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
|-
+
|-
| 1007|| <code>mob.ghast.charge</code>
+
| Y
|-
+
| Int
| 1008|| <code>mob.ghast.fireball</code>
+
| Y position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
|-
+
|-
| 1009|| <code>mob.ghast.fireball</code>, but with a lower volume.
+
| Z
|-
+
| Int
| 1010|| <code>mob.zombie.wood</code>
+
| Z position as a [[Data Types#Fixed-point numbers|Fixed-Point number]]
|-
+
|-
| 1011|| <code>mob.zombie.metal</code>
+
| Yaw
|-
+
| Angle
| 1012|| <code>mob.zombie.woodbreak</code>
+
| New angle, not a delta
|-
+
|-
| 1013|| <code>mob.wither.spawn</code>
+
| Pitch
|-
+
| Angle
| 1014|| <code>mob.wither.shoot</code>
+
| New angle, not a delta
|-
+
|-
| 1015|| <code>mob.bat.takeoff</code>
+
| On Ground
|-
+
| Boolean
| 1016|| <code>mob.zombie.infect</code>
+
|  
|-
+
|}
| 1017|| <code>mob.zombie.unfect</code>
 
|-
 
| 1018|| <code>mob.enderdragon.end</code>
 
|-
 
| 1020|| <code>random.anvil_break</code>
 
|-
 
| 1021|| <code>random.anvil_use</code>
 
|-
 
| 1022|| <code>random.anvil_land</code>
 
|-
 
| colspan=2 | '''Particle'''
 
|-
 
| 2000|| Spawns 10 smoke particles, e.g. from a fire. '''Data''' direction, see below
 
|-
 
| 2001|| Block break. '''Data''' [http://www.minecraftwiki.net/wiki/Data_values Block ID]
 
|-
 
| 2002|| Splash potion. Particle effect + glass break sound. '''Data''' [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
 
|-
 
| 2003|| Eye of ender entity break animation - particles and sound
 
|-
 
| 2004|| Mob spawn particle effect: smoke + flames
 
|-
 
| 2005|| Spawn "happy villager" effect (green crosses), used for bonemealing vegetation.
 
|}
 
 
 
Smoke directions:
 
 
 
{| class="wikitable"
 
! 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 ====
+
==== Entity Head Look ====
  
Used to play a sound effect on the client.
+
Changes the direction an entity's head is facing.
 
 
All known sound effect names can be seen [https://github.com/SirCmpwn/Craft.Net/blob/master/source/Craft.Net.Common/SoundEffect.cs here].
 
 
 
Custom sounds may be added by resource packs
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="6" | 0x29 || rowspan=6 | Play || rowspan=6 | Client
+
! Bound To
| Sound name || String ||
+
! Field Name
|-
+
! Field Type
| Effect position X || Int || Effect X multiplied by 8
+
! Notes
|-
+
|-
| Effect position Y || Int || Effect Y multiplied by 8
+
|rowspan="2"| 0x19
|-
+
|rowspan="2"| Play
| Effect position Z || Int || Effect Z multiplied by 8
+
|rowspan="2"| Client
|-
+
| Entity ID
| Volume || Float || 1 is 100%, can be more
+
| VarInt
|-
+
|  
| Pitch || Unsigned Byte || 63 is 100%, can be more
+
|-
|}
+
| Head Yaw
 
+
| Angle
==== Particle ====
+
| New angle, not a delta
 +
|}
  
Displays the named particle
+
==== Entity Status ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=11 | 0x2A || rowspan=11 | Play || rowspan=11 | Client
+
! Bound To
| Particle Id || Int ||
+
! Field Name
|-
+
! Field Type
| Long Distance || Boolean || If true, particle distance increases from 256 to 65536.
+
! Notes
|-
+
|-
| X || Float || X position of the particle
+
|rowspan="2"| 0x1A
|-
+
|rowspan="2"| Play
| Y || Float || Y position of the particle
+
|rowspan="2"| Client
|-
+
| Entity ID
| Z || Float || Z position of the particle
+
| Int
|-
+
|  
| Offset X || Float || This is added to the X position after being multiplied by random.nextGaussian()
+
|-
|-
+
| Entity Status
| Offset Y || Float || This is added to the Y position after being multiplied by random.nextGaussian()
+
| Byte
|-
+
| See below
| 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
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Particle Name
+
|-
! Particle Id
+
! Entity Status
|-
+
! Meaning
| explode
+
|-
| 0
+
| 0
|-
+
| ''unknown'': Something related to living entities?
| largeexplosion
+
|-
| 1
+
| 1
|-
+
| ''unknown'': Something related to the player entity?
| hugeexplosion
+
|-
| 2
+
| 2
|-
+
| Living Entity hurt
| fireworksSpark
+
|-
| 3
+
| 3
|-
+
| Living Entity dead
| bubble
+
|-
| 4
+
| 4
|-
+
| Iron Golem throwing up arms
| wake
+
|-
| 5
+
| 6
|-
+
| Wolf/Ocelot/Horse taming — Spawn “heart” particles
| splash
+
|-
| 6
+
| 7
|-
+
| Wolf/Ocelot/Horse tamed — Spawn “smoke” particles
| suspended
+
|-
| 7
+
| 8
|-
+
| Wolf shaking water — Trigger the shaking animation
| townaura
+
|-
| 8
+
| 9
|-
+
| (of self) Eating accepted by server
| crit
+
|-
| 9
+
| 10
|-
+
| Sheep eating grass
| magicCrit
+
|-
| 10
+
| 10
|-
+
| Play TNT ignite sound
| smoke
+
|-
| 11
+
| 11
|-
+
| Iron Golem handing over a rose
| largesmoke
+
|-
| 12
+
| 12
|-
+
| Villager mating — Spawn “heart” particles
| mobSpell?
+
|-
| 13
+
| 13
|-
+
| Spawn particles indicating that a villager is angry and seeking revenge
| instantSpell
+
|-
| 14
+
| 14
|-
+
| Spawn happy particles near a villager
| spell
+
|-
| 15
+
| 15
|-
+
| Witch animation — Spawn “magic” particles
| witchMagic
+
|-
| 17
+
| 16
|-
+
| Play zombie converting into a villager sound
| dripWater
+
|-
| 18
+
| 17
|-
+
| Firework exploding
| dripLava
+
|-
| 19
+
| 18
|-
+
| Animal in love (ready to mate) — Spawn “heart” particles
| angryVillager
+
|-
| 20
+
| 19
|-
+
| Reset squid rotation
| happyVillager
+
|-
| 21
+
| 20
|-
+
| Spawn explosion particle — works for some living entities
| depthsuspend
+
|-
| 22
+
| 21
|-
+
| Play guardian sound — works for every entity
| note
+
|-
| 23
+
| 22
|-
+
| Enables reduced debug for players
| portal
+
|-
| 24
+
| 23
|-
+
| Disables reduced debug for players
| 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.
+
==== Attach Entity ====
  
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.
+
This packet is sent when a player has been attached to an entity (e.g. Minecart)
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="2" | 0x2B || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Reason || Unsigned Byte ||
+
! Field Name
|-
+
! Field Type
| Value || Float || Depends on reason
+
! Notes
|}
+
|-
 
+
|rowspan="3"| 0x1B
'''Reason codes'''
+
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Entity ID
 +
| Int
 +
| Attached entity's EID
 +
|-
 +
| Vehicle ID
 +
| Int
 +
| Vechicle's Entity ID
 +
|-
 +
| Leash
 +
| Boolean
 +
| If true leashes the entity to the vehicle
 +
|}
  
{| class="wikitable"
+
==== Entity Metadata ====
! 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.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="5" | 0x2C || rowspan=5 | Play || rowspan=5 | Client
+
! Bound To
| Entity ID || VarInt || The entity ID of the thunderbolt
+
! Field Name
|-
+
! Field Type
| Type || Byte || The global entity type, currently always 1 for thunderbolt.
+
! Notes
|-
+
|-
| X || Int || Thunderbolt X a [[Data_Types#Fixed-point_numbers|fixed-point number]]
+
|rowspan="2"| 0x1C
|-
+
|rowspan="2"| Play
| Y || Int || Thunderbolt Y a [[Data_Types#Fixed-point_numbers|fixed-point number]]
+
|rowspan="2"| Client
|-
+
| Entity ID
| Z || Int || Thunderbolt Z a [[Data_Types#Fixed-point_numbers|fixed-point number]]
+
| VarInt
|}
+
|  
 
+
|-
==== Open Window ====
+
| Metadata
 +
| [[Entities#Entity Metadata Format|Metadata]]
 +
|  
 +
|}
  
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.
+
==== Entity Effect ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=5 | 0x2D || rowspan=5 | Play || rowspan=5 | Client
+
! Bound To
| Window id || Unsigned Byte || A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
+
! Field Name
|-
+
! Field Type
| Inventory Type || String || The window type to use for display. Check below
+
! Notes
|-
+
|-
| Window title || [[Chat]] || The title of the window.
+
|rowspan="5"| 0x1D
|-
+
|rowspan="5"| Play
| Number of Slots || Unsigned Byte || Number of slots in the window (excluding the number of slots in the player inventory).
+
|rowspan="5"| Client
|-
+
  | Entity ID
| Entity ID || Int || EntityHorse's entityId. Only sent when window type is equal to "EntityHorse".
+
  | VarInt
|}
+
|  
 
+
|-
See [[Inventory#Windows|inventory windows]] for further information.
+
| Effect ID
 
+
| Byte
==== Close Window ====
+
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 
+
|-
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.
+
| Amplifier
 
+
| Byte
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.
+
| Notchian client displays effect level as Amplifier + 1
 
+
|-
{| class="wikitable"
+
| Duration
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
| VarInt
|-
+
| Seconds
| 0x2E || rowspan=1 | Play || rowspan=1 | Client
+
|-
| Window ID || Unsigned Byte || This is the id of the window that was closed. 0 for inventory.
+
| Hide Particles
|}
+
| Boolean
 +
|  
 +
|}
  
==== Set Slot ====
+
==== Remove Entity Effect ====
 
 
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
+
! Packet ID
|-
+
! State
| rowspan="3" | 0x2F || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Window ID || Byte
+
! Field Name
| 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).
+
! Field Type
|-
+
! Notes
| Slot || Short || The slot that should be updated
+
|-
|-
+
|rowspan="2"| 0x1E
| Slot data || [[Slot_Data|Slot]] ||
+
|rowspan="2"| Play
|}
+
|rowspan="2"| Client
 
+
| Entity ID
==== Window Items ====
+
| VarInt
 +
|  
 +
|-
 +
| Effect ID
 +
| Byte
 +
| See {{Minecraft Wiki|Status effect#List of effects|this table}}
 +
|}
  
[[File:Inventory-slots.png|thumb|The inventory slots]]
+
==== Set Experience ====
  
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.  
+
Sent by the server when the client should change experience levels.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="3" | 0x30 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Window ID || Unsigned Byte || The id of window which items are being sent for. 0 for player inventory.
+
! Field Name
|-
+
! Field Type
| Count || Short || The number of slots (see below)
+
! Notes
|-
+
|-
| Slot data || Array of [[Slot_Data|Slot]]s ||
+
|rowspan="3"| 0x1F
|}
+
|rowspan="3"| Play
 
+
|rowspan="3"| Client
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
+
| Experience bar
 
+
| Float
==== Window Property ====
+
| Between 0 and 1
{| class="wikitable"
+
|-
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
| Level
|-
+
| VarInt
| rowspan="3" | 0x31 || rowspan=3 | Play || rowspan=3 | Client
+
|  
| Window ID || Unsigned Byte || The id of the window.
+
|-
|-
+
| Total Experience
| Property || Short || Which property should be updated.
+
| VarInt
|-
+
| See {{Minecraft Wiki|Experience#Leveling up}} on the Minecraft Wiki for Total Experience to Level conversion
| Value || Short || The new value for the property.
+
|}
|}
 
  
'''Furnace'''
+
==== Entity Properties ====
  
Properties:
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
!colspan="2"| Field Type
 +
! Notes
 +
|-
 +
|rowspan="6"| 0x20
 +
|rowspan="6"| Play
 +
|rowspan="6"| Client
 +
|colspan="2"| Entity ID
 +
|colspan="2"| VarInt
 +
|
 +
|-
 +
|colspan="2"| Number Of Properties
 +
|colspan="2"| Int
 +
| Length of the following array
 +
|-
 +
|rowspan="4"| Property
 +
| Key
 +
|rowspan="4"| Array
 +
| String
 +
| See below
 +
|-
 +
| Value
 +
| Double
 +
| See below
 +
|-
 +
| Number Of Modifiers
 +
| VarInt
 +
| Length of the following array
 +
|-
 +
| Modifiers
 +
| Array of Modifier Data
 +
| See {{Minecraft Wiki|Attribute#Modifiers}}
 +
|}
  
* 0: Progress arrow
+
Known Key values:
* 1: Fire icon (fuel)
 
  
Values:
+
{| class="wikitable"
 +
|-
 +
! 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
 +
|}
  
* 0-200 for progress arrow
+
''Modifier Data'' structure:
* 0-200 for fuel indicator
 
  
Ranges are presumably in in-game ticks
+
{| class="wikitable"
 +
|-
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| UUID
 +
| UUID
 +
|
 +
|-
 +
| Amount
 +
| Double
 +
|
 +
|-
 +
| Operation
 +
| Byte
 +
|
 +
|}
  
'''Enchantment Table'''
+
==== Chunk Data ====
  
Properties: 0, 1 or 2 depending on the "enchantment slot" being given.
+
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.
  
Values: The enchantment's level.
+
See also: [[SMP Map Format]]
  
'''Beacon'''
+
Changes in 1.8:
  
* 0: Power level
+
* Data value section removed
* 1: Potion effect one
+
* Extended id section removed
* 2: Potion effect two
+
* Block id section is now a unsigned short (little endian) per a block
 
+
* The block id is equal to <code>(id << 4) | data</code>
'''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"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="3" | 0x32 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Window ID || Byte || The id of the window that the action occurred in.
+
! Field Name
|-
+
! Field Type
| Action number || Short || Every action that is to be accepted has a unique number. This field corresponds to that number.
+
! Notes
|-
+
|-
| Accepted || Bool || Whether the action was accepted.
+
|rowspan="6"| 0x21
|}
+
|rowspan="6"| Play
 
+
|rowspan="6"| Client
==== Update Sign ====
+
| 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 Mask specifies exactly which sections are included, and which are air
 +
|-
 +
| Primary Bit Mask
 +
| Unsigned Short
 +
| Bitmask with 1 for every 16x16x16 section whose data follows in the compressed data
 +
|-  
 +
| Size
 +
| VarInt
 +
| Size of Data
 +
|-
 +
| Data
 +
| [[SMP Map Format#Data|Chunk]]
 +
|
 +
|}
  
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.
+
==== Multi Block Change ====
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=5 | 0x33 || rowspan=5 | Play || rowspan=5 | Client
+
! Bound To
| Location || Position || Block Coordinates
+
!colspan="2"| Field Name
|-
+
!colspan="2"| Field Type
| Line 1 || [[Chat]] || First line of text in the sign
+
! Notes
|-
+
|-
| Line 2 || [[Chat]] || Second line of text in the sign
+
|rowspan="6"| 0x22
|-
+
|rowspan="6"| Play
| Line 3 || [[Chat]] || Third line of text in the sign
+
|rowspan="6"| Client
|-
+
|colspan="2"| Chunk X
| Line 4 || [[Chat]] || Fourth line of text in the sign
+
|colspan="2"| Int
|}
+
| Chunk X coordinate
 
+
|-
==== Maps ====
+
|colspan="2"| Chunk Z
 
+
|colspan="2"| Int
{| class="wikitable"
+
| Chunk Z coordinate
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|-
|-
+
|colspan="2"| Record Count
| rowspan=10 | 0x34 || rowspan=10 | Play || rowspan=10 | Client
+
|colspan="2"| VarInt
| Item Damage || VarInt || The damage value of the map being modified
+
| Length of the following array, a.k.a. the number of blocks affected
|-
+
|-
| Scale || Byte ||  
+
|rowspan="3"| Record
|-
+
| Horizontal Position
| Length || VarInt ||
+
|rowspan="3"| Array
|-
+
| Unsigned Byte
| Icons || 3 * length bytes || First byte, 0xF0 = Direction, 0x0F = Type. Second byte, X. Third byte, Y
+
| The 4 most significant bits (<code>0xF0</code>) encode the X coordinate, relative to the chunk. The 4 least significant bits (<code>0x0F</code>) encode the Z coordinate, relative to the chunk.
|-  
+
|-
| Columns || Byte ||
+
| Y Coordinate
|-
+
| Unsigned Byte
| Rows || Byte || Only if Columns is more than 0
+
|  
|-
+
|-
| X || Byte || Only if Columns is more than 0
+
| Block ID
|-
+
| VarInt
| Y || Byte || Only if Columns is more than 0
+
| The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
|-
+
|}
| Length || VarInt || Only if Columns is more than 0
 
|-
 
| Data || Length bytes || Only if Columns is more than 0
 
|}
 
  
==== Update Block Entity ====
+
==== Block Change ====
 
 
Essentially a block update on a block entity.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=3 | 0x35 || rowspan=3 | Play || rowspan=3 | Client
+
! Bound To
| Location || Position ||
+
! Field Name
|-
+
! Field Type
| Action || Unsigned Byte || The type of update to perform
+
! Notes
|-
+
|-
| NBT Data || Byte Array || If not present then its TAG_END (0)
+
|rowspan="2"| 0x23
|}
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Location
 +
| Position
 +
| Block Coordinates
 +
|-
 +
| Block ID
 +
| VarInt
 +
| The new block ID for the block. <code><nowiki>id &lt;&lt; 4 | data</nowiki></code>
 +
|}
  
'''Actions'''
+
==== Block Action ====
  
* '''1''': Set SpawnPotentials of a mob spawner
+
This packet is used for a number of things:
* '''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 ====
+
* Chests opening and closing
 +
* Pistons pushing and pulling
 +
* Note blocks playing
 +
* Updating beacons
  
Sent on placement of sign.
+
See Also: [[Block Actions]]
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x36 || rowspan=1 | Play || rowspan=1 | Client
+
! Bound To
| Location || Position || Block coordinates
+
! 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]]
 +
|-
 +
| Byte 2
 +
| Unsigned Byte
 +
| Varies depending on block — see [[Block Actions]]
 +
|-
 +
| Block Type
 +
| VarInt
 +
| The block type for the block
 +
|}
  
==== Statistics ====
+
==== Block Break Animation ====
{| class="wikitable"
 
! Packet ID !! Category !! Bound To
 
! colspan="2" | Field Name
 
! Field Type !! Notes
 
|-
 
| rowspan="3" | 0x37 || rowspan=3 | Play || rowspan=3 | Client
 
| colspan="2" | Count || VarInt || Number of entries
 
|-
 
| rowspan=2 | Entry
 
| Statistic's name || String || https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0
 
|-
 
| Value || VarInt || The amount to set it to
 
|}
 
  
==== Player List Item ====
+
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
  
Sent by the notchian server to update the user list (<tab> in the client).
+
You can also set an animation to air! The animation will still be visible.
  
{| class="wikitable"
+
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
! Packet ID !! Category !! Bound To !! colspan=3 | Field Name !! Field Type !! Notes
 
|-
 
| rowspan=19 | 0x38 || rowspan=19 | Play || rowspan=19 | Client
 
| colspan=3 | Action || VarInt ||
 
|-
 
| colspan=3 | Length || VarInt || The following fields are repeated ''length'' times
 
|-
 
| colspan=3 | UUID || UUID || The uuid of the player
 
|-
 
! Action !! colspan=4 |
 
|-
 
| rowspan=10 | 0 (ADD_PLAYER)
 
| colspan=2 | Name || String ||
 
|-
 
| colspan=2 | Number of properties || VarInt ||
 
|-
 
| 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
 
|-
 
| 1 (UPDATE_GAMEMODE) || 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 ====
+
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 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.
+
{| class="wikitable"
   
+
! Packet ID
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).
+
! State
   
+
! Bound To
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.
+
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="3"| 0x25
 +
  |rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Entity ID
 +
| VarInt
 +
| Entity's ID
 +
|-
 +
| Location
 +
| Position
 +
| Block Position
 +
|-
 +
| Destroy Stage
 +
  | Byte
 +
| 0–9 to set it, any other value to remove it
 +
|}
  
{| class="wikitable"
+
==== Map Chunk Bulk ====
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan="3" | 0x39 || rowspan=3 | Play || rowspan=3 | Client
 
| Flags || Byte ||
 
|-
 
| Flying speed || Float|| previous integer value divided by 250
 
|-
 
| Walking speed || Float || previous integer value divided by 250
 
|}
 
  
==== Tab-Complete ====
+
See also: [[SMP Map Format]]
 
 
The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported.
 
  
{| class="wikitable"
+
1.8 changes at [[#Chunk Data|Chunk Data]]
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| 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
 
|}
 
  
==== Scoreboard Objective ====
+
To reduce the number of bytes, this packet is used to send chunks together for better compression results.
 
 
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
|-
+
! State
| rowspan=4 | 0x3B || rowspan=4 | Play || rowspan=4 | Client
+
! Bound To
| Objective name || String || An unique name for the objective
+
!colspan="2"| Field Name
|-
+
!colspan="2"| Field Type
| Mode || Byte || 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
+
! Notes
|-
+
|-
| Objective value || String || Only if mode is 0 or 2. The text to be displayed for the score.
+
|rowspan="7"| 0x26
|-
+
|rowspan="7"| Play
| Type || String || Only if mode is 0 or 2. "integer" or "hearts"
+
|rowspan="7"| Client
|}
+
|colspan="2"| Sky Light Sent
 
+
|colspan="2"| Boolean
==== Update Score ====
+
| Whether or not the chunk data contains a light nibble array. This is true in the Overworld, false in the End + Nether
 +
|-
 +
|colspan="2"| Chunk Column Count
 +
|colspan="2"| VarInt
 +
| Length of the following array
 +
|-
 +
|rowspan="4"| Chunk
 +
| Chunk X
 +
|rowspan="4"| Array
 +
| Int
 +
| The X Coordinate of the chunk
 +
|-
 +
| Chunk Z
 +
| Int
 +
| The Z Coordinate of the chunk
 +
|-
 +
| Primary Bit Mask
 +
| Unsigned Short
 +
| A bit mask which specifies which sections are not empty in this chunk
 +
|-
 +
| Data
 +
| [[SMP Map Format#Data|Chunk]]
 +
|
 +
|}
  
This is sent to the client when it should update a scoreboard item.
+
==== Explosion ====
  
{| class="wikitable"
+
Sent when an explosion occurs (creepers, TNT, and ghast fireballs).
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x3C || rowspan=4 | Play || rowspan=4 | 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 ====
+
Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x
 
 
This is sent to the client when it should display a scoreboard.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan="2" | 0x3D || rowspan=2 | Play || rowspan=2 | Client
+
! Bound To
| Position || Byte || The position of the scoreboard. 0 = list, 1 = sidebar, 2 = belowName.
+
! Field Name
|-
+
! Field Type
| Score Name || String || The unique name for the scoreboard to be displayed.
+
! Notes
|}
+
|-
 
+
|rowspan="9"| 0x27
==== Teams ====
+
|rowspan="9"| Play
 +
|rowspan="9"| Client
 +
| X
 +
| Float
 +
|
 +
|-
 +
| Y
 +
| Float
 +
|
 +
|-
 +
| Z
 +
| Float
 +
|
 +
|-
 +
| Radius
 +
| Float
 +
| Currently unused in the client
 +
|-
 +
| Record Count
 +
| Int
 +
| Length of the following array
 +
|-
 +
| Records
 +
| Array of (Byte, Byte, Byte)
 +
| Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
 +
|-
 +
| Player Motion X
 +
| Float
 +
| X velocity of the player being pushed by the explosion
 +
|-
 +
| Player Motion Y
 +
| Float
 +
| Y velocity of the player being pushed by the explosion
 +
|-
 +
| Player Motion Z
 +
| Float
 +
| Z velocity of the player being pushed by the explosion
 +
|}
  
Creates and updates teams.
+
==== Effect ====
  
{| class="wikitable"
+
Sent when a client is to play a sound or particle effect.
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=10 | 0x3E || rowspan=10 | Play || rowspan=10 | 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.  
+
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.
  
If 3 then new players are added to the team.
+
{| class="wikitable"
 
+
! Packet ID
If 4 then players are removed from the team.
+
! State
|-
+
! Bound To
| Team Display Name || String || Only if Mode = 0 or 2.
+
! Field Name
|-
+
! Field Type
| Team Prefix || String || Only if Mode = 0 or 2. Displayed before the players' name that are part of this team.
+
! Notes
|-
+
|-
| Team Suffix || String || Only if Mode = 0 or 2. Displayed after the players' name that are part of this team.
+
|rowspan="4"| 0x28
|-
+
|rowspan="4"| Play
| Friendly fire || Byte || Only if Mode = 0 or 2; 0 for off, 1 for on, 3 for seeing friendly invisibles
+
|rowspan="4"| Client
|-
+
| Effect ID
| Name Tag Visibility || String || Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never.  
+
| Int
|-
+
| The ID of the effect, see below
| Color || Byte || Only if Mode = 0 or 2. Same as [[Chat]] colors.
+
|-
|-
+
  | Location
| Player count || VarInt || Only if Mode = 0 or 3 or 4. Number of players in the array
+
  | Position
|-
+
| The location of the effect
| 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
+
|-
|}
+
| Data
 
+
| Int
==== Plugin Message ====
+
| Extra data for certain effects, see below
 
+
|-
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>.
+
| Disable Relative Volume
 +
| Boolean
 +
| See above
 +
|}
  
More documentation on this: http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/
+
Effect IDs:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! ID
|-
+
! Name
| rowspan=2 | 0x3F || rowspan=2 | Play || rowspan=2 | Client
+
! Data
| Channel || String || Name of the "channel" used to send the data.
+
|-
|-
+
!colspan="3"| Sound
| Data || Byte Array || Any data.
+
|-
|}
+
| 1000
 
+
| <code>random.click</code>
==== 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.
+
| 1001
 
+
| <code>random.click</code>
{| class="wikitable"
+
|  
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|-
|-
+
| 1002
| 0x40 || rowspan=1 | Play || rowspan=1 | Client
+
| <code>random.bow</code>
| Reason || String || Displayed to the client when the connection terminates. Must be valid JSON.
+
|  
|}
+
|-
 
+
| 1003
==== Server Difficulty ====
+
| <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
 
+
|  
Changes the difficulty setting in the client's option menu
+
|-
{| class="wikitable"
+
| 1004
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
| <code>random.fizz</code>
|-
+
|  
| rowspan=1 | 0x41 || rowspan=1 | Play || rowspan=1 | Client
+
|-
| Difficulty || Unsigned Byte || 0:PEACEFUL, 1:EASY, 2:NORMAL, 3: HARD
+
| 1005
|}
+
| Play a music disc.
 
+
| {{Minecraft Wiki|Music Discs|Record ID}}
 
+
|-
==== Combat Event ====
+
| 1006
 
+
| ''not assigned''
{| class="wikitable"
+
|  
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|-
|-
+
| 1007
| rowspan=6 | 0x42 || rowspan=6 | Play || rowspan=6 | Client
+
| <code>mob.ghast.charge</code>
| Event || VarInt || 0 ENTER_COMBAT, 1 END_COMBAT, 2 ENTITY_DEAD
+
|  
|-
+
|-
| Duration || VarInt || Only for END_COMBAT
+
| 1008
|-
+
| <code>mob.ghast.fireball</code>
| Entity ID || Int || Only for END_COMBAT
+
|  
|-
+
|-
| Player ID || VarInt || Only for ENTITY_DEAD
+
| 1009
|-
+
| <code>mob.ghast.fireball</code>, but with a lower volume
| Entity ID || Int || Only for ENTITY_DEAD
+
|  
|-
+
|-
| Message || String || Only for ENTITY_DEAD
+
| 1010
|}
+
| <code>mob.zombie.wood</code>
 
+
|  
==== Camera ====
+
|-
 
+
| 1011
{| class="wikitable"
+
| <code>mob.zombie.metal</code>
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|  
|-
+
|-
| rowspan=1 | 0x43 || rowspan=1 | Play || rowspan=1 | Client
+
| 1012
| Camera ID || VarInt ||
+
| <code>mob.zombie.woodbreak</code>
|}
+
|  
 
+
|-
==== World Border ====
+
| 1013
 
+
| <code>mob.wither.spawn</code>
{| class="wikitable"
+
|  
! Packet ID !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
+
|-
|-
+
| 1014
| rowspan=18 | 0x44 || rowspan=18 | Play || rowspan=18 | Client
+
| <code>mob.wither.shoot</code>
| colspan=2 | Action || VarInt ||
+
|  
|-
+
|-
! Action !! Name !! !!
+
| 1015
|-
+
| <code>mob.bat.takeoff</code>
| 0 (SET_SIZE)
+
|  
| Radius || Double ||
+
|-
|-
+
| 1016
| rowspan=3 | 1 (LERP_SIZE)
+
| <code>mob.zombie.infect</code>
| Old radius || Double ||
+
|  
|-
+
|-
| New radius || Double ||
+
| 1017
|-
+
| <code>mob.zombie.unfect</code>
| Speed || VarLong ||
+
|  
|-
+
|-
| rowspan=2 | 2 (SET_CENTER)
+
| 1018
| X || Double ||  
+
| <code>mob.enderdragon.end</code>
|-
+
|
| Z || Double ||
+
|-
|-
+
| 1020
| rowspan=8 | 3 (INITIALIZE)
+
| <code>random.anvil_break</code>
| X || Double ||
+
|  
|-
+
|-
| Z || Double ||
+
| 1021
|-
+
| <code>random.anvil_use</code>
| Old radius || Double ||
+
|  
|-
+
|-
| New radius || Double ||
+
| 1022
|-
+
| <code>random.anvil_land</code>
| Speed || VarLong ||
+
|  
|-
+
|-
| Portal Teleport Boundary || VarInt || Resulting coordinates from a portal teleport are limited to +-value. Usually 29999984.
+
!colspan="3"| Particle
|-
+
|-
| Warning time || VarInt ||
+
| 2000
|-
+
| Spawns 10 smoke particles, e.g. from a fire
| Warning blocks || VarInt ||
+
| Direction, see below
|-
+
|-
| rowspan=1 | 4 (SET_WARNING_TIME)
+
| 2001
| Warning time || VarInt ||
+
| Block break
|-
+
| {{Minecraft Wiki|Data values|Block ID}}
| rowspan=1 | 5 (SET_WARNING_BLOCKS)
+
|-
| Warning blocks || VarInt ||
+
| 2002
|}
+
| Splash potion. Particle effect + glass break sound.
 
+
| [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
==== Title ====
+
|-
 
+
| 2003
{| class="wikitable"
+
| Eye of Ender entity break animation — particles and sound
! Packet ID !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
+
|  
|-
+
|-
| rowspan=9 | 0x45 || rowspan=9 | Play || rowspan=9 | Client
+
| 2004
| colspan=2 | Action || VarInt ||
+
| Mob spawn particle effect: smoke + flames
|-
+
|  
! Action !! Name !! !!
+
|-
|-
+
| 2005
| 0 (TITLE) || Text || [[Chat]] ||
+
| Spawn “happy villager” effect (green crosses), used for bonemealing vegetation
|-
+
|  
| 1 (SUBTITLE) || Text || [[Chat]] ||
+
|}
|-
 
| rowspan=3 | 2 (TIMES)
 
| 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 | Client
 
| Threshold || VarInt || Threshold is the max size of a packet before its compressed
 
|}
 
 
 
==== Player List Header/Footer ====
 
  
{| class="wikitable"
+
Smoke directions:
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x47 || rowspan=2 | Play || rowspan=2 | Client
 
| Header || [[Chat]] ||
 
|-
 
| Footer || [[Chat]] ||
 
|}
 
 
 
==== Resource Pack Send ====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! ID
|-
+
! Direction
| rowspan=2 | 0x48 || rowspan=2 | Play || rowspan=2 | Client
+
|-
| URL || String || The URL to the resource pack.
+
| 0
|-
+
| South-East
| 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
+
| 1
|}
+
| South
 
+
|-
==== Update Entity NBT ====
+
| 2
 +
| South-West
 +
|-
 +
| 3
 +
| East
 +
|-
 +
| 4
 +
| (Up or middle ?)
 +
|-
 +
| 5
 +
| West
 +
|-
 +
| 6
 +
| North-East
 +
|-
 +
| 7
 +
| North
 +
|-
 +
| 8
 +
| North-West
 +
|}
  
{| class="wikitable"
+
==== Sound Effect ====
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x49 || rowspan=2 | Play || rowspan=2 | Client
 
| Entity ID || VarInt ||
 
|-
 
| Tag || NBT Tag ||
 
|}
 
  
=== Serverbound ===
+
Used to play a sound effect on the client.
 
 
==== Keep Alive ====
 
  
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
+
Custom sounds may be added by resource packs.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Server
+
! Bound To
| Keep Alive ID || VarInt ||
+
! Field Name
|}
+
! Field Type
 
+
! Notes
==== Chat Message ====
+
|-
 
+
|rowspan="6"| 0x29
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.
+
|rowspan="6"| Play
 
+
|rowspan="6"| Client
For more information, see [[Chat]].
+
| Sound name
 +
| String
 +
| All known sound effect names can be seen [https://github.com/SirCmpwn/Craft.Net/blob/master/source/Craft.Net.Common/SoundEffect.cs here]
 +
|-
 +
| Effect position X
 +
| 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
 +
|}
  
{| class="wikitable"
+
==== Particle ====
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x01 || rowspan=1 | Play || rowspan=1 | Server
 
| Message || String ||
 
|}
 
  
==== Use Entity ====
+
Displays the named particle
 
 
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"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=5 | 0x02 || rowspan=5 | Play || rowspan=5 | Server
+
! Bound To
| Target || VarInt ||
+
! Field Name
|-
+
! Field Type
| Type || VarInt || 0 = INTERACT, 1 = ATTACK, 2 = INTERACT_AT
+
! Notes
|-
+
|-
| Target X || Float || Only if Type == INTERACT_AT
+
|rowspan="11"| 0x2A
|-
+
|rowspan="11"| Play
| Target Y || Float || Only if Type == INTERACT_AT
+
|rowspan="11"| Client
|-
+
| Particle ID
| Target Z || Float || Only if Type == INTERACT_AT
+
| Int
|}
+
| See below
 
+
|-
==== Player ====
+
| Long Distance
 
+
| Boolean
This packet is used to indicate whether the player is on ground (walking/swimming), or airborne (jumping/falling).
+
| If true, particle distance increases from 256 to 65536
 +
|-
 +
| X
 +
| Float
 +
| X position of the particle
 +
|-
 +
| Y
 +
| Float
 +
| Y position of the particle
 +
|-
 +
| Z
 +
| Float
 +
| Z position of the particle
 +
|-
 +
| Offset X
 +
| Float
 +
| This is added to the X position after being multiplied by random.nextGaussian()
 +
|-
 +
| Offset Y
 +
| Float
 +
| This is added to the Y position after being multiplied by random.nextGaussian()
 +
|-
 +
| Offset Z
 +
| Float
 +
| This is added to the Z position after being multiplied by random.nextGaussian()
 +
|-
 +
| Particle Data
 +
| Float
 +
| The data of each particle
 +
|-
 +
| Particle Count
 +
| Int
 +
| The number of particles to create
 +
|-
 +
| Data
 +
| Array of VarInt
 +
| Length depends on particle. ICON_CRACK, BLOCK_CRACK, and BLOCK_DUST have lengths of 2, the rest have 0.
 +
|}
  
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.
+
Particle IDs:
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|-
|-
+
! Particle Name
| rowspan=1 | 0x03 || rowspan=1 | Play || rowspan=1 | Server
+
! Particle ID
| On Ground || Bool || True if the client is on the ground, False otherwise
+
|-
|}
+
| explode
 
+
| 0
==== Player Position ====
+
|-
 
+
| largeexplosion
Updates the players XYZ position on the server.
+
| 1
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?)"
+
| hugeexplosion
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"
+
| 2
 
+
|-
{| class="wikitable"
+
| fireworksSpark
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
| 3
|-
+
|-
| rowspan=4 | 0x04 || rowspan=4 | Play || rowspan=4 | Server
+
| bubble
| X || Double || Absolute position
+
| 4
|-
+
|-
| FeetY || Double || Absolute feet position, normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
+
| wake
|-
+
| 5
| Z || Double || Absolute position
+
|-
|-
+
| splash
| On Ground || Bool || True if the client is on the ground, False otherwise
+
| 6
|}
+
|-
 
+
| suspended
==== Player Look ====
+
| 7
 
+
|-
[[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]]
+
| townaura
 
+
| 8
[[File:Yaw.png|thumb|The unit circle of yaw, redrawn]]
+
|-
 
+
| crit
Updates the direction the player is looking in.
+
| 9
 
+
|-
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.
+
| magicCrit
 
+
| 10
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
+
|-
 
+
| smoke
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
+
| 11
  l = x-x0
+
|-
  w = z-z0
+
| largesmoke
  c = sqrt( l*l + w*w )
+
| 12
  alpha1 = -arcsin(l/c)/PI*180
+
|-
  alpha2 = arccos(w/c)/PI*180
+
| mobSpell?
  if alpha2 > 90 then
+
| 13
    yaw = 180 - alpha1
+
|-
  else
+
| instantSpell
    yaw = alpha1
+
| 14
 
+
|-
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
+
| 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
 +
|}
  
You can get a unit vector from a given yaw/pitch via:
+
==== Change Game State ====
  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
 
|-
 
| rowspan=3| 0x05 || rowspan=3 | Play || rowspan=3 | 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.  
+
It appears when a bed can't be used as a spawn point and when the rain state changes.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=6 | 0x06 || rowspan=6 | Play || rowspan=6 | Server
+
! Bound To
| X || Double || Absolute position
+
! Field Name
|-
+
! Field Type
| FeetY || Double || Absolute feet position. Is normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
+
! Notes
|-
+
|-
| Z || Double || Absolute position
+
|rowspan="2"| 0x2B
|-
+
|rowspan="2"| Play
| Yaw || Float || Absolute rotation on the X Axis, in degrees
+
|rowspan="2"| Client
|-
+
| Reason
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
+
| Unsigned Byte
|-
+
| See below
| On Ground || Bool || True if the client is on the ground, False otherwise
+
|-
|}
+
| Value
 
+
| Float
==== Player Digging ====
+
| Depends on reason
 +
|}
  
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.
+
''Reason codes'':
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Code
|-
+
! Effect
| rowspan="3" | 0x07 || rowspan="3" | Play || rowspan="3" | Server
+
! Value
| Status || Byte || The action the player is taking against the block (see below)
+
|-
|-
+
| 0
| Location || Position || Block position
+
| Invalid Bed
|-
+
|
| Face || Byte || The face being hit (see below)
+
|-
|}
+
| 1
 +
| End raining
 +
|  
 +
|-
 +
| 2
 +
| Begin raining
 +
|  
 +
|-
 +
| 3
 +
| Change game mode
 +
| 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
 +
|-
 +
| 4
 +
| Enter credits
 +
|  
 +
|-
 +
| 5
 +
| Demo message
 +
| 0: Show welcome to demo screen, 101: Tell movement controls, 102: Tell jump control, 103: Tell inventory control
 +
|-
 +
| 6
 +
| Arrow hitting player
 +
| Appears to be played when an arrow strikes another player in Multiplayer
 +
|-
 +
| 7
 +
| Fade value
 +
| The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
 +
|-
 +
| 8
 +
| Fade time
 +
| Time in ticks for the sky to fade
 +
|}
 +
 
 +
==== Spawn Global Entity ====
  
Status can (currently) be one of six values:
+
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"
! Meaning !! Value
+
! Packet ID
|-
+
! State
| Started digging || <code>0</code>
+
! Bound To
|-
+
! Field Name
| Cancelled digging || <code>1</code>
+
! Field Type
|-
+
! Notes
| Finished digging || <code>2</code>
+
|-
|-
+
|rowspan="5"| 0x2C
| Drop item stack || <code>3</code>
+
|rowspan="5"| Play
|-
+
|rowspan="5"| Client
| Drop item || <code>4</code>
+
| Entity ID
|-
+
| VarInt
| Shoot arrow / finish eating || <code>5</code>
+
| The EID of the thunderbolt
|}
+
|-
 
+
| Type
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).
+
| Byte
 
+
| The global entity type, currently always 1 for thunderbolt
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.
+
|-
 
+
| X
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.
+
| 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]]
 +
  |}
  
The face can be one of six values, representing the face being hit:
+
==== Open Window ====
  
{| class="wikitable"
+
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.
|-
 
| 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 ====
 
 
{| class="wikitable"
 
{| class="wikitable"
|-
+
! Packet ID
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! State
|-
+
! Bound To
| rowspan=6 | 0x08 || rowspan=6 | Play || rowspan=6 | Server
+
! Field Name
| Location || Position || Block position
+
! Field Type
|-
+
! Notes
| Direction || Byte || The offset to use for block/item placement (see below)
+
|-
|-
+
|rowspan="5"| 0x2D
| Held item || [[Slot_Data|Slot]] ||
+
|rowspan="5"| Play
|-
+
|rowspan="5"| Client
| Cursor position X || Byte || The position of the crosshair on the block
+
| Window ID
|-
+
| Unsigned Byte
| Cursor position Y || Byte ||
+
| A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
|-
+
|-
| Cursor position Z || Byte ||
+
| Window Type
|}
+
| String
In normal operation (ie placing a block), this packet is sent once, with the values set normally.
+
| The window type to use for display. See below
 
+
|-
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.
+
| Window Title
 +
| [[Chat]]
 +
| The title of the window
 +
|-
 +
| Number Of Slots
 +
| Unsigned Byte
 +
| Number of slots in the window (excluding the number of slots in the player inventory)
 +
|-
 +
| Entity ID
 +
| Optional Int
 +
| EntityHorse's EID. Only sent when Window Type is “EntityHorse”
 +
|}
  
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.
+
See [[Inventory#Windows|inventory windows]] for further information.
  
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.
+
==== Close Window ====
  
==== Held Item Change ====
+
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.
  
Sent when the player changes the slot selection
+
Note, notchian clients send a close window packet with Window ID 0 to close their inventory even though there is never an [[#Open Window|Open Window]] packet for inventory.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x09 || rowspan=1 | Play || rowspan=1 | Server
+
! Bound To
| Slot || Short || The slot which the player has selected (0-8)
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
| 0x2E
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Window ID
 +
| Unsigned Byte
 +
| This is the ID of the window that was closed. 0 for inventory.
 +
|}
  
==== Animation ====
+
==== Set Slot ====
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x0A  || rowspan=1 | Play || rowspan=1 | Server
 
|}
 
  
==== Entity Action ====
+
Sent by the server when an item in a slot (in a window) is added/removed.
 
 
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
|-
+
! State
| rowspan="3" | 0x0B || rowspan="3" | Play || rowspan="3" | Server
+
! Bound To
| Entity ID || VarInt || Player ID
+
! Field Name
|-
+
! Field Type
| Action ID || VarInt || The ID of the action, see below.
+
! Notes
|-
+
|-
| Jump Boost || VarInt || Horse jump boost. Ranged from 0 -> 100.
+
|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).
 +
|-
 +
| Slot
 +
| Short
 +
| The slot that should be updated
 +
|-
 +
| Slot Data
 +
| [[Slot Data|Slot]]
 +
|  
 +
|}
  
Action ID can be one of the following values:
+
==== Window Items ====
  
{| class="wikitable"
+
[[File:Inventory-slots.png|thumb|The inventory slots]]
! ID !! Action
 
|-
 
| 0 || Crouch
 
|-
 
| 1 || Uncrouch
 
|-
 
| 2 || Leave bed
 
|-
 
| 3 || Start sprinting
 
|-
 
| 4 || Stop sprinting
 
|-
 
| 5 || Jump with horse
 
|-
 
| 6 || Open inventory
 
|}
 
 
 
==== Steer Vehicle ====
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=3 | 0x0C || rowspan=3 | Play || rowspan=3 | 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.  
+
Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots.
 
 
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
|-
+
! State
| 0x0D || rowspan=1 | Play || rowspan=1 | Server
+
! Bound To
| Window id || byte || This is the id of the window that was closed. 0 for inventory.
+
! Field Name
|}
+
! Field Type
 
+
! Notes
 
+
|-
==== Click Window ====
+
|rowspan="3"| 0x30
 
+
|rowspan="3"| Play
This packet is sent by the player when it clicks on a slot in a window.
+
|rowspan="3"| Client
 
+
| Window ID
{| class="wikitable"
+
| Unsigned Byte
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
| The ID of window which items are being sent for. 0 for player inventory.
|-
+
|-
| rowspan="6" | 0x0E || rowspan=6 | Play || rowspan=6 | Server
+
| Count
| Window ID || Byte || The id of the window which was clicked. 0 for player inventory.
+
| Short
|-
+
| Length of the following array
| Slot || Short || The clicked slot. See below.
+
|-
|-
+
| Slot Data
| Button || Byte || The button used in the click. See below.
+
| Array of [[Slot Data|Slot]]
|-
+
|  
| 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]] ||
 
|}
 
  
 
See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed.
 
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.
+
==== Window Property ====
  
The Action number is actually a counter, starting at 1.  This number is used by the server as a transaction ID to send back a [[#0x6A|Transaction packet]].
 
 
The distinct type of click performed by the client is determined by the combination of the "Mode" and "Button" fields.
 
 
{| class="wikitable"
 
{| class="wikitable"
! Mode !! Button !! Slot !! Trigger
+
! Packet ID
|-
+
! State
! rowspan="2" | 0
+
! Bound To
| 0 || Normal || Left mouse click
+
! Field Name
|-
+
! Field Type
| 1 || Normal || Right mouse click
+
! Notes
|-
+
|-
! rowspan="2" | 1
+
|rowspan="3"| 0x31
| 0 || Normal || Shift + left mouse click
+
|rowspan="3"| Play
|-
+
|rowspan="3"| Client
| 1 || Normal || Shift + right mouse click ''(Identical behavior)''
+
| Window ID
|-
+
| Unsigned Byte
! rowspan="5" | 2
+
|  
| 0 || Normal || Number key 1
+
|-
|-
+
| Property
| 1 || Normal || Number key 2
+
| Short
|-
+
| The property to be updated, see below
| 2 || Normal || Number key 3
+
|-
|-
+
| Value
| ...
+
| Short
| ...
+
| The new value for the property, see below
| ...
+
|}
|-
 
| 8 || Normal || Number key 9
 
|-
 
! rowspan="1" | 3
 
| 2 || Normal || Middle click
 
|-
 
! rowspan="4" | 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)''
 
|-
 
! rowspan="6" | 5
 
| 0 || -999 || Starting left mouse drag ''(Or middle mouse)''
 
|-
 
| 4 || -999 || Starting right mouse drag
 
|-
 
| 1 || Normal || Add slot for left-mouse drag
 
|-
 
| 5 || Normal || Add slot for right-mouse drag
 
|-
 
| 2 || -999 || Ending left mouse drag
 
|-
 
| 6 || -999 || Ending right mouse drag
 
|-
 
! 6
 
| 0 || Normal || Double click
 
|}
 
 
 
Starting from version 1.5, "painting mode" is available for use in inventory windows. It is done by picking up stack of something (more than 1 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);
 
  
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.
+
'''Furnace'''
  
==== Confirm Transaction ====
+
Properties:
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan="3" | 0x0F || rowspan=3 | Play || rowspan=3 | Server
 
| Window ID || Byte || The id of the window that the action occurred in.
 
|-
 
| Action number || Short || Every action that is to be accepted has a unique number. This field corresponds to that number.
 
|-
 
| Accepted || Bool || Whether the action was accepted.
 
|}
 
  
==== Creative Inventory Action ====
+
* 0: Progress arrow
 +
* 1: Fire icon (fuel)
  
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:
+
Values:
  
* If an item is dropped into the quick bar
+
* 0–200 for progress arrow
* If an item is picked up from the quick bar (item id is -1)
+
* 0–200 for fuel indicator
  
{| class="wikitable"
+
Ranges are presumably in in-game ticks
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan="2" | 0x10 || rowspan=2 | Play || rowspan=2 | Server
 
| Slot || Short || Inventory slot
 
|-
 
| Clicked item || [[Slot_Data|Slot]] ||
 
|}
 
  
==== Enchant Item ====
+
'''Enchantment Table'''
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan="2" | 0x11 || rowspan=2 | Play || rowspan=2 | Server
 
| 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.
 
|}
 
  
==== Update Sign ====
+
Properties: 0, 1 or 2 depending on the “enchantment slot” being given.
  
This message is sent from the client to the server when the "Done" button is pushed after placing a sign.  
+
Values: The enchantment's level.
  
{| class="wikitable"
+
'''Beacon'''
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=5 | 0x12 || rowspan=5 | Play || rowspan=5 | 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 ====
+
* 0: Power level
 +
* 1: Potion effect one
 +
* 2: Potion effect two
  
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.
+
'''Anvil'''
 
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"
+
* 0: Maximum cost
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan="3" | 0x13 || rowspan=3 | Play || rowspan=3 | Server
 
| Flags || Byte ||
 
|-
 
| Flying speed || Float|| previous integer value divided by 250
 
|-
 
| Walking speed || Float || previous integer value divided by 250
 
|}
 
  
==== Tab-Complete ====
+
'''Brewing Stand'''
  
Sent when the user presses [tab] while writing text. The payload contains all text behind the cursor.
+
* 0: Brew time
  
{| class="wikitable"
+
Brew time is a value between 0 and 400, with 400 making the arrow empty, and 0 making the arrow full.
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=3 | 0x14  || rowspan=3 | Play || rowspan=3 | 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 ====
+
==== Confirm Transaction ====
  
Sent when the player connects, or when settings are changed.
+
A packet from the server indicating whether a request from the client was accepted, or whether there was a conflict (due to lag). This packet is also sent from the client to the server in response to a server transaction rejection packet.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=5 | 0x15 || rowspan=5 | Play || rowspan=5 | Server
+
! Bound To
| Locale || String || en_GB
+
! Field Name
|-
+
! Field Type
| View distance || Byte || Client-side render distance(chunks)
+
! Notes
|-
+
|-
| Chat flags || Byte || Chat settings. See notes below.
+
|rowspan="3"| 0x32
|-
+
|rowspan="3"| Play
| Chat colours || Bool || "Colours" multiplayer setting
+
|rowspan="3"| Client
|-
+
| Window ID
| Displayed skin parts || Unsigned Byte || Skin parts. See note below
+
| Byte
|}
+
| The ID of the window that the action occurred in
 
+
|-
Chat flags has several values packed into one byte.
+
| Action Number
 
+
| Short
'''Chat Enabled:''' Bits 0-1. 00: Enabled.  01: Commands only.  10: Hidden.
+
| Every action that is to be accepted has a unique number. This field corresponds to that number.
 
+
|-
Displayed skin parts also packs several values into one byte.
+
| Accepted
 
+
| Boolean
Bit 0: Cape enabled
+
| Whether the action was accepted
 
+
|}
Bit 1: Jacket enabled
 
  
Bit 2: Left Sleeve enabled
+
==== Update Sign ====
  
Bit 3: Right Sleeve enabled
+
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.
  
Bit 4: Left Pants Leg enabled
+
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="5"| 0x33
 +
|rowspan="5"| Play
 +
|rowspan="5"| Client
 +
| Location
 +
| Position
 +
|
 +
|-
 +
| 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
 +
|}
  
Bit 5: Right Pants Leg enabled
+
==== Maps ====
  
Bit 6: Hat enabled
+
{| class="wikitable"
 
+
! Packet ID
The most significant bit (bit 7) appears to be unused.
+
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="10"| 0x34
 +
|rowspan="10"| Play
 +
|rowspan="10"| Client
 +
| Item Damage
 +
| VarInt
 +
| The damage value of the map being modified
 +
|-
 +
| Scale
 +
| Byte
 +
|
 +
|-
 +
| Icons Length
 +
| VarInt
 +
| Length of the following array
 +
|-
 +
| Icons
 +
| Array of (Byte, Byte, Byte)
 +
| First byte, 0xF0 = Direction, 0x0F = Type. Second byte, X. Third byte, Y
 +
|-
 +
| Columns
 +
| Byte
 +
|
 +
|-
 +
| Rows
 +
| Optional Byte
 +
| Only if Columns is more than 0
 +
|-
 +
| X
 +
| Optional Byte
 +
| Only if Columns is more than 0
 +
|-
 +
| Y
 +
| Optional Byte
 +
| Only if Columns is more than 0
 +
|-
 +
| Length
 +
| Optional VarInt
 +
| Only if Columns is more than 0; length of the following array
 +
|-
 +
| Data
 +
| Optional Array of Byte
 +
| Only if Columns is more than 0
 +
|}
  
==== Client Status ====
+
==== Update Block Entity ====
  
Sent when the client is ready to complete login and when the client is ready to respawn after death.
+
Essentially a block update on a block entity.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x16 || rowspan=1 | Play || rowspan=1 | Server
+
! Bound To
| Action ID || VarInt || See below
+
! Field Name
|}
+
! Field Type
 
+
! Notes
Action ID values:
+
|-
{| class="wikitable"
+
|rowspan="3"| 0x35
|-
+
|rowspan="3"| Play
! Action ID !! Name
+
|rowspan="3"| Client
|-
+
| Location
| 0 || Perform respawn
+
| Position
|-
+
|  
| 1 || Request stats
+
|-
|-
+
| Action
| 2 || Open inventory achievement
+
| Unsigned Byte
|}
+
| The type of update to perform, see below
 +
|-
 +
| NBT Data
 +
| Optional [[NBT|NBT Tag]]
 +
| If not present then it's a TAG_END (0)
 +
|}
  
==== Plugin Message ====
+
''Action'' field:
  
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>.
+
* '''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
  
More documentation on this: http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/
+
==== Sign Editor Open ====
  
Note that the data length is known from the packet length, so there is no need for a length member being sent.
+
Sent on placement of sign.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x17 || rowspan=2 | Play || rowspan=2 | Server
+
! Bound To
| Channel || String || Name of the "channel" used to send the data.
+
! Field Name
|-
+
! Field Type
| Data || Byte Array || Any data.
+
! Notes
|}
+
|-
 
+
|rowspan="1"| 0x36
==== Spectate ====
+
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Location
 +
| Position
 +
|  
 +
|}
  
{| class="wikitable"
+
==== Statistics ====
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x18 || rowspan=1 | Play || rowspan=1 | Server
 
| Target Player || UUID ||
 
|}
 
 
 
==== Resource Pack Status ====  
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Server
+
! Bound To  
| Hash || String || The hash sent in the [[#Resource Pack Send|Resource Pack Send]] packet.
+
!colspan="2"| Field Name
|-
+
!colspan="2"| Field Type
| Result || VarInt || Successfully loaded: 0, Declined: 1, Failed download: 2, Accepted: 3
+
! Notes
|}
+
|-
 +
|rowspan="3"| 0x37
 +
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
|colspan="2"| Count
 +
|colspan="2"| VarInt
 +
| Length of the following array
 +
|-
 +
|rowspan="2"| Statistic
 +
| Name
 +
|rowspan="2"| Array
 +
| String
 +
| [https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0 https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0]
 +
|-
 +
| Value
 +
| VarInt
 +
| The amount to set it to
 +
  |}
  
== Status ==
+
==== Player List Item ====
The status ping works as follows.
 
    C->S : Handshake State=1
 
    C->S : Request
 
    S->C : Response
 
    C->S : Ping
 
    S->C : Ping
 
  
=== Clientbound ===
+
Sent by the notchian server to update the user list (<tab> in the client).
  
==== Response ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x00 || rowspan=1 | Status || rowspan=1 | Client
+
! Bound To
| JSON Response || String || https://gist.github.com/thinkofdeath/6927216
+
!colspan="4"| Field Name
|}
+
!colspan="3"| Field Type
 
+
! Notes
 
+
|-
==== Ping ====
+
|rowspan="19"| 0x38
{| class="wikitable"
+
  |rowspan="19"| Play
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|rowspan="19"| Client
|-
+
|colspan="4"| Action
| rowspan=1 | 0x01 || rowspan=1 | Status || rowspan=1 | Client
+
|colspan="3"| VarInt
| Time || Long || Should be the same as sent by the client
+
| Determines the rest of the Player format after the UUID
|}
+
|-
 
+
|colspan="4"| Number Of Players
=== Serverbound ===
+
|colspan="3"| VarInt
 
+
| Length of the following array
==== Request ====
+
|-
{| class="wikitable"
+
|rowspan="17"| Player
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
|colspan="3"| UUID
|-
+
|rowspan="17"| Array
| rowspan=1 | 0x00 || Status || Server || || ||
+
|colspan="2"| UUID
|}
+
|
 
+
|-
 
+
! Action
==== Ping ====
+
!colspan="2"| Field Name
{| class="wikitable"
+
!colspan="2"|
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
!  
|-
+
|-
| rowspan=1 | 0x01 || rowspan=1 | Status || rowspan=1 | Server
+
|rowspan="10"| 0: add player
| Time || Long ||
+
  |colspan="2"| Name
|}
+
|colspan="2"| String
 
+
|  
== Login ==
+
|-
 
+
|colspan="2"| Number Of Properties
The login process is as follows:
+
|colspan="2"| VarInt
    C->S : Handshake State=2
+
| Length of the following array
    C->S : Login Start
+
|-
    S->C : Encryption Key Request
+
|rowspan="4"| Property
    (Client Auth)
+
| Name
    C->S : Encryption Key Response
+
|rowspan="4"| Array
    (Server Auth, Both enable encryption)
+
| String
    S->C : Login Success
+
|
 +
|-
 +
| Value
 +
| String
 +
|  
 +
|-
 +
| Is Signed
 +
| Boolean
 +
|  
 +
|-
 +
| Signature
 +
| Optional String
 +
| Only if Is Signed is true
 +
|-
 +
|colspan="2"| Gamemode
 +
|colspan="2"| VarInt
 +
|
 +
|-
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
|
 +
|-
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
|colspan="2"| Optional [[Chat]]
 +
| Only if Has Diplay Name is true
 +
|-
 +
| 1: update gamemode
 +
|colspan="2"| Gamemode
 +
  |colspan="2"| VarInt
 +
|  
 +
|-
 +
| 2: update latency
 +
|colspan="2"| Ping
 +
|colspan="2"| VarInt
 +
|  
 +
|-
 +
|rowspan="2"| 3: update display name
 +
|colspan="2"| Has Display Name
 +
|colspan="2"| Boolean
 +
|
 +
|-
 +
|colspan="2"| Display Name
 +
|colspan="2"| Optional [[Chat]]
 +
| Only send if Has Diplay Name is true
 +
|-
 +
| 4: remove player
 +
|colspan="2"| ''no fields''
 +
|colspan="2"|
 +
|
 +
|}
  
For unauthenticated and* localhost connections there is no encryption.
+
==== Player Abilities ====
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.
+
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.
  
See [[Protocol Encryption]] for details.
+
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).
  
=== Clientbound ===
+
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.
  
==== Disconnect ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x00 || rowspan=1 | Login || rowspan=1 | Client
+
! Bound To
| JSON Data || String ||
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="3"| 0x39
 +
|rowspan="3"| Play
 +
|rowspan="3"| Client
 +
| Flags
 +
| Byte
 +
| Bit mask, see above
 +
|-
 +
| Flying Speed
 +
| Float
 +
|  
 +
|-
 +
| Walking Speed
 +
| Float
 +
|  
 +
|}
  
==== Encryption Request ====
+
==== Tab-Complete ====
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=5 | 0x01  || rowspan=5 | Login || rowspan=5 | 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.
+
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.
  
==== Login Success ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=2 | 0x02 || rowspan=2 | Login || rowspan=2 | Client
+
! Bound To
| UUID || String ||
+
! Field Name
|-
+
! Field Type
| Username || String ||
+
! Notes
|}
+
|-
 
+
|rowspan="2"| 0x3A
==== Set Compression ====
+
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Count
 +
| VarInt
 +
| Length of the following array
 +
|-
 +
| Matches
 +
| Array of String
 +
| One eligible command, note that each command is sent separately instead of in a single string, hence the need for Count
 +
|}
 +
 
 +
==== Scoreboard Objective ====
 +
 
 +
This is sent to the client when it should create a new {{Minecraft Wiki|scoreboard}} objective or remove one.
  
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=1 | 0x03 || rowspan=1 | Login || rowspan=1 | Client
+
! Bound To
| Threshold || VarInt || Threshold is the max size of a packet before its compressed
+
! Field Name
|}
+
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="4"| 0x3B
 +
|rowspan="4"| Play
 +
|rowspan="4"| Client
 +
| Objective Name
 +
| String
 +
| An unique name for the objective
 +
|-
 +
| Mode
 +
| Byte
 +
| 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
 +
|-
 +
| Objective Value
 +
| Optional String
 +
| Only if mode is 0 or 2. The text to be displayed for the score
 +
|-
 +
| Type
 +
| Optional String
 +
| Only if mode is 0 or 2. “integer” or “hearts”
 +
|}
  
=== Serverbound ===
+
==== Update Score ====
  
==== Login Start  ====
+
This is sent to the client when it should update a scoreboard item.
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x00 || rowspan=1 | Login || rowspan=1 | Server
 
| Name || String ||
 
|}
 
  
==== Encryption Response ====
 
 
{| class="wikitable"
 
{| class="wikitable"
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
+
! Packet ID
|-
+
! State
| rowspan=4 | 0x01 || rowspan=4 | Login || rowspan=4 | Server
+
! Bound To
| Length || VarInt || length of shared secret
+
! Field Name
|-
+
! Field Type
| Shared Secret || Byte array ||  
+
! Notes
|-
+
|-
| Length || VarInt || length of verify token
+
|rowspan="4"| 0x3C
|-
+
|rowspan="4"| Play
| Verify Token || Byte array ||
+
|rowspan="4"| Client
|-  
+
| Score Name
|}
+
| String
 +
| The name of the score to be updated or removed
 +
|-
 +
| Action
 +
| Byte
 +
| 0 to create/update an item. 1 to remove an item.
 +
|-
 +
| Objective Name
 +
| String
 +
| The name of the objective the score belongs to
 +
|-
 +
| Value
 +
| Optional VarInt
 +
| The score to be displayed next to the entry. Only sent when Action does not equal 1.
 +
|}
 +
 
 +
==== Display Scoreboard ====
 +
 
 +
This is sent to the client when it should display a scoreboard.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x3D
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Position
 +
| Byte
 +
| The position of the scoreboard. 0: list, 1: sidebar, 2: below name.
 +
|-
 +
| Score Name
 +
| String
 +
| The unique name for the scoreboard to be displayed.
 +
|}
 +
 
 +
==== Teams ====
 +
 
 +
Creates and updates teams.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="10"| 0x3E
 +
|rowspan="10"| Play
 +
|rowspan="10"| 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
 +
| Optional String
 +
| Only if Mode = 0 or 2.
 +
|-
 +
| Team Prefix
 +
| Optional String
 +
| Only if Mode = 0 or 2. Displayed before the players' name that are part of this team
 +
|-
 +
| Team Suffix
 +
| Optional String
 +
| Only if Mode = 0 or 2. Displayed after the players' name that are part of this team
 +
|-
 +
| Friendly Fire
 +
| Optional Byte
 +
| Only if Mode = 0 or 2. 0 for off, 1 for on, 3 for seeing friendly invisibles
 +
|-
 +
| Name Tag Visibility
 +
| Optional String
 +
| Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never
 +
|-
 +
| Color
 +
| Optional Byte
 +
| Only if Mode = 0 or 2. Same as [[Chat]] colors
 +
|-
 +
| Player Count
 +
| Optional VarInt
 +
| Only if Mode = 0 or 3 or 4. Number of players in the array
 +
|-
 +
| Players
 +
| Optional Array of String
 +
| 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 channel]]s. These internal channels are prefixed with <code>MC|</code>.
 +
 
 +
More documentation on this: [http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/]
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x3F
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Channel
 +
| String
 +
| Name of the [[plugin channel]] used to send the data
 +
|-
 +
| Data
 +
| Byte Array
 +
| Any data, depending on the channel. <code><nowiki>MC|</nowiki></code> channels are documented [[plugin channel|here]].
 +
|}
 +
 
 +
==== Disconnect ====
 +
 
 +
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
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| 0x40
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Reason
 +
| [[Chat]]
 +
| Displayed to the client when the connection terminates.
 +
|}
 +
 
 +
==== Server Difficulty ====
 +
 
 +
Changes the difficulty setting in the client's option menu
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x41
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Difficulty
 +
| Unsigned Byte
 +
| 0: peaceful, 1: easy, 2: normal, 3: hard
 +
|}
 +
 
 +
==== Combat Event ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="6"| 0x42
 +
|rowspan="6"| Play
 +
|rowspan="6"| Client
 +
| Event
 +
| VarInt
 +
| 0: enter combat, 1: end combat, 2: entity dead
 +
|-
 +
| Duration
 +
| Optional VarInt
 +
| Only for end combat
 +
|-
 +
| Player ID
 +
| Optional VarInt
 +
| Only for entity dead
 +
|-
 +
| Entity ID
 +
| Optional Int
 +
| Only for end combat and entity dead
 +
|-
 +
| Message
 +
| String
 +
| Only for entity dead
 +
|}
 +
 
 +
==== Camera ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x43
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Camera ID
 +
| VarInt
 +
|
 +
|}
 +
 
 +
==== World Border ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="18"| 0x44
 +
|rowspan="18"| Play
 +
|rowspan="18"| Client
 +
|colspan="2"| Action
 +
| VarInt
 +
| Determines the format of the rest of the packet
 +
|-
 +
! Action
 +
! Field Name
 +
!
 +
!
 +
|-
 +
| 0: set size
 +
| Radius
 +
| Double
 +
| meters
 +
|-
 +
|rowspan="3"| 1: lerp size
 +
| Old Radius
 +
| Double
 +
| meters
 +
|-
 +
| New Radius
 +
| Double
 +
| meters
 +
|-
 +
| Speed
 +
| VarLong
 +
| number of real-time ticks/seconds (?) until New Radius is reached. From experiments, it appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag
 +
|-
 +
|rowspan="2"| 2: set center
 +
| X
 +
| Double
 +
|
 +
|-
 +
| Z
 +
| Double
 +
|
 +
|-
 +
|rowspan="8"| 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
 +
|
 +
|-
 +
|rowspan="1"| 4: set warning time
 +
| Warning Time
 +
| VarInt
 +
| unit?
 +
|-
 +
|rowspan="1"| 5: set warning blocks
 +
| Warning Blocks
 +
| VarInt
 +
|
 +
|}
 +
 
 +
==== Title ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
!colspan="2"| Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="9"| 0x45
 +
|rowspan="9"| Play
 +
|rowspan="9"| Client
 +
|colspan="2"| Action
 +
| VarInt
 +
|
 +
|-
 +
! Action
 +
! Field Name
 +
!
 +
!
 +
|-
 +
| 0: set title
 +
| Title Text
 +
| [[Chat]]
 +
|
 +
|-
 +
| 1: set subtitle
 +
| Subtitle Text
 +
| [[Chat]]
 +
|
 +
|-
 +
|rowspan="3"| 2: set times and display
 +
| Fade In
 +
| Int
 +
| ticks
 +
|-
 +
| Stay
 +
| Int
 +
| ticks
 +
|-
 +
| Fade Out
 +
| Int
 +
| ticks
 +
|-
 +
| 3: hide
 +
| ''no fields''
 +
|
 +
|
 +
|-
 +
| 4: reset
 +
| ''no fields''
 +
|
 +
|
 +
|}
 +
 
 +
“Hide” makes the title disappear, but if you run times again the same title will appear. “Reset” erases the text.
 +
 
 +
==== Set Compression ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x46
 +
|rowspan="1"| Play
 +
|rowspan="1"| Client
 +
| Threshold
 +
| VarInt
 +
| Threshold is the max size of a packet before its compressed
 +
|}
 +
 
 +
==== Player List Header/Footer ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x47
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Header
 +
| [[Chat]]
 +
|
 +
|-
 +
| Footer
 +
| [[Chat]]
 +
|
 +
|}
 +
 
 +
==== Resource Pack Send ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x48
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| URL
 +
| String
 +
| The URL to the resource pack.
 +
|-
 +
| Hash
 +
| String
 +
| A 40 character hexadecimal and lowercase [[wikipedia:SHA-1|SHA-1] hash of the resource pack file. (must be lower case in order to work)<br />If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth — but it will still treat it as a unique id
 +
|}
 +
 
 +
==== Update Entity NBT ====
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="2"| 0x49
 +
|rowspan="2"| Play
 +
|rowspan="2"| Client
 +
| Entity ID
 +
| VarInt
 +
|
 +
|-
 +
| Tag
 +
| [[NBT|NBT Tag]]
 +
|
 +
|}
 +
 
 +
=== Serverbound ===
 +
 
 +
==== Keep Alive ====
 +
 
 +
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x00
 +
|rowspan="1"| Play
 +
|rowspan="1"| 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.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x01
 +
|rowspan="1"| Play
 +
|rowspan="1"| Server
 +
| Message
 +
| [[Chat]]
 +
|
 +
|}
 +
 
 +
==== 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|Creative Inventory Action]] packet instead.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="5"| 0x02
 +
|rowspan="5"| Play
 +
|rowspan="5"| Server
 +
| Target
 +
| VarInt
 +
|
 +
|-
 +
| Type
 +
| VarInt
 +
| 0: interact, 1: attack, 2: interact at
 +
|-
 +
| Target X
 +
| Optional Float
 +
| Only if Type is interact at
 +
|-
 +
| Target Y
 +
| Optional Float
 +
| Only if Type is interact at
 +
|-
 +
| Target Z
 +
| Optional Float
 +
| Only if Type is interact at
 +
|}
 +
 
 +
==== Player ====
 +
 
 +
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
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="1"| 0x03
 +
|rowspan="1"| Play
 +
|rowspan="1"| Server
 +
| On Ground
 +
| Boolean
 +
| True if the client is on the ground, false otherwise
 +
|}
 +
 
 +
==== Player Position ====
 +
 
 +
Updates the player's XYZ 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, this 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
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="4"| 0x04
 +
|rowspan="4"| Play
 +
|rowspan="4"| Server
 +
| X
 +
| Double
 +
| Absolute position
 +
|-
 +
| Feet Y
 +
| Double
 +
| Absolute position, normally Head Y - 1.62
 +
|-
 +
| Z
 +
| Double
 +
| Absolute position
 +
|-
 +
| On Ground
 +
| Boolean
 +
| True if the client is on the ground, false otherwise
 +
|}
 +
 
 +
==== Player Look ====
 +
[[File:Minecraft-trig-yaw.png|thumb|The unit circle for yaw]]
 +
[[File:Yaw.png|thumb|The unit circle of yaw, redrawn]]
 +
 
 +
Updates the direction the player is looking in.
 +
 
 +
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0,-1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
 +
 
 +
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 +
 
 +
The yaw of player (in degrees), standing at point (x0, z0) and looking towards point (x, z) one can be calculated with:
 +
 
 +
l = x-x0
 +
w = z-z0
 +
c = sqrt( l*l + w*w )
 +
alpha1 = -arcsin(l/c)/PI*180
 +
alpha2 =  arccos(w/c)/PI*180
 +
if alpha2 > 90 then
 +
    yaw = 180 - alpha1
 +
else
 +
    yaw = alpha1
 +
 
 +
You can get a unit vector from a given yaw/pitch via:
 +
 
 +
x = -cos(pitch) * sin(yaw)
 +
y = -sin(pitch)
 +
z =  cos(pitch) * cos(yaw)
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="3"| 0x05
 +
|rowspan="3"| Play
 +
|rowspan="3"| Server
 +
| Yaw
 +
| Float
 +
| Absolute rotation on the X Axis, in degrees
 +
|-
 +
| Pitch
 +
| Float
 +
| Absolute rotation on the Y Axis, in degrees
 +
|-
 +
| On Ground
 +
| Boolean
 +
| True if the client is on the ground, False otherwise
 +
|}
 +
 
 +
==== Player Position And Look ====
 +
 
 +
A combination of [[#Player Look|Player Look]] and [[#Player Position|Player Position]].
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="6"| 0x06
 +
|rowspan="6"| Play
 +
|rowspan="6"| Server
 +
| X
 +
| Double
 +
| Absolute position
 +
|-
 +
| Feet Y
 +
| Double
 +
| Absolute feet position, normally Head Y - 1.62
 +
|-
 +
| Z
 +
| Double
 +
| Absolute position
 +
|-
 +
| Yaw
 +
| Float
 +
| Absolute rotation on the X Axis, in degrees
 +
|-
 +
| Pitch
 +
| Float
 +
| Absolute rotation on the Y Axis, in degrees
 +
|-
 +
| On Ground
 +
| Boolean
 +
| True if the client is on the ground, false otherwise
 +
|}
 +
 
 +
==== Player 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
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="3"| 0x07
 +
|rowspan="3"| Play
 +
|rowspan="3"| 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:
 +
 
 +
{| class="wikitable"
 +
! Meaning
 +
! Value
 +
|-
 +
| Started digging
 +
| <code>0</code>
 +
|-
 +
| Cancelled digging
 +
| <code>1</code>
 +
|-
 +
| Finished digging
 +
| <code>2</code>
 +
|-
 +
| Drop item stack
 +
| <code>3</code>
 +
|-
 +
| Drop item
 +
| <code>4</code>
 +
|-
 +
| 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).
 +
 
 +
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:
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Value
 +
| 0
 +
| 1
 +
| 2
 +
| 3
 +
| 4
 +
| 5
 +
|-
 +
! Offset
 +
| -Y
 +
| +Y
 +
| -Z
 +
| +Z
 +
| -X
 +
| +X
 +
|}
 +
 
 +
==== Player Block Placement ====
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="6"| 0x08
 +
|rowspan="6"| Play
 +
|rowspan="6"| Server
 +
| Location
 +
| Position
 +
| Block position
 +
|-
 +
| Direction
 +
| Byte
 +
| The offset to use for block/item placement (see below)
 +
|-
 +
| Held Item
 +
| [[Slot Data|Slot]]
 +
|
 +
|-
 +
| Cursor Position X
 +
| Byte
 +
| The position of the crosshair on the block
 +
|-
 +
| Cursor Position Y
 +
| Byte
 +
|
 +
|-
 +
| Cursor Position Z
 +
| Byte
 +
|
 +
|}