Difference between revisions of "Pre-release protocol"

From wiki.vg
Jump to navigation Jump to search
m
(1.8 is released)
Line 1: Line 1:
This page documents the changes from the [[Protocol|last stable Minecraft release]] (currently 1.7.4, protocol 4) to the current pre-release. Note that this page contains bleeding-edge information that may not be completely or correctly documented.
+
This page documents the changes from the [[Protocol|last stable Minecraft release]] (currently 1.8, protocol 47) to the current pre-release. Note that this page contains bleeding-edge information that may not be completely or correctly documented.
 
He who wishes to commandeer the merging of this into [[Protocol]] when an update is made must be sure to respect any changes that may have occured to the respective packets there.
 
He who wishes to commandeer the merging of this into [[Protocol]] when an update is made must be sure to respect any changes that may have occured to the respective packets there.
  
 
== Protocol History ==
 
== Protocol History ==
 
=== 1.8 ===
 
 
=== 1.8-pre3 ===
 
 
=== 1.8-pre2 ===
 
 
=== 1.8-pre1 ===
 
 
* New metadata type, 7, 12 bytes(3 floats?), used on armor stand
 
 
=== 14w34a/b/c/d ===
 
 
=== 14w33a/b/c ===
 
 
* Added new fields to Tab-Complete (Serverbound)
 
 
=== 14w32a/b/c/d ===
 
 
* Added new Update Entity NBT packet
 
* Added three new fields to Use Entity
 
 
=== 14w31a ===
 
 
* The length prefix on the payload of Plugin Message has been removed (Both ways)
 
* Added new Resource Pack Send packet
 
* Added new Resource Pack Status packet
 
* Added VarLong data type
 
* Changed a few fields in World Border to VarLong
 
* Changed the type of Keep Alive ID from Int to VarInt (Clientbound)
 
 
=== 14w30c ===
 
 
=== 14w30a/b ===
 
 
=== 14w29a ===
 
 
* Fix the length prefix of Plugin Message so that its a Varint instead of an unsigned short
 
* Added "Reduced Debug Info" boolean to Join Game
 
* Added "Long Distance" boolean to Particle
 
 
=== 14w28b ===
 
 
* Uncompressed NBT
 
* Added Display name fields to Player List Item
 
* New 'Player List Header/Footer' packet
 
 
=== 14w28a ===
 
 
* Changed Chunk packets to remove compression
 
* Added packets to toggle compression/set threshold
 
* Allowed compression for the whole protocol
 
* Changed the Maps packet
 
 
=== 14w27a/b ===
 
 
=== 14w26c ===
 
 
* Changed Multi Block Change to using packed block ids
 
* Changed Block Change to using packed block ids
 
 
=== 14w26b ===
 
 
* Bug fix
 
 
=== 14w26a ===
 
 
* Changed chunk sending
 
 
=== 14w25b ===
 
 
* Added boolean field to all entity movement packets
 
 
=== 14w25a ===
 
 
* Update Sign now uses [[Chat]]
 
 
=== 14w21a ===
 
 
* All byte arrays have VarInt length prefixes instead of short
 
* Spawn Player changes
 
* Player list item changes
 
 
=== 14w20a ===
 
 
* Added new packet 'Title'
 
 
=== 14w19a ===
 
 
* Changed the Particle's 'Particle Name' to an int
 
* Added a new field to Particle
 
* Rewrote Player List Item
 
* Added SET_WARNING_TIME and SET_WARNING_BLOCKS to World Border
 
* Added new serverbound packet Spectate
 
 
=== 14w18b ===
 
* Bugfix
 
 
=== 14w18a ===
 
* Added 'INITIALIZE' action to World Border
 
 
=== 14w17a ===
 
* Increased the max payload size of 'Plugin Message' from 32767 to 1048576 (Broken because of incorrect data type)
 
* Added new packet 'World Border'
 
 
=== 14w11a ===
 
* UUIDs now include the '-'s
 
 
=== 14w08a ===
 
* Added new field 'Type' to Scoreboard Objective
 
 
=== 14w07a ===
 
* Added two new fields to Teams
 
 
=== 14w06a ===
 
 
==== Clientbound ====
 
* Added new field 'Hide Particles' to Entity Effect
 
 
==== Serverbound ====
 
* Removed 'HeadY' from Player Position
 
* Removed 'HeadY' from Player Position And Look
 
 
=== 14w05a ===
 
 
==== Clientbound ====
 
* New packet 'Camera'
 
 
=== 14w04b ===
 
 
* Spawn Painting now uses the 'Position' data type
 
* Changed Spawn Painting's Direction type to Unsigned Byte
 
 
=== 14w04a ===
 
 
* Encoding for 'Position' changed
 
==== Clientbound ====
 
* Changed Entity Equipment's EntityId type to VarInt
 
* Changed Update Health's Food type to VarInt
 
* Changed Use Bed's EntityId type to VarInt
 
* Added new fields to Spawn Player
 
* Changed Collect Item's EntityId(s) types to VarInt
 
* Changed Entity Velocity's EntityId type to VarInt
 
* Changed Destroy Entities' Length type to VarInt
 
* Changed Destroy Entities' EntityIds type to VarInt array
 
* Changed Entity's EntityId type to VarInt
 
* Changed Entity Relative Move's EntityId type to VarInt
 
* Changed Entity Look's EntityId type to VarInt
 
* Changed Entity Look and Relative Move's EntityId type to VarInt
 
* Changed Entity Teleport's EntityId type to VarInt
 
* Changed Entity Head Look's EntityId type to VarInt
 
* Changed Entity Metadata's EntityId type to Varint
 
* Changed Entity Effect's EntityId type to VarInt
 
* Changed Entity Effect's Duration type to VarInt
 
* Changed Remove Entity Effect's EntityId type to VarInt
 
* Changed Set Experience's Level type to VarInt
 
* Changed Set Experience's Total Experience type to VarInt
 
* Changed Entity Properties's EntityId type to VarInt
 
* Changed Entity Properties's List Length type to VarInt
 
* Changed Player List Item's Ping type to VarInt
 
* Changed Update Score's Value type to VarInt
 
* Changed Teams' Player count type to VarInt
 
* New packet 'Combat Event'
 
==== Serverbound ====
 
* Changed Keep Alive's Keep Alive ID type to VarInt
 
* Changed Use Entity's Target type to VarInt
 
* Changed Use Entity's Mouse type to Unsigned Byte
 
* Removed everything from Animation
 
* Changed Entity Action's EntityId type to VarInt
 
* Changed Entity Action's Action ID type to Unsigned Byte
 
* Changed Entity Action's Values
 
* Changed Entity Action's Jump Boast type to VarInt
 
* Merged Steer Vehicle's Jump and Unmount into a Bit Field
 
* Changed Client Status's Action ID type to Unsigned Byte
 
 
=== 14w03a ===
 
 
* New data type 'Position'
 
==== Clientbound ====
 
* Spawn Position now uses the 'Position' data type
 
* Use Bed now uses the 'Position' data type
 
* Block Change now uses the 'Position' data type
 
* Block Action now uses the 'Position' data type
 
* Block Break Animation now uses the 'Position' data type
 
* Effect now uses the 'Position' data type
 
* Sign Update now uses the 'Position' data type
 
* Update Block Entity now uses the 'Position' data type
 
* Sign Editor Open nows uses the 'Position' data type
 
==== Serverbound ====
 
* Player Digging now uses the 'Position' data type
 
* Player Block Placement now uses the 'Position' data type
 
* Update Sign now uses the 'Position' data type
 
* Client Settings 'show cape' type changed from boolean to unsigned byte
 
 
=== 14w02a ===
 
 
* Added 'Position' to Chat Message Clientbound
 
* Remove Player Position And Look's 'OnGround' clientbound
 
* Added 'Flags' to Player Position And Look clientbound
 
* Changed Open Inventory's 'Inventory Type' type from byte to string
 
* Added Server Difficulty
 
* Removed Client Settings' 'Difficulty'
 
  
 
== Protocol Version ==
 
== Protocol Version ==
 
{| class="wikitable"
 
! Version !! Protocol
 
|-
 
| 14w02a || 5
 
|-
 
| 14w03a || 6
 
|-
 
| 14w04a || 7
 
|-
 
| 14w04b || 8
 
|-
 
| 14w05a || 9
 
|-
 
| 14w06a || 10
 
|-
 
| 14w07a || 11
 
|-
 
| 14w08a || 12
 
|-
 
| 14w11a || 14
 
|-
 
| 14w17a || 15
 
|-
 
| 14w18b || 16
 
|-
 
| 14w19a || 17
 
|-
 
| 14w20a || 18
 
|-
 
| 14w21a || 19
 
|-
 
| 14w21b || 20
 
|-
 
| 14w25a || 21
 
|-
 
| 14w25b || 22
 
|-
 
| 14w26a || 23
 
|-
 
| 14w26b || 24
 
|-
 
| 14w26c || 25
 
|-
 
| 14w27a/b || 26
 
|-
 
| 14w28a || 27
 
|-
 
| 14w28b || 28
 
|-
 
| 14w29a || 29
 
|-
 
| 14w30a || 30
 
|-
 
| 14w30c || 31
 
|-
 
| 14w31a || 32
 
|-
 
| 14w32a || 33
 
|-
 
| 14w32b || 34
 
|-
 
| 14w32c || 35
 
|-
 
| 14w32d || 36
 
|-
 
| 14w33a || 37
 
|-
 
| 14w33b || 38
 
|-
 
| 14w33c || 39
 
|-
 
| 14w34a || 40
 
|-
 
| 14w34b || 41
 
|-
 
| 14w34c || 42
 
|-
 
| 14w34d || 43
 
|-
 
| 1.8-pre1 || 44
 
|-
 
| 1.8-pre2 || 45
 
|-
 
| 1.8-pre3 || 46
 
|-
 
| 1.8 || 47
 
|}
 
 
== Packet format ==
 
 
Once a Set Compression packet is sent, compression is enabled for all following packets.
 
The format of a packet changes slighty to include the size of the uncompressed packet.
 
 
{| class=wikitable
 
! Name !! Type
 
|-
 
| Packet Length || VarInt
 
|-
 
| Data Length || VarInt
 
|-
 
| Data ||
 
|}
 
 
If Data Length is set to zero, then the packet is uncompressed; otherwise it is the size of the uncompressed packet.
 
 
If compressed, the data's length must be equal to or over the threshold set in the Set Compression packet, otherwise the client/server will disconnect.
 
 
Compression can be disabled by sending a threshold of -1.
 
 
The length given by the Packet Length field is the number of bytes that remain in that packet, including the Data Length field.
 
  
 
== New/Modified data types ==
 
== New/Modified data types ==
 
=== Position ===
 
 
Encoded as followed:
 
 
  (x & 0x3FFFFFF) << 38 | (y & 0xFFF) << 26 | (z & 0x3FFFFFF)
 
 
 
And decoded as:
 
 
  long val; // Encoded value
 
  x = val >> 38;
 
  y = val << 26 >> 52
 
  z = val << 38 >> 38
 
 
=== VarLong ===
 
 
Like VarInt but based on java's long type instead of int
 
 
=== Slot Data ===
 
 
See also [[Slot Data]]
 
 
{| class="wikitable"
 
! Field Name !! Field Type !! Notes
 
|-
 
| Block ID || short || -1 for empty slots
 
|-
 
| Item count || byte ||
 
|-
 
| Item damage || short ||
 
|-
 
| Data || [[NBT]] || Uncompressed NBT data without length prefix. This had previously a short length prefix and was compressed.
 
|-
 
|}
 
 
 
=== UUID ===
 
 
Encoded as two longs
 
 
      this.writeLong(uuid.getMostSignificantBits());
 
      this.writeLong(uuid.getLeastSignificantBits());
 
  
 
== Play ==
 
== Play ==
  
 
=== Clientbound ===
 
=== Clientbound ===
 
==== Keep Alive ====
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet. If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Client
 
| Keep Alive ID || VarInt ||
 
|}
 
 
 
==== Join Game ====
 
See [[Protocol Encryption]] for information on logging in.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=7 | 0x01 || rowspan=7 | Play || rowspan=7 | Client
 
| Entity ID || Int || The player's Entity ID
 
|-
 
| Gamemode || Unsigned Byte || 0: survival, 1: creative, 2: adventure. Bit 3 (0x8) is the hardcore flag
 
|-
 
| Dimension || Byte || -1: nether, 0: overworld, 1: end
 
|-
 
| Difficulty || Unsigned Byte || 0 thru 3 for Peaceful, Easy, Normal, Hard
 
|-
 
| Max Players || Unsigned Byte || Used by the client to draw the player list
 
|-
 
| Level Type || String || default, flat, largeBiomes, amplified, default_1_1
 
|-
 
| Reduced Debug Info || Boolean ||
 
|}
 
{{Warning|If the Dimension isn't valid then the client will crash}}
 
 
==== Chat Message ====
 
 
Identifying the difference between Chat/System Message is important as it helps respect the user's chat visibility options. While position 2 accepts json formatting it will not display, old style formatting works
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x02 || rowspan=2 | Play || rowspan=2 | Client
 
| JSON Data || String || [[Chat]] , Limited to 32767 bytes
 
|-
 
| Position || Byte || 0 - Chat (chat box) ,1 - System Message (chat box), 2 - Above action bar
 
|}
 
{{Warning|Malformed JSON will disconnect the client}}
 
 
==== Entity Equipment ====
 
{| 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 ====
 
 
Sent by the server after login to specify the coordinates of the spawn point (the point at which players spawn at, and which the compass points to). It can be sent at any time to update the point compasses point at.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x05 || rowspan=1 | Play || rowspan=1 | Client
 
| Location || Position || Spawn location
 
|}
 
 
==== Update Health ====
 
 
Sent by the server to update/set the health of the player it is sent to.
 
 
Food saturation acts as a food "overcharge". Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=3 | 0x06 || rowspan=3 | Play || rowspan=3 | Client
 
| Health || Float || 0 or less = dead, 20 = full HP
 
|-
 
| Food || VarInt || 0 - 20
 
|-
 
| Food Saturation || Float || Seems to vary from 0.0 to 5.0 in integer increments
 
|}
 
 
 
==== Player Position And Look ====
 
 
Updates the players position on the server.
 
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 units will result in the client being kicked for "You moved too quickly :( (Hacking?)"
 
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for "Illegal position"
 
 
Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0,-1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.
 
 
Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.
 
 
The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:
 
  l = x-x0
 
  w = z-z0
 
  c = sqrt( l*l + w*w )
 
  alpha1 = -arcsin(l/c)/PI*180
 
  alpha2 =  arccos(w/c)/PI*180
 
  if alpha2 > 90 then
 
    yaw = 180 - alpha1
 
  else
 
    yaw = alpha1
 
 
You can get a unit vector from a given yaw/pitch via:
 
  x = -cos(pitch) * sin(yaw)
 
  y = -sin(pitch)
 
  z =  cos(pitch) * cos(yaw)
 
 
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"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=6| 0x08 || rowspan=6 | Play || rowspan=6 | Client
 
| X || Double || Absolute/Relative position
 
|-
 
| Y || Double || Absolute/Relative position
 
|-
 
| Z || Double || Absolute/Relative position
 
|-
 
| Yaw || Float || Absolute/Relative rotation on the X Axis, in degrees
 
|-
 
| Pitch || Float || Absolute/Relative rotation on the Y Axis, in degrees
 
|-
 
| Flags || Byte ||
 
{| class="wikitable"
 
| X || 0x01
 
|-
 
| Y || 0x02
 
|-
 
| Z || 0x04
 
|-
 
| Y_ROT || 0x08
 
|-
 
| X_ROT || 0x10
 
|}
 
|}
 
 
==== Use Bed ====
 
 
This packet tells that a player goes to bed.
 
 
The client with the matching  Entity ID will go into bed mode.
 
 
This Packet is sent to all nearby players including the one sent to bed.
 
 
{| class="wikitable"
 
! 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
 
|}
 
 
==== Spawn Player ====
 
 
This packet is sent by the server when a player comes into visible range, '''not''' when a player joins.
 
 
Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.
 
 
When in online-mode the uuids must be valid and have valid skin blobs, in offline-mode uuid v3 is used.
 
 
For NPCs UUID v2 should be used. Note:
 
  <+Grum> i will never confirm this as a feature you know that :)
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !!colspan=2 | Field Name !! Field Type !! Notes
 
|-
 
| rowspan=14 | 0x0C || rowspan=14 | Play || rowspan=14 | Client
 
| colspan=2 | Entity ID || VarInt || Player's Entity ID
 
|-
 
| colspan=2 | Player UUID || UUID || Player's UUID
 
|-
 
| colspan=2 | X || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
| colspan=2 | Y || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
| colspan=2 | Z || Int || Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
| colspan=2 | Yaw || Byte || Player rotation as a packed byte
 
|-
 
| colspan=2 | Pitch || Byte || Player rotation as a packet byte
 
|-
 
| colspan=2 | Current Item || Short || The item the player is currently holding. Note that this should be 0 for "no item", unlike -1 used in other packets. A negative value crashes clients.
 
|-
 
| colspan=2 | Metadata || [[Entities#Entity_Metadata_Format|Metadata]] || The client will crash if no metadata is sent
 
|}
 
{{Warning|The client will crash if no metadata is sent}}
 
{{Warning|The client will disconnect if both UUID and Name are empty}}
 
 
==== Collect Item ====
 
 
Sent by the server when someone picks up an item lying on the ground - its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each Player Position and [Player Position & Look packet sent by the client.
 
 
{| class="wikitable"
 
! 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 Painting ====
 
 
This packet shows location, name, and type of painting.
 
 
Calculating the center of an image: given a (width x height) grid of cells, with (0, 0) being the top left corner, the center is (max(0, width / 2 - 1), height / 2). E.g.
 
 
2x1 (1, 0)
 
4x4 (1, 2)
 
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=6 | 0x10 || rowspan=6 | Play || rowspan=6 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Title || String || Name of the painting. Max length 13
 
|-
 
| Location || Position || Center coordinates
 
|-
 
| Direction || Unsigned Byte || Direction the painting faces (0 -z, 1 -x, 2 +z, 3 +x)
 
|}
 
 
 
==== Entity Velocity ====
 
 
Velocity is believed to be in units of 1/8000 of a block per server tick (50ms);
 
for example, -1343 would move (-1343 / 8000) = −0.167875 blocks per tick (or −3,3575 blocks per second).
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x12 || rowspan=4 | Play || rowspan=4 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Velocity X || Short || Velocity on the X axis
 
|-
 
| Velocity Y || Short || Velocity on the Y axis
 
|-
 
| Velocity Z || Short || Velocity on the Z axis
 
|}
 
 
==== Destroy Entities ====
 
 
Sent by the server when an list of Entities is to be destroyed on the client.
 
 
{| class="wikitable"
 
! 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 ====
 
 
Most entity-related packets are subclasses of this packet. When sent from the server to the client, it may initialize the entry.
 
 
For player entities, either this packet or any move/look packet is sent every game tick.
 
So the meaning of this packet is basically that the entity did not move/look since the last such packet.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x14 || rowspan=1 | Play || rowspan=1 | Client
 
| Entity ID || VarInt || Entity's ID
 
|}
 
 
==== Entity Relative Move ====
 
 
This packet is sent by the server when an entity moves less then 4 blocks; if an entity moves more than 4 blocks Entity Teleport should be sent instead.
 
 
This packet allows at most four blocks movement in any direction, because byte range is from -128 to 127.
 
 
{| class="wikitable"
 
! 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"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x16 || rowspan=4 | Play || rowspan=4 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Yaw || Byte || The X Axis rotation as a fraction of 360
 
|-
 
| Pitch || Byte || The Y Axis rotation as a fraction of 360
 
|-
 
| On Ground || Boolean ||
 
|}
 
 
==== Entity Look and Relative Move ====
 
 
This packet is sent by the server when an entity rotates and moves.
 
Since a byte range is limited from -128 to 127, and movement is offset of fixed-point numbers,
 
this packet allows at most four blocks movement in any direction. (-128/32 == -4)
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=7 | 0x17 || rowspan=7 | Play || rowspan=7 | 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]]
 
|-
 
| Yaw || Byte || The X Axis rotation as a fraction of 360
 
|-
 
| Pitch || Byte || The Y Axis rotation as a fraction of 360
 
|-
 
| On Ground || Boolean ||
 
|}
 
 
==== Entity Teleport ====
 
 
This packet is sent by the server when an entity moves more than 4 blocks.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=8 | 0x18 || rowspan=8 | Play || rowspan=8 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| X || Int || X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
| Y || Int || Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
| Z || Int || Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
 
|-
 
| Yaw || Byte || The X Axis rotation as a fraction of 360
 
|-
 
| Pitch || Byte || The Y Axis rotation as a fraction of 360
 
|-
 
| On Ground || Boolean ||
 
|}
 
 
==== Entity Head Look ====
 
 
Changes the direction an entity's head is facing.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Head Yaw || Byte || Head yaw in steps of 2p/256
 
|}
 
 
==== Entity Metadata ====
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x1C || rowspan=2 | Play || rowspan=2 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Metadata || [[Entities#Entity_Metadata_Format|Metadata]] ||
 
|}
 
 
 
==== Entity Effect ====
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=5 | 0x1D || rowspan=5 | Play || rowspan=5 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Effect ID || Byte || See [[http://www.minecraftwiki.net/wiki/Potion_effect#Parameters]]
 
|-
 
| Amplifier || Byte ||
 
|-
 
| Duration || VarInt ||
 
|-
 
| Hide Particles || Boolean ||
 
|}
 
 
==== Remove Entity Effect ====
 
{| class="wikitable"
 
! 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 ====
 
 
Sent by the server when the client should change experience levels.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=3 | 0x1F || rowspan=3 | Play || rowspan=3 | Client
 
| Experience bar || Float || Between 0 and 1
 
|-
 
| Level || VarInt ||
 
|-
 
| Total Experience || VarInt ||
 
|}
 
 
==== Entity Properties ====
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=3 | 0x20 || rowspan=3 | Play || rowspan=3 | Client
 
| Entity ID || VarInt || Entity's ID
 
|-
 
| Count || Int || Length of following array
 
|-
 
| Properties || Array of Property Data ||
 
|}
 
 
'''Property Data''' structure:
 
{| class="wikitable"
 
|-
 
! Field Name !! Field Type !! Notes
 
|-
 
| Key || String ||
 
|-
 
| Value || Double ||
 
|-
 
| List Length || VarInt || Number of list elements that follow.
 
|-
 
| Modifiers || Array of Modifier Data || http://www.minecraftwiki.net/wiki/Attribute#Modifiers
 
|}
 
 
Known key values:
 
{| 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 14w26a:
 
 
* Data value section removed
 
* Extended id section removed
 
* Block id section is now a unsigned short (little endian) per a block
 
* The block id is equal to <code>(id << 4) | data</code>
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=7 | 0x21 || rowspan=7 | Play || rowspan=7 | Client
 
| Chunk X || Int || Chunk X coordinate
 
|-
 
| Chunk Z || Int || Chunk Z coordinate
 
|-
 
| Ground-Up continuous || Boolean || This is True if the packet represents all sections in this vertical column, where the primary bit map specifies exactly which sections are included, and which are air
 
|-
 
| Primary bit map || Unsigned Short || Bitmask with 1 for every 16x16x16 section which data follows in the compressed data.
 
|-
 
| Size || VarInt || Size of chunk data
 
|-
 
| Data || Byte array || The chunk data is not compressed as of 14w28a
 
|}
 
 
==== Multi Block Change ====
 
{| 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'''
 
{| 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"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=3 | 0x23 || rowspan=3 | Play || rowspan=3 | Client
 
| Location || Position|| Block Coordinates
 
|-
 
| Block ID || VarInt || The new block ID for the block. <code>id << 4 | data</code>
 
|}
 
 
==== Block Action ====
 
 
This packet is used for a number of things:
 
* <div class="li">Chests opening and closing
 
* Pistons pushing and pulling
 
* Note blocks playing
 
 
See Also: [[Block Actions]]
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x24 || rowspan=4 | Play || rowspan=4 | Client
 
| Location || Position || Block Coordinates
 
|-
 
| Byte 1 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
 
|-
 
| Byte 2 || Unsigned Byte || Varies depending on block - see [[Block_Actions]]
 
|-
 
| Block Type || VarInt || The block type for the block
 
|}
 
 
==== Block Break Animation ====
 
 
0-9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
 
 
You can also set an animation to air! The animation will still be visible.
 
 
If you need to display several break animations at the same time you have to give each of them a unique Entity ID.
 
 
Also if you set the coordinates to a special block like water etc. it won't show the actual break animation but some other interesting effects. (Water will loose it's transparency)
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! 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
 
|}
 
 
==== Map Chunk Bulk ====
 
 
See also: [[SMP Map Format]]
 
 
Snapshot changes at [[#Chunk_Data]]
 
 
To reduce the number of bytes this packet is used to send chunks together for better compression results.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=5 | 0x26 || rowspan=5 | Play || rowspan=5 | Client
 
| Sky light sent || Bool || Whether or not the chunk data contains a light nibble array. This is true in the main world, false in the end + nether
 
|-
 
| Chunk column count || VarInt || The number of chunk in this packet
 
|-
 
| Meta information || Meta || See below
 
|-
 
| Data || Byte Array || Chunk data. Uncompressed as of 14w28a
 
|}
 
 
'''Meta'''
 
{| class="wikitable"
 
! Field Name !! Field Type !! Notes
 
|-
 
|Chunk X || Int || The X Coordinate of the chunk
 
|-
 
|Chunk Z || Int || The Z Coordinate of the chunk
 
|-
 
|Primary bitmap || Unsigned Short || A bitmap which specifies which sections are not empty in this chunk
 
|}
 
 
==== Effect ====
 
 
Sent when a client is to play a sound or particle effect.
 
 
By default, the minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1013 (mob.wither.spawn), and is ignored for any other value by the client.
 
 
{| class="wikitable"
 
! 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 =====
 
 
{| class="wikitable"
 
! ID !! Name
 
|-
 
| colspan=2 | '''Sound'''
 
|-
 
| 1000|| <code>random.click</code>
 
|-
 
| 1001|| <code>random.click</code>
 
|-
 
| 1002|| <code>random.bow</code>
 
|-
 
| 1003|| <code>random.door_open</code> or <code>random.door_close</code> (50/50 chance)
 
|-
 
| 1004|| <code>random.fizz</code>
 
|-
 
| 1005|| Play a music disc. '''Data''' [http://www.minecraftwiki.net/wiki/Music_Discs Record ID]
 
|-
 
| ''(1006 not assigned)'' ||
 
|-
 
| 1007|| <code>mob.ghast.charge</code>
 
|-
 
| 1008|| <code>mob.ghast.fireball</code>
 
|-
 
| 1009|| <code>mob.ghast.fireball</code>, but with a lower volume.
 
|-
 
| 1010|| <code>mob.zombie.wood</code>
 
|-
 
| 1011|| <code>mob.zombie.metal</code>
 
|-
 
| 1012|| <code>mob.zombie.woodbreak</code>
 
|-
 
| 1013|| <code>mob.wither.spawn</code>
 
|-
 
| 1014|| <code>mob.wither.shoot</code>
 
|-
 
| 1015|| <code>mob.bat.takeoff</code>
 
|-
 
| 1016|| <code>mob.zombie.infect</code>
 
|-
 
| 1017|| <code>mob.zombie.unfect</code>
 
|-
 
| 1018|| <code>mob.enderdragon.end</code>
 
|-
 
| 1020|| <code>random.anvil_break</code>
 
|-
 
| 1021|| <code>random.anvil_use</code>
 
|-
 
| 1022|| <code>random.anvil_land</code>
 
|-
 
| colspan=2 | '''Particle'''
 
|-
 
| 2000|| Spawns 10 smoke particles, e.g. from a fire. '''Data''' direction, see below
 
|-
 
| 2001|| Block break. '''Data''' [http://www.minecraftwiki.net/wiki/Data_values Block ID]
 
|-
 
| 2002|| Splash potion. Particle effect + glass break sound. '''Data''' [http://www.lb-stuff.com/Minecraft/PotionDataValues1.9pre3.txt Potion ID]
 
|-
 
| 2003|| Eye of ender entity break animation - particles and sound
 
|-
 
| 2004|| Mob spawn particle effect: smoke + flames
 
|-
 
| 2005|| Spawn "happy villager" effect (green crosses), used for bonemealing vegetation.
 
|}
 
 
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
 
|}
 
 
==== Particle ====
 
 
Displays the named particle
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=11 | 0x2A || rowspan=11 | Play || rowspan=11 | Client
 
| Particle Id || Int ||
 
|-
 
| Long Distance || Boolean || If true, particle distance increases from 256 to 65536.
 
|-
 
| X || Float || X position of the particle
 
|-
 
| Y || Float || Y position of the particle
 
|-
 
| Z || Float || Z position of the particle
 
|-
 
| Offset X || Float || This is added to the X position after being multiplied by random.nextGaussian()
 
|-
 
| Offset Y || Float || This is added to the Y position after being multiplied by random.nextGaussian()
 
|-
 
| Offset Z || Float || This is added to the Z position after being multiplied by random.nextGaussian()
 
|-
 
| Particle data || Float || The data of each particle
 
|-
 
| Number of particles || Int || The number of particles to create
 
|-
 
| Data || Array of VarInt || Length depends on particle. ICON_CRACK, BLOCK_CRACK, and BLOCK_DUST have lengths of 2, the rest have 0.
 
|}
 
 
==== Open Window ====
 
 
This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=6 | 0x2D || rowspan=6 | Play || rowspan=6 | Client
 
| Window id || Unsigned Byte || A unique id number for the window to be displayed.  Notchian server implementation is a counter, starting at 1.
 
|-
 
| Inventory Type || String || The window type to use for display.  Check below
 
|-
 
| Window title || String (JSON) || The title of the window.
 
|-
 
| Number of Slots || Unsigned Byte || Number of slots in the window (excluding the number of slots in the player inventory).
 
|-
 
| Entity ID || Int || EntityHorse's entityId. Only sent when window type is equal to "EntityHorse".
 
|}
 
 
See [[Inventory#Windows|inventory windows]] for further information.
 
 
==== Update Sign ====
 
 
This message is sent from the server to the client whenever a sign is discovered or created. This message is NOT sent when a sign is destroyed or unloaded.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=7 | 0x33 || rowspan=7 | Play || rowspan=7 | Client
 
| Location || Position || Block Coordinates
 
|-
 
| Line 1 || [[Chat]] || First line of text in the sign
 
|-
 
| Line 2 || [[Chat]] || Second line of text in the sign
 
|-
 
| Line 3 || [[Chat]] || Third line of text in the sign
 
|-
 
| Line 4 || [[Chat]] || Fourth line of text in the sign
 
|}
 
 
==== Maps ====
 
 
{| class="wikitable"
 
! Packet ID !! Category !! 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 ||
 
|-
 
| Length || VarInt ||
 
|-
 
| Icons || 3 * length bytes || First byte, 0xF0 = Direction, 0x0F = Type. Second byte, X. Third byte, Y
 
|-
 
| Columns || Byte ||
 
|-
 
| Rows || Byte || Only if Columns is more than 0
 
|-
 
| X || Byte || Only if Columns is more than 0
 
|-
 
| Y || Byte || Only if Columns is more than 0
 
|-
 
| Length || VarInt || Only if Columns is more than 0
 
|-
 
| Data || Length bytes || Only if Columns is more than 0
 
|}
 
 
==== Update Block Entity ====
 
 
Essentially a block update on a block entity.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x35 || rowspan=4 | Play || rowspan=4 | Client
 
| Location || Position ||
 
|-
 
| Action || Unsigned Byte || The type of update to perform
 
|-
 
| NBT Data || Byte Array || If not present then its TAG_END (0)
 
|}
 
 
'''Actions'''
 
 
* '''1''': Set mob displayed inside a mob spawner. Custom 1 contains the [[Entities#Mobs|mob type]]
 
 
==== Sign Editor Open ====
 
 
Sent on placement of sign.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=3 | 0x36 || rowspan=3 | Play || rowspan=3 | Client
 
| Location || Position || Block coordinates
 
|}
 
 
==== Player List Item ====
 
 
Sent by the notchian server to update the user list (<tab> in the client).
 
 
{| class="wikitable"
 
! 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 | || ||
 
|}
 
 
==== Scoreboard Objective ====
 
 
This is sent to the client when it should create a new scoreboard or remove one.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x3B || rowspan=4 | Play || rowspan=4 | Client
 
| Objective name || String || An unique name for the objective
 
|-
 
| Mode || Byte || 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
 
|-
 
| Objective value || String || Only if mode is 0 or 2. The text to be displayed for the score.
 
|-
 
| Type || String || Only if mode is 0 or 2. "integer" or "hearts"
 
|}
 
 
==== Update Score ====
 
 
This is sent to the client when it should update a scoreboard item.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x3C || rowspan=4 | Play || rowspan=4 | Client
 
| Item Name || String || An unique name to be displayed in the list.
 
|-
 
| Update/Remove || Byte || 0 to create/update an item. 1 to remove an item.
 
|-
 
| Score Name || String || The unique name for the scoreboard to be updated.
 
|-
 
| Value || VarInt || The score to be displayed next to the entry. Only sent when Update/Remove does not equal 1.
 
|}
 
{{Warning|The final String and Int are only sent if the Update/Remove Byte does not equal 1}}
 
 
==== Teams ====
 
 
Creates and updates teams.
 
 
{| class="wikitable"
 
! 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.
 
 
If 3 then new players are added to the team.
 
 
If 4 then players are removed from the team.
 
|-
 
| Team Display Name || String || Only if Mode = 0 or 2.
 
|-
 
| Team Prefix || String || Only if Mode = 0 or 2. Displayed before the players' name that are part of this team.
 
|-
 
| Team Suffix || String || Only if Mode = 0 or 2. Displayed after the players' name that are part of this team.
 
|-
 
| Friendly fire || Byte || Only if Mode = 0 or 2; 0 for off, 1 for on, 3 for seeing friendly invisibles
 
|-
 
| Name Tag Visibility || String || Only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam, never. 
 
|-
 
| Color || Byte ||  Only if Mode = 0 or 2. Same as [[Chat]] colors.
 
|-
 
| Player count || VarInt || Only if Mode = 0 or 3 or 4. Number of players in the array
 
|-
 
| Players || Array of strings || Only if Mode = 0 or 3 or 4. Players to be added/remove from the team. Max 40 characters so may be uuid's later
 
|}
 
 
==== Plugin Message ====
 
 
Mods and plugins can use this to send their data. Minecraft itself uses a number of [[plugin 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/
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x3F || rowspan=2 | Play || rowspan=2 | Client
 
| Channel || String || Name of the "channel" used to send the data.
 
|-
 
| Data || Byte Array || Any data.
 
|}
 
 
 
==== Server Difficulty ====
 
 
Changes the difficulty setting in the client's option menu
 
{| class="wikitable"
 
! Packet ID !! Category !! 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 !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=6 | 0x42 || rowspan=6 | Play || rowspan=6 | Client
 
| Event || Unsigned Byte || 0 ENTER_COMBAT, 1 END_COMBAT, 2 ENTITY_DEAD
 
|-
 
| Duration || VarInt || Only for END_COMBAT
 
|-
 
| Entity ID || Int || Only for END_COMBAT
 
|-
 
| Player ID || VarInt || Only for ENTITY_DEAD
 
|-
 
| Entity ID || Int || Only for ENTITY_DEAD
 
|-
 
| Message || String || Only for ENTITY_DEAD
 
|}
 
 
==== Camera ====
 
 
{| class="wikitable"
 
! Packet ID !! Category !! 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 !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
 
|-
 
| rowspan=18 | 0x44 || rowspan=18 | Play || rowspan=18 | Client
 
| colspan=2 | Action || VarInt ||
 
|-
 
! Action !! Name !! !!
 
|-
 
| 0 (SET_SIZE)
 
| Radius || Double ||
 
|-
 
| rowspan=3 | 1 (LERP_SIZE)
 
| Old radius || Double ||
 
|-
 
| New radius || Double ||
 
|-
 
| Speed || VarLong ||
 
|-
 
| 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 ||
 
|-
 
| rowspan=1 | 5 (SET_WARNING_BLOCKS)
 
| Warning blocks || VarInt ||
 
|}
 
 
==== Title ====
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! colspan=2 | Field Name !! Field Type !! Notes
 
|-
 
| rowspan=9 | 0x45 || rowspan=9 | Play || rowspan=9 | Client
 
| colspan=2 | Action || VarInt ||
 
|-
 
! Action !! Name !! !!
 
|-
 
| 0 (TITLE) || Text || JSON Chat String ||
 
|-
 
| 1 (SUBTITLE) || Text || JSON Chat String ||
 
|-
 
| 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"
 
! 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"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x48 || rowspan=2 | Play || rowspan=2 | Client
 
| URL || String ||
 
|-
 
| Hash || String || If it's not a 40 character hexadecimal string, the client will not use it for hash verification and likely waste bandwidth - but it will still treat it as a unique id
 
|}
 
 
==== Update Entity NBT ====
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x49 || rowspan=2 | Play || rowspan=2 | Client
 
| Entity ID || VarInt ||
 
|-
 
| Tag || NBT Tag ||
 
|}
 
 
=== Serverbound ===
 
 
==== Keep Alive ====
 
 
The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same packet.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x00 || rowspan=1 | Play || rowspan=1 | Server
 
| Keep Alive ID || VarInt ||
 
|}
 
 
==== Use Entity ====
 
 
This packet is sent from the client to the server when the client attacks or right-clicks another entity (a player, minecart, etc).
 
 
A Notchian server only accepts this packet if the entity being attacked/used is visible without obstruction and within a 4-unit radius of the player's position.
 
 
Note that middle-click in creative mode is interpreted by the client and sent as a Creative Inventory Action packet instead.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=5 | 0x02 || rowspan=5 | Play || rowspan=5 | Server
 
| Target || VarInt ||
 
|-
 
| Type || VarInt || 0 = INTERACT, 1 = ATTACK, 2 = INTERACT_AT
 
|-
 
| Target X || Float || Only if Type == INTERACT_AT
 
|-
 
| Target Y || Float || Only if Type == INTERACT_AT
 
|-
 
| Target Z || Float || Only if Type == INTERACT_AT
 
|}
 
 
==== Player Position ====
 
 
Updates the players XYZ position on the server.
 
If <code>HeadY - FeetY</code> is less than <code>0.1</code> or greater than <code>1.65</code>, the stance is illegal and the client will be kicked with the message “Illegal Stance”.
 
If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 units will result in the client being kicked for "You moved too quickly :( (Hacking?)"
 
Also if the fixed-point number of X or Z is set greater than <code>3.2E7D</code> the client will be kicked for "Illegal position"
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=5 | 0x04 || rowspan=5 | Play || rowspan=5 | Server
 
| X || Double || Absolute position
 
|-
 
| FeetY || Double || Absolute feet position, normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
 
|-
 
| Z || Double || Absolute position
 
|-
 
| On Ground || Bool || True if the client is on the ground, False otherwise
 
|}
 
 
==== Player Position And Look ====
 
 
A combination of Player Look and Player position.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=7 | 0x06 || rowspan=7 | Play || rowspan=7 | Server
 
| X || Double || Absolute position
 
|-
 
| FeetY || Double || Absolute feet position. Is normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…
 
|-
 
| Z || Double || Absolute position
 
|-
 
| Yaw || Float || Absolute rotation on the X Axis, in degrees
 
|-
 
| Pitch || Float || Absolute rotation on the Y Axis, in degrees
 
|-
 
| On Ground || Bool || True if the client is on the ground, False otherwise
 
|}
 
 
 
==== Player Digging ====
 
 
Sent when the player mines a block.  A Notchian server only accepts digging packets with coordinates within a 6-unit radius of the player's position.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! 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
 
|}
 
 
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"
 
|-
 
! Packet ID !! Category !! 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 ||
 
|}
 
In normal operation (ie placing a block), this packet is sent once, with the values set normally.
 
 
This packet has a special case where X, Y, Z, and Direction are all -1. (Note that Y is unsigned so set to 255.) This special packet indicates that the currently held item for the player should have its state updated such as eating food, shooting bows, using buckets, etc.
 
 
In a Notchian Beta client, the block or item ID corresponds to whatever the client is currently holding, and the client sends one of these packets any time a right-click is issued on a surface, so no assumptions can be made about the safety of the ID.  However, with the implementation of server-side inventory, a Notchian server seems to ignore the item ID, instead operating on server-side inventory information and holding selection. The client has been observed (1.2.5 and 1.3.2) to send both real item IDs and -1 in a single session.
 
 
Special note on using buckets:  When using buckets, the Notchian client might send two packets:  first a normal and then a special case.  The first normal packet is sent when you're looking at a block (e.g. the water you want to scoop up).  This normal packet does not appear to do anything with a Notchian server.  The second, special case packet appears to perform the action - based on current position/orientation and with a distance check - it appears that buckets can only be used within a radius of 6 units.
 
 
==== Animation ====
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x0A  || rowspan=1 | Play || rowspan=1 | Server
 
| || ||
 
|}
 
 
==== Entity Action ====
 
 
Sent at least when crouching, leaving a bed, or sprinting.
 
To send action animation to client use 0x28.
 
The client will send this with Action ID = 3 when "Leave Bed" is clicked.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan="3" | 0x0B || rowspan="3" | Play || rowspan="3" | Server
 
| Entity ID || VarInt || Player ID
 
|-
 
| Action ID || Unsigned Byte || The ID of the action, see below.
 
|-
 
| Jump Boost || VarInt || Horse jump boost. Ranged from 0 -> 100.
 
|}
 
 
Action ID can be one of the following values:
 
 
{| class="wikitable"
 
! 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=4 | 0x0C || rowspan=4 | Play || rowspan=4 | Server
 
| Sideways || Float || Positive to the left of the player
 
|-
 
| Forward || Float || Positive forward
 
|-
 
| Flags|| Unsigned Byte || 0x1 Jump, 0x2 Unmount
 
|}
 
 
 
 
==== Update Sign ====
 
 
This message is sent from the client to the server when the "Done" button is pushed after placing a sign.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=7 | 0x12 || rowspan=7 | Play || rowspan=7 | 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
 
|}
 
 
==== Tab-Complete ====
 
 
Sent when the user presses [tab] while writing text. The payload contains all text behind the cursor.
 
 
{| class="wikitable"
 
! 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 ====
 
 
Sent when the player connects, or when settings are changed.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=6 | 0x15 || rowspan=6 | Play || rowspan=6 | Server
 
| Locale || String || en_GB
 
|-
 
| View distance || Byte || Client-side render distance(chunks)
 
|-
 
| Chat flags || Byte || Chat settings. See notes below.
 
|-
 
| Chat colours || Bool || "Colours" multiplayer setting
 
|-
 
| Displayed skin parts || Unsigned Byte || Unknown
 
|}
 
 
Chat flags has several values packed into one byte.
 
 
'''Chat Enabled:''' Bits 0-1. 00: Enabled.  01: Commands only.  10: Hidden.
 
 
==== Client Status ====
 
 
Sent when the client is ready to complete login and when the client is ready to respawn after death.
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x16 || rowspan=1 | Play || rowspan=1 | Server
 
| Action ID || Unsigned Byte || See below
 
|}
 
 
Action ID values:
 
{| class="wikitable"
 
|-
 
! Action ID !! Name
 
|-
 
| 0 || Perform respawn
 
|-
 
| 1 || Request stats
 
|-
 
| 2 || Open inventory achievement
 
|}
 
 
==== Plugin Message ====
 
 
Mods and plugins can use this to send their data. Minecraft itself uses a number of [[plugin 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/
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x17 || rowspan=2 | Play || rowspan=2 | Server
 
| Channel || String || Name of the "channel" used to send the data.
 
|-
 
| Data || Byte Array || Any data.
 
|}
 
 
 
==== Spectate ====
 
 
{| class="wikitable"
 
! 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"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=2 | 0x19 || rowspan=2 | Play || rowspan=2 | Server
 
| Hash || String ||
 
|-
 
| Result || VarInt ||  Successfully loaded: 0, Declined: 1, Failed download: 2, Accepted: 3
 
|}
 
 
== Login ==
 
 
The login process is as follows:
 
    C->S : Handshake State=2
 
    C->S : Login Start
 
    S->C : Encryption Key Request
 
    (Client Auth)
 
    C->S : Encryption Key Response
 
    (Server Auth, Both enable encryption)
 
    S->C : Login Success
 
 
For unauthenticated and localhost connections there is no encryption.
 
In that case Login Start is directly followed by Login Success.
 
 
See [[Protocol Encryption]] for details.
 
 
=== Clientbound ===
 
 
==== Encryption Request ====
 
{| 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.
 
 
 
==== Set Compression ====
 
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=1 | 0x03 || rowspan=4 | Login || rowspan=4 | Client
 
| Threshold || VarInt || Threshold is the max size of a packet before its compressed
 
|}
 
  
 
=== Serverbound ===
 
=== Serverbound ===
 
==== Encryption Response ====
 
{| class="wikitable"
 
! Packet ID !! Category !! Bound To !! Field Name !! Field Type !! Notes
 
|-
 
| rowspan=4 | 0x01 || rowspan=4 | Login || rowspan=4 | Server
 
| Length || VarInt || length of shared secret
 
|-
 
| Shared Secret || Byte array ||
 
|-
 
| Length || VarInt || length of verify token
 
|-
 
| Verify Token || Byte array ||
 
|-
 
|}
 
 
See [[Protocol Encryption]] for details.
 

Revision as of 09:23, 2 September 2014

This page documents the changes from the last stable Minecraft release (currently 1.8, protocol 47) to the current pre-release. Note that this page contains bleeding-edge information that may not be completely or correctly documented. He who wishes to commandeer the merging of this into Protocol when an update is made must be sure to respect any changes that may have occured to the respective packets there.

Protocol History

Protocol Version

New/Modified data types

Play

Clientbound

Serverbound