Difference between revisions of "Pre-release protocol"

From wiki.vg
Jump to navigation Jump to search
(→‎Chunk Section: new section)
(→‎Packets: renamed section to Contents; added section links to changed data types; removed excessive whitespace)
Line 2: Line 2:
  
 
One 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 occurred to the respective packets there.
 
One 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 occurred to the respective packets there.
 +
__NOTOC__
 +
== Contents ==
 +
 +
=== Data types ===
 +
 +
* [[#Chunk Section|Chunk Section]]
 +
* [[#Entity Metadata|Entity Metadata]]
  
__NOTOC__
+
=== Packets ===
== Packets ==
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
  ! ID
 
  ! ID
  ! Name
+
  ! Packet name
  ! colspan=2 | Doc Links
+
  ! colspan=2 | Documentation
 
  |-
 
  |-
 
  ! colspan=4 | Handshaking serverbound
 
  ! colspan=4 | Handshaking serverbound

Revision as of 06:38, 4 September 2015

This page documents the changes from the last stable Minecraft release (currently 1.8.8, protocol 47) to the current pre-release (currently 15w35e, protocol 66). Note that this page contains bleeding-edge information that may not be completely or correctly documented.

One 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 occurred to the respective packets there.

Contents

Data types

Packets

ID Packet name Documentation
Handshaking serverbound
0x00 Handshake Current Pre
Play clientbound
0x00 Keep Alive Current (unchanged)
0x01 Join Game Current (unchanged)
0x02 Chat Message Current (unchanged)
0x03 Time Update Current (unchanged)
0x04 Entity Equipment Current Pre
0x05 Spawn Position Current (unchanged)
0x06 Update Health Current (unchanged)
0x07 Respawn Current (unchanged)
0x08 Player Position And Look Current (unchanged)
0x09 Held Item Change Current (unchanged)
0x0A Use Bed Current (unchanged)
0x0B Animation Current (unchanged)
0x0C Spawn Player Current Pre
0x0D Collect Item Current (unchanged)
0x0E Spawn Object Current Pre
0x0F Spawn Mob Current Pre
0x10 Spawn Painting Current (unchanged)
0x11 Spawn Experience Orb Current (unchanged)
0x12 Entity Velocity Current (unchanged)
0x13 Destroy Entities Current (unchanged)
0x14 Entity Current (unchanged)
0x15 Entity Relative Move Current (unchanged)
0x16 Entity Look Current (unchanged)
0x17 Entity Look And Relative Move Current (unchanged)
0x18 Entity Teleport Current (unchanged)
0x19 Entity Head Look Current (unchanged)
0x1A Entity Status Current Pre
0x1B Attach Entity Current (unchanged)
0x1C Entity Metadata Current (unchanged)
0x1D Entity Effect Current (unchanged)
0x1E Remove Entity Effect Current (unchanged)
0x1F Set Experience Current (unchanged)
0x20 Entity Properties Current Pre
0x21 Chunk Data Current Pre
0x22 Unload Chunk Pre
0x22 0x23 Multi Block Change Current (unchanged)
0x23 0x24 Block Change Current (unchanged)
0x24 0x25 Block Action Current (unchanged)
0x25 0x26 Block Break Animation Current (unchanged)
0x26 Map Chunk Bulk Current
0x27 Explosion Current (unchanged)
0x28 Effect Current (unchanged)
0x29 Sound Effect Current (unchanged)
0x2A Particle Current (unchanged)
0x2B Change Game State Current (unchanged)
0x2C Spawn Global Entity Current (unchanged)
0x2D Open Window Current (unchanged)
0x2E Close Window Current (unchanged)
0x2F Set Slot Current (unchanged)
0x30 Window Items Current (unchanged)
0x31 Window Property Current (unchanged)
0x32 Confirm Transaction Current (unchanged)
0x33 Update Sign Current (unchanged)
0x34 Maps Current Pre
0x35 Update Block Entity Current (unchanged)
0x36 Sign Editor Open Current (unchanged)
0x37 Statistics Current (unchanged)
0x38 Player List Item Current (unchanged)
0x39 Player Abilities Current (unchanged)
0x3A Tab-Complete Current (unchanged)
0x3B Scoreboard Objective Current (unchanged)
0x3C Update Score Current (unchanged)
0x3D Display Scoreboard Current (unchanged)
0x3E Teams Current (unchanged)
0x3F Plugin Message Current (unchanged)
0x40 Disconnect Current (unchanged)
0x41 Server Difficulty Current (unchanged)
0x42 Combat Event Current Pre
0x43 Camera Current (unchanged)
0x44 World Border Current (unchanged)
0x45 Title Current (unchanged)
0x46 Set Compression Current (unchanged)
0x47 Player List Header/Footer Current (unchanged)
0x48 Resource Pack Send Current (unchanged)
0x49 Update Entity NBT Current
0x49 Boss Bar Pre
0x4A Set Cooldown Pre
Play serverbound
0x00 Keep Alive Current (unchanged)
0x01 Chat Message Current (unchanged)
0x02 Use Entity Current Pre
0x03 Player Current (unchanged)
0x04 Player Position Current (unchanged)
0x05 Player Look Current (unchanged)
0x06 Player Position And Look Current (unchanged)
0x07 Player Digging Current Pre
0x08 Use Item Pre
0x08 0x09 Player Block Placement Current Pre
0x09 0x0A Held Item Change Current (unchanged)
0x0A 0x0B Animation Current Pre
0x0B 0x0C Entity Action Current Pre
0x0C 0x0D Steer Vehicle Current (unchanged)
0x0D 0x0E Close Window Current (unchanged)
0x0E 0x0F Click Window Current (unchanged)
0x0F 0x10 Confirm Transaction Current (unchanged)
0x10 0x11 Creative Inventory Action Current (unchanged)
0x11 0x12 Enchant Item Current (unchanged)
0x12 0x13 Update Sign Current Pre
0x13 0x14 Player Abilities Current (unchanged)
0x14 0x15 Tab-Complete Current (unchanged)
0x15 0x16 Client Settings Current Pre
0x16 0x17 Client Status Current Pre
0x17 0x18 Plugin Message Current (unchanged)
0x18 0x19 Spectate Current (unchanged)
0x19 0x1A Resource Pack Status Current (unchanged)
Status clientbound
0x00 Response Current (unchanged)
0x01 Pong Current (unchanged)
Status serverbound
0x00 Request Current (unchanged)
0x01 Ping Current (unchanged)
Login clientbound
0x00 Disconnect Current (unchanged)
0x01 Encryption Request Current (unchanged)
0x02 Login Success Current (unchanged)
0x03 Set Compression Current (unchanged)
Login serverbound
0x00 Login Start Current (unchanged)
0x01 Encryption Response Current (unchanged)

New/modified data types

Chunk Section

Format is now:

Field Name Field Type Notes
Bits Per Block Unsigned Byte How many bits per block in Data Array. If greater than 8 (will be changed to “if 0” in the next snapshot), the Palette Length and Palette fields are omitted and the global palette is used.
Palette Length Optional Unsigned Byte Length of the following array
Palette Optional Array of VarInt Mapping of block state IDs in the global palette (type = x >> 4, meta = x & 15) to indices of this array
Data Array Length VarInt Number of bytes in the following array, divided by 8
Data Array Byte Array List of indices pointing to state IDs in the Palette
Block Light Byte Array Half byte per block
Sky Light Optional Byte Array Only if in the Overworld; half byte per block

Entity Metadata

Format is now:

Name Type Meaning
Index Unsigned Byte Unique index key, if this is 0xFF then the its the end of the metadata and no more is read
Type Unsigned Type The type of the index, see the table below
Type ID Meaning
0 Byte
1 VarInt
2 Float
3 String
4 Chat
5 Slot
6 Boolean
7 Vector3F (3 floats)
8 Position
9 Bool, if true then its followed by Position
10 Direction (VarInt)
11 Bool, if true then its followed by UUID
Entity Index Type Meaning
Entity 0 Byte Unknown
Entity 1 VarInt Unknown
Entity 2 String Unknown
Entity 3 Boolean Unknown
Entity 4 Boolean Unknown
Living extends Entity 5 Byte Unknown
Living extends Entity 6 Float Unknown
Living extends Entity 7 VarInt Unknown
Living extends Entity 8 Boolean Unknown
Living extends Entity 9 VarInt Unknown
Insentient extends Living 10 Byte Unknown
Slime extends Insentient 11 VarInt Unknown
AreaEffectCloud extends Entity 5 Float Unknown
AreaEffectCloud extends Entity 6 VarInt Unknown
AreaEffectCloud extends Entity 7 Boolean Unknown
AreaEffectCloud extends Entity 8 VarInt Unknown
ArmorStand extends Living 10 Byte Unknown
ArmorStand extends Living 11 Vector3F Unknown
ArmorStand extends Living 12 Vector3F Unknown
ArmorStand extends Living 13 Vector3F Unknown
ArmorStand extends Living 14 Vector3F Unknown
ArmorStand extends Living 15 Vector3F Unknown
ArmorStand extends Living 16 Vector3F Unknown
Minecart extends Entity 5 VarInt Unknown
Minecart extends Entity 6 VarInt Unknown
Minecart extends Entity 7 Float Unknown
Minecart extends Entity 8 VarInt Unknown
Minecart extends Entity 9 VarInt Unknown
Minecart extends Entity 10 Boolean Unknown
Shulker extends Golem 11 Direction Unknown
Shulker extends Golem 12 Option Position Unknown
Shulker extends Golem 13 Byte Unknown
Item extends Entity 5 Slot Unknown
Ageable extends Creature 11 Boolean Unknown
Sheep extends Animal 12 Byte Unknown
Rabbit extends Animal 12 VarInt Unknown
TNTPrimed extends Entity 5 VarInt Unknown
Villager extends Ageable 12 VarInt Unknown
Arrow extends Entity 5 Byte Unknown
TameableAnimal extends Animal 12 Byte Unknown
TameableAnimal extends Animal 13 Optional UUID Unknown
Ocelot extends TameableAnimal 14 VarInt Unknown
Fireworks extends Entity 5 Slot Unknown
Spider extends Monster 11 Byte Unknown
EnderCrystal extends Entity 5 Option Position Unknown
TippedArrow extends Arrow 6 VarInt Unknown
ItemFrame extends Hanging 5 Slot Unknown
ItemFrame extends Hanging 6 VarInt Unknown
Bat extends Ambient 11 Byte Unknown
Skeleton extends Monster 11 VarInt Unknown
Skeleton extends Monster 12 Boolean Unknown
Witch extends Monster 11 Boolean Unknown
MinecartCommandBlock extends Minecart 11 String Unknown
MinecartCommandBlock extends Minecart 12 Chat Unknown
Wither extends Monster 11 VarInt Unknown
Wither extends Monster 12 VarInt Unknown
Wither extends Monster 13 VarInt Unknown
Wither extends Monster 14 VarInt Unknown
MinecartFurnace extends Minecart 11 Boolean Unknown
Ghast extends Flying 11 Boolean Unknown
EnderDragon extends Insentient 11 VarInt Unknown
Pig extends Animal 12 Boolean Unknown
Horse extends Animal 12 Byte Unknown
Horse extends Animal 13 VarInt Unknown
Horse extends Animal 14 VarInt Unknown
Horse extends Animal 15 Optional UUID Unknown
Horse extends Animal 16 VarInt Unknown
Creeper extends Monster 11 VarInt Unknown
Creeper extends Monster 12 Boolean Unknown
Creeper extends Monster 13 Boolean Unknown
Zombie extends Monster 11 Boolean Unknown
Zombie extends Monster 12 Boolean Unknown
Zombie extends Monster 13 Boolean Unknown
Guardian extends Monster 11 Byte Unknown
Guardian extends Monster 12 VarInt Unknown
Blaze extends Monster 11 Byte Unknown
Wolf extends TameableAnimal 14 Float Unknown
Wolf extends TameableAnimal 15 Boolean Unknown
Wolf extends TameableAnimal 16 VarInt Unknown
IronGolem extends Golem 11 Byte Unknown
Boat extends Entity 5 VarInt Unknown
Boat extends Entity 6 VarInt Unknown
Boat extends Entity 7 Float Unknown
WitherSkull extends Fireball 5 Boolean Unknown

Handshaking

Clientbound

No changes so far.

Serverbound

Handshake

This causes the server to switch into the target state.

Packet ID State Bound To Field Name Field Type Notes
0x00 Handshaking Server Protocol Version VarInt See protocol version numbers (currently 47 58)
Server Address String hostname or IP, e.g. localhost or 127.0.0.1
Server Port Unsigned Short default is 25565
Next State VarInt 1 for status, 2 for login

Play

Clientbound

Entity Equipment

Packet ID State Bound To Field Name Field Type Notes
0x04 Play Client Entity ID VarInt Entity's EID
Slot Short VarInt Equipment slot. 0: main hand, 1: off hand, 1–4 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)
Item Slot Item in slot format

Spawn Player

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

This packet must be sent after the Player List Item (Play, 0x38, clientbound) packet that adds the player data for the client to use when spawning a player. The tab includes skin/cape data.

Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.

When in online-mode the UUIDs must be valid and have valid skin blobs, in offline-mode UUID v3 is used.

For NPCs UUID v2 should be used. Note:

<+Grum> i will never confirm this as a feature you know that :)

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

Packet ID State Bound To Field Name Field Type Notes
0x0C Play Client Entity ID VarInt Player's EID
Player UUID UUID
X Int Player X as a Fixed-Point number
Y Int Player Y as a Fixed-Point number
Z Int Player Z as a 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 Metadata

Spawn Object

Sent by the server when an object/vehicle is created.

Packet ID State Bound To Field Name Field Type Notes
0x0E Play Client Entity ID VarInt EID of the object
Object UUID UUID
Type Byte The type of object (See Entities#Objects)
X Int X position as a Fixed-Point number
Y Int Y position as a Fixed-Point number
Z Int Z position as a Fixed-Point number
Pitch Angle
Yaw Angle
Data Object Data
Info Int Depends on Type; see Object Data#Meaning of int field
Velocity X Short
Velocity Y Short
Velocity Z Short

Spawn Mob

Sent by the server when a mob entity is spawned.

Packet ID State Bound To Field Name Field Type Notes
0x0F Play Client Entity ID VarInt
Entity UUID UUID
Type Unsigned Byte The type of mob. See Entities#Mobs
X Int X position as a Fixed-Point number
Y Int Y position as a Fixed-Point number
Z Int Z position as a Fixed-Point number
Yaw Angle
Pitch Angle
Head Pitch Angle
Velocity X Short Same units as Entity Velocity
Velocity Y Short Same units as Entity Velocity
Velocity Z Short Same units as Entity Velocity
Metadata Metadata

Entity Status

Packet ID State Bound To Field Name Field Type Notes
0x1A Play Client Entity ID Int
Entity Status Byte See below
Entity Status Meaning
1 Sent when resetting a mob spawn minecart's timer — appears to be unused by the client
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 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
24–28 Sets op permission level 0–4 for players

Entity Properties

Packet ID State Bound To Field Name Field Type Notes
0x20 Play Client Entity ID VarInt
Number Of Properties Int Number of elements in the following array
Property Key Array String See below
Value Double See below
Number Of Modifiers VarInt Number of elements in the following array
Modifiers Array of Modifier Data See Attribute#Modifiers

Known Key values:

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

Modifier Data structure:

Field Name Field Type Notes
UUID UUID
Amount Double
Operation Byte

Chunk Data

Chunk pillars are not unloaded by the client automatically. To unload chunk pillars, send this packet with Ground-Up Continuous=true and no 16^3 chunks (eg. Primary Bit Mask=0) send an Unload Chunk packet with the chunk's X and Z coordinates. The server only sends skylight information for chunk pillars in the Overworld, it's up to the client to know in which dimenison the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent.

Packet ID State Bound To Field Name Field Type Notes
0x21 Play Client Chunk X Int Chunk X coordinate
Chunk Z Int Chunk Z coordinate
Ground-Up Continuous Boolean This is true if the packet represents all chunk sections in this vertical chunk column, where the Primary Bit Mask specifies exactly which chunk sections are included, and which are air.
Primary Bit Mask Unsigned Short Unsigned Int Bitmask with bits set to 1 for every 16×16×16 chunk section whose data follows in the compressed data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15). Will change to a VarInt in the next snapshot.
Size VarInt Size of Data in bytes
Data Array of Chunk Section The length of the array is equal to the number of bits set in Primary Bit Mask.
Biomes Optional Byte Array Only if Ground-Up Continuous: biome array, byte per XZ coordinate, 256 bytes total.

Unload Chunk

Tells the client to unload a chunk.

Packet ID State Bound To Field Name Field Type Notes
0x22 Play Client Chunk X Int Chunk X coordinate
Chunk Z Int Chunk Z coordinate

Multi Block Change

Fired whenever 2 or more blocks are changed within the render distance.

Packet ID State Bound To Field Name Field Type Notes
0x22 0x23 Play Client Chunk X Int Chunk X coordinate
Chunk Z Int Chunk Z coordinate
Record Count VarInt Number of elements in the following array, i.e. the number of blocks affected
Record Horizontal Position Array Unsigned Byte The 4 most significant bits (0xF0) encode the X coordinate, relative to the chunk. The 4 least significant bits (0x0F) encode the Z coordinate, relative to the chunk.
Y Coordinate Unsigned Byte
Block ID VarInt The new block ID for the block. id << 4 | data

Block Change

Fired whenever a block is changed within the render distance.

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

Block Action

This packet is used for a number of things:

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

See Also: Block Actions

Packet ID State Bound To Field Name Field Type Notes
0x24 0x25 Play Client Location Position Block Coordinates
Byte 1 Unsigned Byte Varies depending on block — see Block Actions
Byte 2 Unsigned Byte Varies depending on block — see Block Actions
Block Type VarInt The block type for the block

Block Break Animation

0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.

You can also set an animation to air! The animation will still be visible.

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

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

Packet ID State Bound To Field Name Field Type Notes
0x25 0x26 Play Client Entity ID VarInt EID for the animation
Location Position Block Position
Destroy Stage Byte 0–9 to set it, any other value to remove it

Map Chunk Bulk

Replaced by multiple Chunk Data packets.

Maps

Updates a rectangular area on a map.

Packet ID State Bound To Field Name Field Type Notes
0x34 Play Client Item Damage VarInt The damage value (map ID) of the map being modified
Scale Byte From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)
Tracking Position Boolean Specifies whether the icons are shown
Icon Count VarInt Number of elements in the following array
Icon Direction And Type Array Byte 0xF0 = Direction, 0x0F = Type
X Byte
Z Byte
Columns Byte Number of columns updated
Rows Optional Byte Only if Columns is more than 0; number of rows updated
X Optional Byte Only if Columns is more than 0; x offset of the westernmost column
Z Optional Byte Only if Columns is more than 0; z offset of the northernmost row
Length Optional VarInt Only if Columns is more than 0; length of the following array
Data Optional Array of Unsigned Byte Only if Columns is more than 0; see Map item format

Combat Event

Packet ID State Bound To Field Name Field Type Notes
0x42 Play Client Event VarInt Determines the layout of the remaining packet
Event Field Name
0: enter combat no fields no fields
1: end combat Duration VarInt
Entity ID Int
2: entity dead Player ID VarInt
Entity ID Int
Message String Chat

Update Entity NBT

Was only used to update boss bars, replaced by Boss Bar accordingly.

Boss Bar

This packet replaces Update Entity NBT packet which has been removed.

Packet ID State Bound To Field Name Field Type Notes
0x49 Play Client UUID UUID Unique ID for this bar
Action VarInt Determines the layout of the remaining packet
Action Field Name
0: add Title Chat
Health Float From 0 to 1. Values greater than 1 do not crash the client, and start rendering part of a second health bar at around 1.5
Color VarInt Color ID (see below)
Dividers VarInt Number of dividers rendered in the bar
Flags Unsigned Byte Bit mask: 0x1 should darken sky, 0x2: is dragon bar
1: remove no fields no fields Removes this boss bar
2: update health Health Float as above
3: update title Title Chat
4: update style Color VarInt Color ID (see below)
Dividers VarInt as above
5: update flags Flags Unsigned Byte as above
ID Color
0 Pink(ish)
1 Cyan
2 Red
3 Lime
4 Yellow
5 Purple
6 White

Set Cooldown

Applies a cooldown period to an item type.

Packet ID State Bound To Field Name Field Type Notes
0x4A Play Client Item ID VarInt ID of the item to apply a cooldown to.
Cooldown Ticks VarInt Number of ticks to apply a cooldown for.

Serverbound

Use Entity

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

A Notchian server only accepts this packet if the entity being attacked/used is visible without obstruction and within a 4-unit radius of the player's position.

Note that middle-click in creative mode is interpreted by the client and sent as a Creative Inventory Action packet instead.

Packet ID State Bound To Field Name Field Type Notes
0x02 Play 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
Hand Optional VarInt Only if Type is interact or interact at; 0: main hand, 1: off hand

Player Digging

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

Packet ID State Bound To Field Name Field Type Notes
0x07 Play Server Status Byte The action the player is taking against the block (see below)
Location Position Block position
Face Byte The face being hit (see below)

Status can be one of seven values:

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

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 sends 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, Location set to 0/0/0, and Face 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. Location is set to 0/0/0 like above, but the face field is set to 255.

Status code 6 is another special case. Used to swap or assign an item to the second hand. Location is set to 0/0/0 and Face is set to 0.

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

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

Use Item

Sent when pressing the Use Item key (default: right click) with an item in hand.

Packet ID State Bound To Field Name Field Type Notes
0x08 Play Server Hand VarInt Hand used for the animation

Player Block Placement

Packet ID State Bound To Field Name Field Type Notes
0x08 0x09 Play Server Location Position Block position
Face Byte VarInt The face on which the block is placed (see above)
Held Item Slot
Hand VarInt The hand from which the block is placed; 0: main hand, 1: off hand
Cursor Position X Byte The position of the crosshair on the block
Cursor Position Y Byte
Cursor Position Z Byte

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

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

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

Held Item Change

Sent when the player changes the slot selection.

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

Animation

Sent when the player's arm swings

Packet ID State Bound To Field Name Field Type Notes
0x0A 0x0B Play Server Hand VarInt Hand used for the animation

Entity Action

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

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

Action ID can be one of the following values:

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

“Open inventory” is now sent via the Client Status packet.

Steer Vehicle

Packet ID State Bound To Field Name Field Type Notes
0x0C 0x0D Play Server Sideways Float Positive to the left of the player
Forward Float Positive forward
Flags Unsigned Byte Bit mask. 0x1: jump, 0x2: unmount

Close Window

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

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

Packet ID State Bound To Field Name Field Type Notes
0x0D 0x0E Play Server Window ID Unsigned Byte This is the ID of the window that was closed. 0 for inventory.

Click Window

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

Packet ID State Bound To Field Name Field Type Notes
0x0E 0x0F Play Server Window ID Unsigned Byte The ID of the window which was clicked. 0 for player inventory.
Slot Short The clicked slot number, see below
Button Byte The button used in the click, see below
Action Number Short A unique number for the action, implemented by Notchian as a counter, starting at 1. Used by the server to send back a Confirm Transaction.
Mode Byte Inventory operation mode, see below
Clicked item Slot The clicked slot. Has to be empty (item ID = -1) for drop mode.

See Inventory#Windows for further information about how slots are indexed.

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

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

Mode Button Slot Trigger
0 0 Normal Left mouse click
1 Normal Right mouse click
1 0 Normal Shift + left mouse click
1 Normal Shift + right mouse click (identical behavior)
2 0 Normal Number key 1
1 Normal Number key 2
2 Normal Number key 3
8 Normal Number key 9
3 2 Normal Middle click
4 0 Normal* Drop key (Q) (* Clicked item is different, see above)
1 Normal* Ctrl + Drop key (Ctrl-Q) (drops full stack)
0 -999 Left click outside inventory holding nothing (no-op)
1 -999 Right click outside inventory holding nothing (no-op)
5 0 -999 Starting left mouse drag (or middle mouse)
4 -999 Starting right mouse drag
1 Normal Add slot for left-mouse drag
5 Normal Add slot for right-mouse drag
2 -999 Ending left mouse drag
6 -999 Ending right mouse drag
6 0 Normal Double click

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

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

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

The server will send back a Confirm Transaction packet. If the click was not accepted, the client must reflect that packet before sending more Click Window packets, otherwise the server will reject them silently. The Notchian server also sends a Window Items packet for the open window and Set Slot packets for the clicked and cursor slot, but only when the click was not accepted, probably to resynchronize client and server.

Confirm Transaction

<SpaceManiac> noooo idea why the serverbound confirm transaction packet exists
<SpaceManiac> I think it's sent as a response to the clientbound confirm transaction in some situations, but it's fuzzy
Packet ID State Bound To Field Name Field Type Notes
0x0F 0x10 Play Server Window ID Byte The ID of the window that the action occurred in
Action Number Short Every action that is to be accepted has a unique number. This field corresponds to that number.
Accepted Boolean Whether the action was accepted

Creative Inventory Action

While the user is in the standard inventory (i.e., not a crafting bench) in Creative mode, the player will send this packet.

Clicking in the creative inventory menu is quite different from non-creative inventory management. Picking up an item with the mouse actually deletes the item from the server, and placing an item into a slot or dropping it out of the inventory actually tells the server to create the item from scratch. (This can be verified by clicking an item that you don't mind deleting, then severing the connection to the server; the item will be nowhere to be found when you log back in.) As a result of this implementation strategy, the "Destroy Item" slot is just a client-side implementation detail that means "I don't intend to recreate this item.". Additionally, the long listings of items (by category, etc.) are a client-side interface for choosing which item to create. Picking up an item from such listings sends no packets to the server; only when you put it somewhere does it tell the server to create the item in that location.

This action can be described as “set inventory slot”. Picking up an item sets the slot to item ID -1. Placing an item into an inventory slot sets the slot to the specified item. Dropping an item (by clicking outside the window) effectively sets slot -1 to the specified item, which causes the server to spawn the item entity, etc.. All other inventory slots are numbered the same as the non-creative inventory (including slots for the 2×2 crafting menu, even though they aren't visible in the vanilla client).

Packet ID State Bound To Field Name Field Type Notes
0x10 0x11 Play Server Slot Short Inventory slot
Clicked Item Slot

Enchant Item

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

Update Sign

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

Packet ID State Bound To Field Name Field Type Notes
0x12 0x13 Play Server Location Position Block Coordinates
Line 1 Chat String First line of text in the sign
Line 2 Chat String Second line of text in the sign
Line 3 Chat String Third line of text in the sign
Line 4 Chat String Fourth line of text in the sign

Player Abilities

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

The vanilla client sends this packet when the player starts/stops flying with the second parameter changed accordingly. All other parameters are ignored by the vanilla server.

Packet ID State Bound To Field Name Field Type Notes
0x13 0x14 Play Server Flags Byte Bit mask. 0x08: damage disabled (god mode), 0x04: can fly, 0x02: is flying, 0x01: is Creative
Flying Speed Float
Walking Speed Float

Tab-Complete

Sent when the user presses tab while writing text.

Packet ID State Bound To Field Name Field Type Notes
0x14 0x15 Play Server Text String All text behind the cursor
Has Position Boolean
Looked At Block Optional Position The position of the block being looked at. Only sent if Has Position is true

Client Settings

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

Packet ID State Bound To Field Name Field Type Notes
0x15 0x16 Play Server Locale String e.g. en_GB
View Distance Byte Client-side render distance, in chunks
Chat Mode Byte VarInt 0: enabled, 1: commands only, 2: hidden
Chat Colors Boolean “Colors” multiplayer setting
Displayed Skin Parts Unsigned Byte Skin parts, see note below
Main Hand VarInt 0: Left, 1: Right

Displayed Skin Parts flags:

  • Bit 0 (0x01): Cape enabled
  • Bit 1 (0x02): Jacket enabled
  • Bit 2 (0x04): Left Sleeve enabled
  • Bit 3 (0x08): Right Sleeve enabled
  • Bit 4 (0x10): Left Pants Leg enabled
  • Bit 5 (0x20): Right Pants Leg enabled
  • Bit 6 (0x40): Hat enabled

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

Client Status

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

Packet ID State Bound To Field Name Field Type Notes
0x16 0x17 Play Server Action ID VarInt See below

Action ID values:

Action ID Action
0 Perform respawn
1 Request stats
2 Taking Inventory achievement Open Inventory

Plugin Message

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

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

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

Packet ID State Bound To Field Name Field Type Notes
0x17 0x18 Play Server Channel String Name of the plugin channel used to send the data
Data Byte Array Any data, depending on the channel. MC| channels are documented here.

Spectate

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

Resource Pack Status

Packet ID State Bound To Field Name Field Type Notes
0x19 0x1A Play Server Hash String The hash sent in the Resource Pack Send packet.
Result VarInt 0: successfully loaded, 1: declined, 2: failed download, 3: accepted

Status

Clientbound

No changes so far.

Serverbound

No changes so far.

Login

Clientbound

No changes so far.

Serverbound

No changes so far.