Pre-release protocol

From wiki.vg
Revision as of 11:32, 20 January 2019 by Cybermaxke (talk | contribs) (Fix issues in recipe type table.)
Jump to navigation Jump to search

This page documents the changes from the last stable Minecraft release (currently 1.13.2, protocol 404) to the current pre-release (currently 19w03b, protocol 455). 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

Position

64-bit value split in to three parts

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

Encoded as followed:

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

And decoded as:

val = read_unsigned_long();
x = val >> 38;
y = (val >> 26) & 0xFFF val & 0xFFF;
z = val << 38 >> 38 (val << 38 >> 38) >> 12;

Note: The details of bit shifting are rather language dependent; the above may work in Java but probably won't in other languages without some tweaking. In particular, you will usually receive positive numbers even if the actual coordinates are negative. This can be fixed by adding something like the following:

if x >= 2^25 { x -= 2^26 }
if y >= 2^11 { y -= 2^12 }
if z >= 2^25 { z -= 2^26 }

Packets

ID Packet name Documentation
Handshaking serverbound
0x00 Handshake Current Pre
Play clientbound
0x09 Update Block Entity Current Pre
0x14 Open Horse Window Pre
0x22 Chunk Data Current Pre
0x26 Map Data Current Pre
0x2C Open Book Pre
0x2C 0x2D Open Sign Editor Current (unchanged)
0x2D 0x2E Craft Recipe Response Current (unchanged)
0x2E 0x2F Player Abilities (clientbound) Current (unchanged)
0x2F 0x30 Combat Event Current (unchanged)
0x30 0x31 Player List Item Current (unchanged)
0x31 0x32 Face Player Current (unchanged)
0x32 0x33 Player Position And Look (clientbound) Current (unchanged)
0x33 0x34 Use Bed Current (unchanged)
0x34 0x35 Unlock Recipes Current (unchanged)
0x35 0x36 Destroy Entities Current (unchanged)
0x36 0x37 Remove Entity Effect Current (unchanged)
0x37 0x38 Resource Pack Send Current (unchanged)
0x38 0x39 Respawn Current (unchanged)
0x39 0x3A Entity Head Look Current (unchanged)
0x3A 0x3B Select Advancement Tab Current (unchanged)
0x3B 0x3C World Border Current (unchanged)
0x3C 0x3D Camera Current (unchanged)
0x3D 0x3E Held Item Change (clientbound) Current (unchanged)
0x3E 0x3F Display Scoreboard Current (unchanged)
0x3F 0x40 Entity Metadata Current (unchanged)
0x40 0x41 Attach Entity Current (unchanged)
0x41 0x42 Entity Velocity Current (unchanged)
0x42 0x43 Entity Equipment Current (unchanged)
0x43 0x44 Set Experience Current (unchanged)
0x44 0x45 Update Health Current (unchanged)
0x45 0x46 Scoreboard Objective Current (unchanged)
0x46 0x47 Set Passengers Current (unchanged)
0x47 0x48 Teams Current (unchanged)
0x48 0x49 Update Score Current (unchanged)
0x49 0x4A Spawn Position Current (unchanged)
0x4A 0x4B Time Update Current (unchanged)
0x4B 0x4C Title Current (unchanged)
0x4C 0x4D Stop Sound Current (unchanged)
0x4D 0x4E Sound Effect Current (unchanged)
0x4F Entity Sound Effect Pre
0x4E 0x50 Player List Header And Footer Current (unchanged)
0x4F 0x51 Collect Item Current (unchanged)
0x50 0x52 Entity Teleport Current (unchanged)
0x51 0x53 Advancements Current (unchanged)
0x52 0x54 Entity Properties Current (unchanged)
0x53 0x55 Entity Effect Current (unchanged)
0x54 0x56 Declare Recipes Current (unchanged)
0x55 0x57 Tags Current Pre
0x58 Update Light Pre
0x14 0x59 Open Window Current Pre
0x5A Trade List Pre
Play serverbound
0x1B Recipe Book Data Current Pre
0x29 Player Block Placement Current Pre

New/modified data types

No changes so far.

Entity Metadata

Entity Metadata Format

Note that entity metadata is a totally distinct concept from block metadata. It is not required to send all metadata fields, or even any metadata fields, so long as the terminating entry is correctly sent.

Entity Metadata is an array of entries, each of which looks like the following:

Name Type Meaning
Index Unsigned Byte Unique index key determining the meaning of the following value, see the table below. If this is 0xff then the it is the end of the Entity Metadata array and no more is read.
Type Optional VarInt Enum Only if Index is not 0xff; the type of the index, see the table below
Value Optional value of Type Only if Index is not 0xff: the value of the metadata field
Value of Type field Type of Value field Notes
0 Byte
1 VarInt
2 Float
3 String
4 Chat
5 OptChat (Boolean + Optional Chat) Chat is present if the Boolean is set to true
6 Slot
7 Boolean
8 Rotation 3 floats: rotation on x, rotation on y, rotation on z
9 Position
10 OptPosition (Boolean + Optional Position) Position is present if the Boolean is set to true
11 Direction (VarInt) (Down = 0, Up = 1, North = 2, South = 3, West = 4, East = 5)
12 OptUUID (Boolean + Optional UUID) UUID is present if the Boolean is set to true
13 OptBlockID (VarInt) 0 for absent otherwise, id << 4 | data
14 NBT
15 Particle
16 Villager Data 3 VarInts: villager type, villager profession, level

Villager type (minecraft:villager_type registry):

Name ID
minecraft:desert 0
minecraft:jungle 1
minecraft:plains 2
minecraft:savanna 3
minecraft:snow 4
minecraft:swamp 5
minecraft:taiga 6

Villager professions (minecraft:villager_profession registry):

Name ID
minecraft:none 0
minecraft:armorer 1
minecraft:butcher 2
minecraft:cartographer 3
minecraft:cleric 4
minecraft:farmer 5
minecraft:fisherman 6
minecraft:fletcher 7
minecraft:leatherworker 8
minecraft:librarian 9
minecraft:mason 10
minecraft:nitwit 11
minecraft:shepherd 12
minecraft:toolsmith 13
minecraft:weaponsmith 14

Mobs

Entity IDs have shifted with the addition of some new mobs.

Itemed Throwable

Extends Throwable.

Used for all things that previously extended throwable other than potions, which already had an item.

Index Type Meaning Default
6 Slot Item empty (which behaves as if it were a specific item, depending on the subclass)

Egg

Extends Throwable.

No additional metadata.

An empty item behaves as if the item were a minecraft:egg.

Ender Pearl

Extends Throwable.

No additional metadata.

An empty item behaves as if the item were a minecraft:ender_pearl.

Experience Bottle

Extends Throwable.

No additional metadata.

minecraft:experience_bottle

Snowball

Extends Throwable.

No additional metadata.

minecraft:snowball

Eye of Ender

Extends Entity.

Index Type Meaning Default
6 Slot Item empty (which behaves as if it were a minecraft:ender_eye)

Arrow

Extends Entity.

Abstract base class for TippedArrow (which is used for regular arrows as well as tipped ones) and Spectral Arrow.

Index Type Meaning Default
6 Byte Bit mask Meaning 0
0x01 Is critical
0x02 Is noclip (used by loyalty tridents when returning)
7 OptUUID Shooter UUID Empty
8 Byte Piercing level 0

TippedArrow

Extends Arrow.

Used for both tipped and regular arrows. If not tipped, then color is set to -1 and no tipped arrow particles are used.

Index Type Meaning Default
8 9 VarInt Color (-1 for no particles) -1

Trident

Extends Arrow.

Index Type Meaning Default
8 9 VarInt Loyalty level (enchantment) 0

Itemed Fireball

Extends Entity.

Used for regular and small fireballs. Not used for dragon fireballs and wither skulls. Interestingly, regular fireballs do not come from an item.

Index Type Meaning Default
6 Slot Item empty (which behaves as if it were a minecraft:fire_charge)

Fireball

Extends Abstract Fireball Itemed Fireball. This is the large fireball shot by ghasts.

No additional metadata.

Small Fireball

Extends Abstract Fireball Itemed Fireball. This is the fireball shot by blazes and dispensers with fire charges.

No additional metadata.

Fireworks

Extends Entity.

Index Type Meaning Default
6 Slot Firework info empty
7 VarInt OptUUID Entity ID UUID of entity which used firework (for elytra boosting) 0
8 Boolean Shot at angle (from a crossbow) false

Illager Beast

Extends Monster

No additional metadata.

Status Description
4 Starts the attack animation.
39 Starts the stun animation.

Panda

Extends Animal.

Index Type Meaning Default
13 Integer Breed timer? Set to 32 when something happens, and then counts down to 0 again. At 29 and 14 (before counting down), will play the entity.panda.cant_breed sound event. 0
14 Integer Sneeze timer. Counts up from 0; when it hits 1 the entity.panda.pre_sneeze event plays and when it hits 21 the entity.panda.sneeze event plays (and it is set back to 0 and the sneeze flag is cleared). 0
15 Integer Eat timer. If nonzero, counts upwards. 0
16 Byte Main Gene 0
17 Byte Hidden Gene 0
18 Byte Bit mask Meaning 0
0x01 Unused
0x02 Is sneezing
0x04 Is eating
0x08 Unknown
0x10 Unknown

Pillager

Extends Abstract Illlager.

Index Type Meaning Default
13 Boolean Using crossbow false

Ocelot

Extends TameableAnimal Ageable.

Index Type Meaning Default
15 VarInt Type (0 = untamed, 1 = tuxedo, 2 = tabby, 3 = siamese). Used to render regardless as to whether it is tamed or not. 0
13 Boolean Is trusting false
Status Description
40 Spawn smoke particles (trust gaining failed)
41 Spawn heart particles (trust gaining succeeded)

Cat

Extends TameableAnimal.

Index Type Meaning Default
15 VarInt Type (0 = tabby, 1 = black, 2 = red, 3 = siamese, 4 = british_shorthair, 5 = calico, 6 = persian, 7 = ragdoll, 8 = white, 9 = all_black) 1
16 Boolean Unknown false
17 Boolean Unknown false
18 VarInt Collar color (values are those used with dyes) 14 (Red)

Villager

Extends Ageable.

Index Type Meaning Default
13 VarInt Villager Data Villager Data 0 Plains/None/1

Zombie Villager

Extends Zombie.

Index Type Meaning Default
16 Boolean Is converting false
17 VarInt Villager Data Profession Villager Data 0 Plains/None/1

Block Actions

No changes so far.

Plugin Channels

minecraft:book_open

Server to client

When a player right clicks with a signed book. This tells the client to open the book GUI.

The payload is a VarInt enum for the selected hand: 0 for the main hand, 1 for the offhand.

Replaced with Open Book packet.

minecraft:trader_list

Server to client

The list of trades a villager NPC is offering.

Replaced with Trade List packet.

Play

Clientbound

Update Block Entity

Sets the block entity associated with the block at the given location.

Packet ID State Bound To Field Name Field Type Notes
0x09 Play Client Location Position
Action Unsigned Byte The type of update to perform, see below
NBT Data NBT Tag Data to set. May be a TAG_END (0), in which case the block entity at the given location is removed (though this is not required since the client will remove the block entity automatically on chunk unload or block removal)

Action field:

  • 1: Set data of a mob spawner (everything except for SpawnPotentials: current delay, min/max delay, mob to be spawned, spawn count, spawn range, etc.)
  • 2: Set command block text (command and last execution status)
  • 3: Set the level, primary, and secondary powers of a beacon
  • 4: Set rotation and skin of mob head
  • 5: Declare a conduit
  • 6: Set base color and patterns on a banner
  • 7: Set the data for a Structure tile entity
  • 8: Set the destination for a end gateway
  • 9: Set the text on a sign
  • 10: Declare a shulker box, no data appears to be sent and the client seems to do fine without this packet. Perhaps it is a leftover from earlier versions?
  • 11: Declare a bed
  • 12: Set data of a jigsaw block
  • 13: Set items in a campfire

Open Horse Window

This packet is used exclusively for opening the horse GUI. Open Window is used for all other GUIs, and now has ID 0x59.

Packet ID State Bound To Field Name Field Type Notes
0x14 Play Client Window ID? Byte
Number of slots? VarInt
Entity ID? Integer

Chunk Data

Main article: Chunk Format
See also: #Unload Chunk

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. This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with Update Block Entity later).

Packet ID State Bound To Field Name Field Type Notes
0x22 Play Client Chunk X Int Chunk coordinate (block coordinate divided by 16, rounded down)
Chunk Z Int Chunk coordinate (block coordinate divided by 16, rounded down)
Full chunk Boolean See Chunk Format
Primary Bit Mask VarInt Bitmask with bits set to 1 for every 16×16×16 chunk section whose data is included in Data. The least significant bit represents the chunk section at the bottom of the chunk column (from y=0 to y=15).
Heightmaps NBT Compound containing one long array named MOTION_BLOCKING, which is a heightmap for the highest solid block at each position in the chunk (as a compacted long array with 256 entries at 9 bits per entry).
Size VarInt Size of Data in bytes
Data Byte array See data structure in Chunk Format
Number of block entities VarInt Number of elements in the following array
Block entities Array of NBT All block entities in the chunk. Use the x, y, and z tags in the NBT to determine their positions.
Data structure

The data section of the packet contains most of the useful data for the chunk.

Field Name Field Type Notes
Data Array of Chunk Section The number of elements in the array is equal to the number of bits set in Primary Bit Mask. Sections are sent bottom-to-top, i.e. the first section, if sent, extends from Y=0 to Y=15.
Biomes Optional Int Array Only sent if Ground-Up Continuous is true; 256 entries if present
Chunk Section structure

A Chunk Section is defined in terms of other data types. A Chunk Section consists of the following fields:

Field Name Field Type Notes
Block count Short Number of non-air blocks present in the chunk section, for lighting purposes. "Non-air" is defined as any block other than air, cave air, and void air (in particular, note that fluids such as water are still counted).
Bits Per Block Unsigned Byte Determines how many bits are used to encode a block. Note that not all numbers are valid here.
Palette Varies See below for the format.
Data Array Length VarInt Number of longs in the following array
Data Array Array of Long Compacted list of 4096 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

Data Array, Block Light, and Sky Light are is given for each block with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates. For the half-byte light arrays, even-indexed items (those with an even x coordinate, starting at 0) are packed into the low bits, odd-indexed into the high bits.

Map Data

Updates a rectangular area on a map item.

Packet ID State Bound To Field Name Field Type Notes
0x26 Play Client Map ID VarInt 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 player and item frame icons are shown
Locked Boolean True if the map has been locked in a cartography table
Icon Count VarInt Number of elements in the following array
Icon Type Array VarInt enum See below
X Byte Map coordinates: -128 for furthest left, +127 for furthest right
Z Byte Map coordinates: -128 for highest, +127 for lowest
Direction Byte 0-15
Has Display Name Boolean
Display Name Optional Chat Only present if previous Boolean is true
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

For icons, a direction of 0 is a vertical icon and increments by 22.5° (360/16).

Types are based off of rows and columns in map_icons.png:

Icon type Result
0 White arrow (players)
1 Green arrow (item frames)
2 Red arrow
3 Blue arrow
4 White cross
5 Red pointer
6 White circle (off-map players)
7 Small white circle (far-off-map players)
8 Mansion
9 Temple
10 White Banner
11 Orange Banner
12 Magenta Banner
13 Light Blue Banner
14 Yellow Banner
15 Lime Banner
16 Pink Banner
17 Gray Banner
18 Light Gray Banner
19 Cyan Banner
20 Purple Banner
21 Blue Banner
22 Brown Banner
23 Green Banner
24 Red Banner
25 Black Banner
26 Treasure marker

Open Book

Sent when a player right clicks with a signed book. This tells the client to open the book GUI.

Packet ID State Bound To Field Name Field Type Notes
0x2C Play Client Hand VarInt enum 0: Main hand, 1: Off hand

Entity Sound Effect

Plays a sound effect from an entity.

Packet ID State Bound To Field Name Field Type Notes
0x4F Play Client Sound ID VarInt ID of hardcoded sound event (events as of 18w48a)
Sound Category VarInt Enum The category that this sound will be played from (current categories)
Entity ID VarInt
Volume Float 1.0 is 100%, capped between 0.0 and 1.0 by Notchian clients
Pitch Float Float between 0.5 and 2.0 by Notchian clients

Tags

Packet ID State Bound To Field Name Field Type Notes
0x55 0x57 Play Client Block Tags (See below) IDs are block IDs
Item Tags (See below) IDs are item IDs
Fluid Tags (See below) IDs are fluid IDs
Entity Tags (See below) IDs are entity type IDs

Declare Recipes

Packet ID State Bound To Field Name Field Type Notes
0x54 0x56 Play Client Num Recipes VarInt Number of elements in the following array
Recipe Recipe ID Array Identifier
Type String Identifier The recipe serializer, see below
Recipe ID Identifier
Data Optional, varies Additional data for the recipe. For some types, there will be no data.

Recipe serializers:

Serializer Description Data
minecraft:crafting_shapeless Shapeless crafting recipe. All items in the ingredient list must be present, but in any order/slot. As follows:
Name Type Description
Group String Used to group similar recipes together in the recipe book. Tag is present in recipe JSON.
Ingredient count VarInt Number of elements in the following array
Ingredients Array of Ingredient
Result Slot
minecraft:crafting_shaped Shaped crafting recipe. All items must be present in the same pattern (which may be flipped horizontally or translated) As follows:
Name Type Description
Width VarInt
Height VarInt
Group String Used to group similar recipes together in the recipe book. Tag is present in recipe JSON.
Ingredients Array of Ingredient Length is width * height. Indexed by x + (y * width).
Result Slot
minecraft:crafting_special_armordye Recipe for dying leather armor None
minecraft:crafting_special_bookcloning Recipe for copying contents of written books None
minecraft:crafting_special_mapcloning Recipe for copying maps None
minecraft:crafting_special_mapextending Recipe for adding paper to maps None
minecraft:crafting_special_firework_rocket Recipe for making firework rockets None
minecraft:crafting_special_firework_star Recipe for making firework stars None
minecraft:crafting_special_firework_star_fade Recipe for making firework stars fade between multiple colors None
minecraft:crafting_special_repairitem Recipe for repairing items via crafting None
minecraft:crafting_special_tippedarrow Recipe for crafting tipped arrows None
minecraft:crafting_special_bannerduplicate Recipe for copying banner patterns None
minecraft:crafting_special_banneraddpattern Recipe for adding patterns to banners None
minecraft:crafting_special_shielddecoration Recipe for applying a banner's pattern to a shield None
minecraft:crafting_special_shulkerboxcoloring Recipe for recoloring a shulker box None
minecraft:crafting_special_suspiciousstew Recipe for crafting suspicious stew with various affects. None
minecraft:smelting Smelting recipe All of these have the same format, as follows:
Name Type Description
Group String Used to group similar recipes together in the recipe book.
Ingredient Ingredient
Result Slot
Experience Float
Cooking time VarInt
minecraft:blasting Recipes in a blast furnace.
minecraft:smoking Recipes in a smoker.
minecraft:campfire_cooking Recipes in a campfire.

Ingredient is defined as:

Name Type Description
Count VarInt Number of elements in the following array
Items Array of Slot Any item in this array may be used for the recipe. The count of each item should be 1.

Update Light

Updates light levels for a chunk.

Packet ID State Bound To Field Name Field Type Notes
0x58 Play Client Chunk X VarInt Chunk coordinate (block coordinate divided by 16, rounded down)
Chunk Z VarInt Chunk coordinate (block coordinate divided by 16, rounded down)
Sky Light Mask VarInt Mask containing 18 bits, with the lowest bit corresponding to chunk section -1 (in the void, y=-16 to y=-1) and the highest bit for chunk section 16 (above the world, y=256 to y=271)
Block Light Mask VarInt Mask containing 18 bits, with the same order as sky light
Empty Sky Light Mask VarInt Mask containing 18 bits, which indicates sections that have 0 for all their sky light values. If a section is set in both this mask and the main sky light mask, it is ignored for this mask and it is included in the sky light arrays (the notchian server does not create such masks). If it is only set in this mask, it is not included in the sky light arrays.
Empty Block Light Mask VarInt Mask containing 18 bits, which indicates sections that have 0 for all their block light values. If a section is set in both this mask and the main block light mask, it is ignored for this mask and it is included in the block light arrays (the notchian server does not create such masks). If it is only set in this mask, it is not included in the block light arrays.
Sky Light arrays Array of arrays of 2048 bytes There is 1 array for each bit set to true in the sky light mask, starting with the lowest value. Half a byte per light value.
Block Light arrays Array of arrays of 2048 bytes There is 1 array for each bit set to true in the block light mask, starting with the lowest value. Half a byte per light value.

Individual block or sky light arrays are is given for each block with increasing x coordinates, within rows of increasing z coordinates, within layers of increasing y coordinates. Even-indexed items (those with an even x coordinate, starting at 0) are packed into the low bits, odd-indexed into the high bits.

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. For horses, use Open Horse Window

Packet ID State Bound To Field Name Field Type Notes
0x14 0x59 Play Client Window ID Unsigned Byte VarInt A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1.
Window Type String (32) VarInt The window type to use for display. See Inventory for a list contained in the minecraft:menu regisry.
Window Title Chat The title of the window
Number Of Slots Unsigned Byte Number of slots in the window (excluding the number of slots in the player inventory). Always 0 for non-storage windows (e.g. Workbench, Anvil).
Entity ID Optional Int EntityHorse's EID. Only sent when Window Type is “EntityHorse”

Trade List

The list of trades a villager NPC is offering.

Packet ID State Bound To Field Name Field Type Notes
0x5A Play Client
Window ID VarInt The ID of the window that is open; this is an int rather than a byte.
Size Byte The number of trades in the following array
Trades Input item 1 Array Slot The first item the villager is buying
Output item Slot The item the villager is selling
Has second item Boolean Whether there is a second item
Input item 2 Optional Slot The second item the villager is buying; only present if they have a second item.
Trade disabled Boolean True if the trade is disabled; false if the trade is enabled.
Number of trade uses Integer Number of times the trade has been used so far
Maximum number of trade uses Integer Number of times this trade can be used

Serverbound

Recipe Book Data

Packet ID State Bound To Field Name Field Type Notes
0x1B Play Server Type VarInt Determines the format of the rest of the packet
Type Field Name
0: Displayed Recipe Recipe ID Identifier A recipe ID
1: Recipe Book States Crafting Recipe Book Open Boolean Whether the player has the crafting recipe book currently opened/active.
Crafting Recipe Filter Active Boolean Whether the player has the crafting recipe book filter option currently active.
Smelting Recipe Book Open Boolean Whether the player has the smelting recipe book currently opened/active.
Smelting Recipe Filter Active Boolean Whether the player has the smelting recipe book filter option currently active.
Blasting Recipe Book Open Boolean May be swapped with smoking recipe book. Also, the notchian client appears to use the same value for both of those books currently.
Blasting Recipe Filter Active Boolean May be swapped with smoking recipe book. Also, the notchian client appears to use the same value for both of those books currently.
Smoking Recipe Book Open Boolean
Smoking Recipe Filter Active Boolean

The Recipe Book Status type is sent when one of the states changes.

Player Block Placement

Packet ID State Bound To Field Name Field Type Notes
0x29 Play Server Location Position Block position
Face VarInt Enum The face on which the block is placed (as documented at Player Digging)
Hand VarInt Enum The hand from which the block is placed; 0: main hand, 1: off hand
Location Position Block position
Face VarInt Enum The face on which the block is placed (as documented at Player Digging)
Cursor Position X Float The position of the crosshair on the block, from 0 to 1 increasing from west to east
Cursor Position Y Float The position of the crosshair on the block, from 0 to 1 increasing from bottom to top
Cursor Position Z Float The position of the crosshair on the block, from 0 to 1 increasing from north to south
Inside block Boolean True when the player's head is inside of a block.

Upon placing a block, this packet is sent once.

The Cursor Position X/Y/Z fields (also known as in-block coordinates) are calculated using raytracing. The unit corresponds to sixteen pixel in the default resource pack. For example, let's say a slab is being placed against the south face of a full block. The Cursor Position X will be higher if the player was pointing near the right (east) edge of the face, lower if pointing near the left. The Cursor Position Y will be used to determine whether it will appear as a bottom slab (values 0.0–0.5) or as a top slab (values 0.5-1.0). The Cursor Position Z should be 1.0 since the player was looking at the southernmost part of the block.

Inside block is true when a player's head (specifically eyes) are inside of a block's collision. In 1.13 and later versions, collision is rather complicated and individual blocks can have multiple collision boxes. For instance, a ring of vines has a non-colliding hole in the middle. This value is only true when the player is directly in the box. In practice, though, this value is only used by scaffolding to place in front of the player when sneaking inside of it (other blocks will place behind when you intersect with them -- try with glass for instance).

Handshaking

Clientbound

There are no clientbound packets in the Handshaking state, since the protocol immediately switches to a different state after the client sends the first packet.

Serverbound

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 404 455)
Server Address String Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. The Notchian server does not use this information.
Server Port Unsigned Short Default is 25565. The Notchian server does not use this information.
Next State VarInt Enum 1 for status, 2 for login

Status

Clientbound

No changes so far.

Serverbound

No changes so far.

Login

Clientbound

No changes so far.

Serverbound

No changes so far.