![]() |
FourKit 29eeeb8
The LCE C# Server Plugin API
|
This page covers how to manually send raw packets to clients using the PlayerConnection API. This is an experimental feature for advanced use cases where you need to send data that FourKit doesnt yet wrap in its API.
This API is experimental and may change. You are responsible for constructing valid packets!!! malformed data can crash or disconnect the client.
Also please keep in mind, some of this info may not be accurate! Feel free to improve this by contributing on the Github.
Every Minecraft packet on the wire looks like this:
| Field | Size | Description |
|---|---|---|
| Size | 4 bytes (big-endian) | Total length of the remaining data (packet ID + payload). Written automatically by the server.. you do NOT include it. |
| Packet ID | 1 byte | Which packet this is. Only the low byte matters on the wire even though IDs are int in source. |
| Payload | variable | The rest of the packet data, format depends on the packet ID. |
When you call PlayerConnection.send(byte[] data), the server prepends the 4-byte big-endian size header for you. Your byte array should start with the packet ID byte followed by the payload.
All multi-byte values are big-endian (most significant byte first).
| Type | Size | Description |
|---|---|---|
| byte | 1 | Unsigned 8-bit integer (0-255). |
| bool | 1 | 0 = false, non-zero = true. |
| short | 2 | Signed 16-bit integer. |
| int | 4 | Signed 32-bit integer. |
| long | 8 | Signed 64-bit integer. |
| float | 4 | IEEE 754 single-precision float. |
| utf | 2 + n | Modified UTF-8 string: short byte-length prefix followed by that many bytes of data. See String Encoding. |
| item | variable | Item data (item ID, count, damage). See Item Data. |
| metadata | variable | Entity metadata (SynchedEntityData). See Metadata Encoding. |
Strings use modified UTF-8 encoding:
For most ASCII text (chat messages, names, etc.) this is identical to standard UTF-8. A helper to write a string:
Several container packets include serialized item data. The wire format for a single item slot is:
| Field | Type | Description |
|---|---|---|
| id | short | Item ID. -1 means the slot is empty (no further fields follow). |
| count | byte | Stack size. |
| damage | short | Damage/metadata value. |
If the item ID is -1, only the short is written (2 bytes for an empty slot). Otherwise all three fields are written (5 bytes).
Entity metadata is used in packets like AddMobPacket (24), AddPlayerPacket (20), and SetEntityDataPacket (40). It's a list of typed key-value entries terminated by 0x7F.
Each entry starts with a 1-byte header:
So the header byte is (type << 5) | (id & 0x1F).
The value immediately follows, sized based on the type:
| Type ID | Name | Value Size |
|---|---|---|
| 0 | Byte | 1 byte |
| 1 | Short | 2 bytes |
| 2 | Int | 4 bytes |
| 3 | Float | 4 bytes |
| 4 | String | utf (2-byte length prefix + string data) |
| 5 | ItemInstance | item (see Item Data) |
After all entries, write 0x7F as the EOF marker.
These are the data slot IDs used by the entity class hierarchy. When constructing metadata, define these in order and use the correct type.
Entity (base):
| ID | Type | Name | Description |
|---|---|---|---|
| 0 | Byte | DATA_SHARED_FLAGS | Bitfield: bit 0=on fire, 1=sneaking, 3=sprinting, 4=using item, 5=invisible, 6=idle anim |
| 1 | Short | DATA_AIR_SUPPLY | Air supply (default 300, max 300) |
LivingEntity:
| ID | Type | Name | Description |
|---|---|---|---|
| 6 | Float | DATA_HEALTH | Health value (default 1.0) |
| 7 | Int | DATA_EFFECT_COLOR | Potion effect color (default 0) |
| 8 | Byte | DATA_EFFECT_AMBIENCE | Potion effect ambience (default 0) |
| 9 | Byte | DATA_ARROW_COUNT | Number of arrows stuck in entity (default 0) |
Mob:
| ID | Type | Name | Description |
|---|---|---|---|
| 10 | String | DATA_CUSTOM_NAME | Custom name tag (default "") |
| 11 | Byte | DATA_CUSTOM_NAME_VISIBLE | Show name tag (0 or 1, default 0) |
For example, to write metadata for a basic mob with a custom name:
Helper methods for writing big-endian values into a byte[] buffer:
Some fields use fixed-point encoding integers on the wire representing floats/doubles with a multiplier applied:
| Data Type | Multiplier | Wire Type | Description |
|---|---|---|---|
| Entity position | x 32 | int | (int)(position * 32). 1/32 block precision. |
| Sound position | x 8 | int | (int)(position * 8). 1/8 block precision. |
| Rotation | x 256 / 360 | byte | (byte)(angle * 256.0 / 360.0). |
| Velocity | x 8000 | short | (short)(velocity * 8000.0), clamped to +/-3.9 blocks/tick before encoding. |
Sends a LevelSoundPacket (ID 62) to play a ghast scream at the player's location whenever they chat.
Sound type IDs correspond to the Sound enum. Cast any Sound value to int to get the wire value, for example (int)Sound.GHAST_SCREAM is 19.
GameEventPacket (ID 70) notifies the client of game state changes.
TeleportEntityPacket (ID 34) moves an entity to an absolute position on the client.
SetTimePacket (ID 4) updates the client's world time.
SetHealthPacket (ID 8) updates the client's health, food, and saturation display.
PlayerAbilitiesPacket (ID 202) updates the player's ability flags and speeds.
ExplodePacket (ID 60) creates a client-side explosion with optional block destruction and knockback.
SetExperiencePacket (ID 43) updates the XP bar.
All server-to-client packet layouts. The packet ID byte is always buffer[0] and is not listed in the field tables below. only the payload after the ID is shown.
Connection keepalive. The client echoes this back.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | id | Keepalive ID. The client should respond with the same value. |
Total payload: 4 bytes.
Send a chat/system message to the client.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | short | messageType | Message type enum value. |
| 2 | short | packedCounts | Packed field: high nibble = string arg count, low nibble = int arg count. Computed as (stringCount << 4) \| intCount. |
| 4 | utf[] | stringArgs | Variable number of utf strings (the message text, source name, item name, etc). |
| ... | int[] | intArgs | Variable number of int values (for example source entity type). |
Total payload: variable. For a simple chat message, messageType = 0, one string arg (the message), zero int args. The packed counts would be (1 << 4) | 0 = 0x0010.
Disconnect the client.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | reason | Disconnect reason code. |
Total payload: 4 bytes.
Set world time.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | long | gameTime | Total game time in ticks (monotonically increasing). |
| 8 | long | dayTime | Time of day in ticks (0-24000 range). |
Total payload: 16 bytes.
Set the world spawn point.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | x | Spawn X coordinate. |
| 4 | int | y | Spawn Y coordinate. |
| 8 | int | z | Spawn Z coordinate. |
Total payload: 12 bytes.
Sent on respawn or dimension change.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | byte | dimension | Dimension ID (0=Overworld, -1=Nether, 1=End). |
| 1 | byte | gameType | Game mode ID (0=Survival, 1=Creative, 2=Adventure). |
| 2 | short | mapHeight | World height. |
| 4 | utf | levelType | Level type name (for example "DEFAULT", "FLAT"). |
| ... | long | mapSeed | World seed. |
| ... | byte | difficulty | Difficulty (0=Peaceful, 1=Easy, 2=Normal, 3=Hard). |
| ... | bool | newSeaLevel | Whether the new sea level is active. |
| ... | short | newEntityId | The player's new entity ID. |
| ... | short | xzSize | World XZ size. |
| ... | byte | hellScale | Nether scale factor. |
Total payload: variable (depends on level type string length).
Update a single block.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | x | Block X coordinate. |
| 4 | byte | y | Block Y coordinate (0-255). |
| 5 | int | z | Block Z coordinate. |
| 9 | short | block | Block type ID. |
| 11 | byte | dataLevel | Block data/metadata value. |
Total payload: 12 bytes.
Trigger a block action (note blocks, pistons, chests).
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | x | Block X coordinate. |
| 4 | short | y | Block Y coordinate. |
| 6 | int | z | Block Z coordinate. |
| 10 | byte | b0 | Action parameter 1 (depends on block type). |
| 11 | byte | b1 | Action parameter 2 (depends on block type). |
| 12 | short | tile | Block type ID. |
Total payload: 14 bytes.
Show a block breaking animation (crack overlay).
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | id | Breaker entity ID. |
| 4 | int | x | Block X coordinate. |
| 8 | int | y | Block Y coordinate. |
| 12 | int | z | Block Z coordinate. |
| 16 | byte | state | Destroy stage (0-9). Any other value removes the overlay. |
Total payload: 17 bytes.
Explosion with optional block destruction and knockback.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | bool | knockbackOnly | If true, only knockback fields follow (no position/radius/blocks). |
If knockbackOnly is false (typical explosion):
| Offset | Type | Field | Description |
|---|---|---|---|
| 1 | double | x | Explosion center X. |
| 9 | double | y | Explosion center Y. |
| 17 | double | z | Explosion center Z. |
| 25 | float | radius | Explosion radius. |
| 29 | int | count | Number of destroyed block offsets. |
| 33 | byte[count*3] | offsets | For each block: 3 signed bytes (dx, dy, dz) relative to the center. |
| ... | float | knockbackX | Player knockback velocity X. |
| ... | float | knockbackY | Player knockback velocity Y. |
| ... | float | knockbackZ | Player knockback velocity Z. |
If knockbackOnly is true (just apply knockback, no visual explosion):
| Offset | Type | Field | Description |
|---|---|---|---|
| 1 | float | knockbackX | Player knockback velocity X. |
| 5 | float | knockbackY | Player knockback velocity Y. |
| 9 | float | knockbackZ | Player knockback velocity Z. |
Total payload: variable.
World event (sounds, particles, door effects, etc).
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | type | Event type ID (for example 1000=click sound, 1005=bow sound, 2000=smoke, 2001=break block). |
| 4 | int | x | Block X coordinate. |
| 8 | byte | y | Block Y coordinate. |
| 9 | int | z | Block Z coordinate. |
| 13 | int | data | Event-specific data (for example block ID for break effect, direction for smoke). |
| 17 | bool | globalEvent | If true, event is global (all players hear it regardless of distance). |
Total payload: 18 bytes.
Play a sound at a position. Positions use x8 scaling.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | soundId | Sound type ID. Maps to the Sound enum. |
| 4 | int | x | X coordinate * 8. |
| 8 | int | y | Y coordinate * 8. |
| 12 | int | z | Z coordinate * 8. |
| 16 | float | volume | Sound volume (1.0 = normal). |
| 20 | float | pitch | Sound pitch (1.0 = normal). |
Total payload: 24 bytes.
Spawn particles at a position.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | utf | name | Particle name string (for example "flame", "smoke", "heart"). |
| ... | float | x | Center X coordinate. |
| ... | float | y | Center Y coordinate. |
| ... | float | z | Center Z coordinate. |
| ... | float | xDist | Random X offset range. |
| ... | float | yDist | Random Y offset range. |
| ... | float | zDist | Random Z offset range. |
| ... | float | maxSpeed | Maximum particle speed. |
| ... | int | count | Number of particles to spawn. |
Total payload: variable (depends on particle name string length) + 32 bytes for the fixed fields.
Game state change notification.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | byte | event | Event type. |
| 1 | byte | param | Event parameter. |
Event types:
| Value | Name | Parameter |
|---|---|---|
| 0 | No Bed | (unused) |
| 1 | Start Rain | (unused) |
| 2 | Stop Rain | (unused) |
| 3 | Change Game Mode | 0=Survival, 1=Creative, 2=Adventure |
| 4 | Win Game | 0=show credits, 1=just respawn |
Total payload: 2 bytes.
Update sign text.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | x | Sign X coordinate. |
| 4 | short | y | Sign Y coordinate. |
| 6 | int | z | Sign Z coordinate. |
| 10 | bool | verified | Whether the sign text has been verified. |
| 11 | bool | censored | Whether the sign text has been censored. |
| 12 | utf | line1 | First line of text. |
| ... | utf | line2 | Second line of text. |
| ... | utf | line3 | Third line of text. |
| ... | utf | line4 | Fourth line of text. |
Total payload: variable (12 bytes fixed + 4 * utf strings).
Update health, food, and saturation.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | float | health | Current health (0.0-20.0, 20 = full). |
| 4 | short | food | Food level (0-20). |
| 6 | float | saturation | Food saturation level. |
| 10 | byte | damageSource | Damage source type (for telemetry). |
Total payload: 11 bytes.
Play an entity animation.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | byte | action | Animation type (1=swing arm, 2=damage, 3=leave bed, 104=crouch, 105=uncrouch). |
Total payload: 5 bytes.
Spawn a named player entity.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | utf | name | Player name. |
| ... | int | x | X coordinate * 32 (fixed-point). |
| ... | int | y | Y coordinate * 32 (fixed-point). |
| ... | int | z | Z coordinate * 32 (fixed-point). |
| ... | byte | yRot | Yaw (angle * 256 / 360). |
| ... | byte | xRot | Pitch (angle * 256 / 360). |
| ... | byte | yHeadRot | Head yaw (angle * 256 / 360). |
| ... | short | carriedItem | Item ID of held item. |
| ... | playerUID | xuid | Player XUID (8 bytes). |
| ... | playerUID | onlineXuid | Online XUID for splitscreen guests (8 bytes). |
| ... | byte | playerIndex | Local player index. |
| ... | int | skinId | Custom skin ID. |
| ... | int | capeId | Custom cape ID. |
| ... | int | gamePrivileges | Player game privileges bitfield. |
| ... | metadata | entityData | Entity metadata (SynchedEntityData). |
Total payload: variable (includes entity metadata).
Spawn a non-mob entity (minecart, arrow, falling block, etc).
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | short | entityId | Entity ID. |
| 2 | byte | type | Entity type ID (for example 1=boat, 10=minecart, 50=TNT, 60=arrow, 70=falling block). |
| 3 | int | x | X coordinate * 32 (fixed-point). |
| 7 | int | y | Y coordinate * 32 (fixed-point). |
| 11 | int | z | Z coordinate * 32 (fixed-point). |
| 15 | byte | yRot | Yaw (angle * 256 / 360). |
| 16 | byte | xRot | Pitch (angle * 256 / 360). |
| 17 | int | data | Entity-specific data (for example block ID for falling blocks, owner entity ID for projectiles). |
If data is non-zero, three additional velocity fields follow:
| Offset | Type | Field | Description |
|---|---|---|---|
| 21 | short | xVel | X velocity * 8000. |
| 23 | short | yVel | Y velocity * 8000. |
| 25 | short | zVel | Z velocity * 8000. |
Total payload: 21 bytes (no velocity) or 27 bytes (with velocity).
Spawn a mob.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | short | entityId | Entity ID. |
| 2 | byte | mobType | Mob type ID (for example 50=Creeper, 51=Skeleton, 52=Spider, 54=Zombie, 90=Pig, 91=Sheep). |
| 3 | int | x | X coordinate * 32 (fixed-point). |
| 7 | int | y | Y coordinate * 32 (fixed-point). |
| 11 | int | z | Z coordinate * 32 (fixed-point). |
| 15 | byte | yRot | Yaw (angle * 256 / 360). |
| 16 | byte | xRot | Pitch (angle * 256 / 360). |
| 17 | byte | yHeadRot | Head yaw (angle * 256 / 360). |
| 18 | short | xVel | X velocity * 8000. |
| 20 | short | yVel | Y velocity * 8000. |
| 22 | short | zVel | Z velocity * 8000. |
| 24 | metadata | entityData | Entity metadata (SynchedEntityData). |
Total payload: 24 bytes + variable metadata.
Spawn an XP orb.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | int | x | X coordinate * 32 (fixed-point). |
| 8 | int | y | Y coordinate * 32 (fixed-point). |
| 12 | int | z | Z coordinate * 32 (fixed-point). |
| 16 | short | value | XP value of the orb. |
Total payload: 18 bytes.
Set entity velocity. Has two encoding modes based on a flag bit in the entity ID field.
The first field is a short combining the entity ID and a flag:
Full precision mode (flag clear):
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | short | idAndFlag | Entity ID (low 11 bits), flag=0. |
| 2 | short | xVel | X velocity * 8000. |
| 4 | short | yVel | Y velocity * 8000. |
| 6 | short | zVel | Z velocity * 8000. |
Total payload: 8 bytes.
Compact mode (flag set, bit 11 = 1):
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | short | idAndFlag | Entity ID (low 11 bits) OR 0x0800. |
| 2 | byte | xVel | X velocity / 16 (sign-extended, then multiplied by 16 on read). |
| 3 | byte | yVel | Y velocity / 16. |
| 4 | byte | zVel | Z velocity / 16. |
Total payload: 5 bytes. The server automatically picks compact mode when velocity values fit.
Despawn one or more entities.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | byte | count | Number of entities to remove. |
| 1 | int[count] | entityIds | Array of entity IDs (4 bytes each). |
Total payload: 1 + (count * 4) bytes.
Relative entity movement/rotation updates. Four sub-types:
Packet 30 - MoveEntityPacket (base, no movement): short entityId only. Payload: 2 bytes.
Packet 31 - MoveEntityPacket.Pos (position only):
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | short | entityId | Entity ID. |
| 2 | byte | dx | X delta (signed, in 1/32 block units). |
| 3 | byte | dy | Y delta. |
| 4 | byte | dz | Z delta. |
Payload: 5 bytes.
Packet 32 - MoveEntityPacket.Rot (rotation only):
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | short | entityId | Entity ID. |
| 2 | byte | yRot | New yaw (angle * 256 / 360). |
| 3 | byte | xRot | New pitch (angle * 256 / 360). |
Payload: 4 bytes.
Packet 33 - MoveEntityPacket.PosRot (position + rotation):
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | short | entityId | Entity ID. |
| 2 | byte | dx | X delta. |
| 3 | byte | dy | Y delta. |
| 4 | byte | dz | Z delta. |
| 5 | byte | yRot | New yaw. |
| 6 | byte | xRot | New pitch. |
Payload: 7 bytes.
Teleport an entity to an absolute position.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | short | entityId | Entity ID. |
| 2 | int | x | X coordinate * 32 (fixed-point). |
| 6 | int | y | Y coordinate * 32 (fixed-point). |
| 10 | int | z | Z coordinate * 32 (fixed-point). |
| 14 | byte | yRot | Yaw (angle * 256 / 360). |
| 15 | byte | xRot | Pitch (angle * 256 / 360). |
Total payload: 16 bytes.
Update an entity's head rotation.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | byte | yHeadRot | Head yaw (angle * 256 / 360). |
Total payload: 5 bytes.
Trigger an entity event (hurt, death, eating, etc).
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | byte | eventId | Event type (2=hurt, 3=death, 9=eating finished). |
Total payload: 5 bytes.
Attach or detach entities (leash, riding).
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | sourceId | Entity being attached (the rider/leashed entity). |
| 4 | int | destId | Entity being attached to (the vehicle/fence). -1 to detach. |
| 8 | byte | type | Link type. |
Total payload: 9 bytes.
Update entity metadata. See Metadata Encoding for how to construct the metadata blob.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | metadata | data | Packed entity metadata entries. |
Total payload: 4 bytes + variable metadata.
Apply or update a potion effect.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | byte | effectId | Effect ID (1=speed, 2=slowness, 3=haste, 4=mining fatigue, 5=strength, ...). |
| 5 | byte | amplifier | Effect level (0 = level I, 1 = level II, etc). |
| 6 | short | duration | Duration in ticks. |
Total payload: 8 bytes.
Remove a potion effect.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | byte | effectId | Effect ID to remove. |
Total payload: 5 bytes.
Update the XP bar.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | float | progress | XP bar fill amount (0.0-1.0). |
| 4 | short | level | Current level. |
| 6 | short | totalXP | Total experience points. |
Total payload: 8 bytes.
Spawn a global entity (lightning bolt).
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | byte | type | Entity type (1 = lightning bolt). |
| 5 | int | x | X coordinate * 32 (fixed-point). |
| 9 | int | y | Y coordinate * 32 (fixed-point). |
| 13 | int | z | Z coordinate * 32 (fixed-point). |
Total payload: 17 bytes.
Change the visible held item for an entity.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | entityId | Entity ID. |
| 4 | short | slot | Equipment slot (0=held). |
| 6 | item | item | Item data (see Item Data). |
Total payload: 6 bytes + item data (2 bytes if empty, 5 bytes if present).
Award a statistic or achievement.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | int | statId | Statistic/achievement ID. |
| 4 | int | length | Length of parameter data blob in bytes. |
| 8 | byte[length] | data | Parameter data (typically a 4-byte int count). |
Total payload: 8 bytes + length bytes. For a simple stat increment, length = 4 and data contains an int count.
Update player abilities.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | byte | flags | Bitfield: 0x01=invulnerable, 0x02=flying, 0x04=canFly, 0x08=instabuild (creative). |
| 1 | float | flySpeed | Fly speed (default 0.05). |
| 5 | float | walkSpeed | Walk speed (default 0.1). |
Total payload: 9 bytes.
Open a container window.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | byte | containerId | Window ID. |
| 1 | byte | type | Container type (0=chest, 1=workbench, 2=furnace, 3=dispenser, 4=enchanting table). |
| 2 | byte | size | Number of slots. |
| 3 | bool | customName | Whether a custom title follows. |
If type == HORSE (type 12):
| Offset | Type | Field | Description |
|---|---|---|---|
| 4 | int | entityId | Horse entity ID. |
If customName is true:
| Offset | Type | Field | Description |
|---|---|---|---|
| ... | utf | title | Custom container title. |
Total payload: 4 bytes minimum, variable with conditionals.
Close a container window.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | byte | containerId | Window ID. |
Total payload: 1 byte.
Set a single slot in a container.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | byte | containerId | Window ID. |
| 1 | short | slot | Slot index. |
| 3 | item | item | Item data (see Item Data). |
Total payload: 3 bytes + item data (2 bytes if empty, 5 bytes if present).
Set all slots in a container.
| Offset | Type | Field | Description |
|---|---|---|---|
| 0 | byte | containerId | Window ID. |
| 1 | short | count | Number of item slots. |
| 3 | item[count] | items | Array of item data entries. |
Total payload: 3 bytes + count * item data.
Every registered packet. S-C = server to client, C-S = client to server.
Just know that some of these packets have no function (such as scoreboards), most should work.
| ID | Name | S-C | C-S | Notes |
|---|---|---|---|---|
| 0 | KeepAlivePacket | ✓ | ✓ | Connection keepalive. |
| 1 | LoginPacket | ✓ | ✓ | Login handshake. |
| 2 | PreLoginPacket | ✓ | ✓ | Pre-login handshake. |
| 3 | ChatPacket | ✓ | ✓ | Chat messages. |
| 4 | SetTimePacket | ✓ | World time. | |
| 5 | SetEquippedItemPacket | ✓ | Held item display. | |
| 6 | SetSpawnPositionPacket | ✓ | World spawn point. | |
| 7 | InteractPacket | ✓ | Player interact with entity. | |
| 8 | SetHealthPacket | ✓ | Health/food/saturation. | |
| 9 | RespawnPacket | ✓ | ✓ | Respawn/dimension change. |
| 10 | MovePlayerPacket | ✓ | ✓ | Player position (base). |
| 11 | MovePlayerPacket.Pos | ✓ | ✓ | Player position only. |
| 12 | MovePlayerPacket.Rot | ✓ | ✓ | Player rotation only. |
| 13 | MovePlayerPacket.PosRot | ✓ | ✓ | Player position + rotation. |
| 14 | PlayerActionPacket | ✓ | Block breaking, item dropping. | |
| 15 | UseItemPacket | ✓ | Place block / use item. | |
| 16 | SetCarriedItemPacket | ✓ | ✓ | Hotbar slot selection. |
| 17 | EntityActionAtPositionPacket | ✓ | Sleep in bed. | |
| 18 | AnimatePacket | ✓ | ✓ | Entity animations. |
| 19 | PlayerCommandPacket | ✓ | Sneak, sprint, etc. | |
| 20 | AddPlayerPacket | ✓ | Spawn named player. | |
| 22 | TakeItemEntityPacket | ✓ | Item pickup animation. | |
| 23 | AddEntityPacket | ✓ | Spawn non-mob entity. | |
| 24 | AddMobPacket | ✓ | Spawn mob. | |
| 25 | AddPaintingPacket | ✓ | Spawn painting. | |
| 26 | AddExperienceOrbPacket | ✓ | Spawn XP orb. | |
| 27 | PlayerInputPacket | ✓ | Vehicle steering input. | |
| 28 | SetEntityMotionPacket | ✓ | Entity velocity. | |
| 29 | RemoveEntitiesPacket | ✓ | Despawn entities. | |
| 30 | MoveEntityPacket | ✓ | Entity movement (base). | |
| 31 | MoveEntityPacket.Pos | ✓ | Entity position delta. | |
| 32 | MoveEntityPacket.Rot | ✓ | Entity rotation. | |
| 33 | MoveEntityPacket.PosRot | ✓ | Entity pos + rot delta. | |
| 34 | TeleportEntityPacket | ✓ | Entity absolute position. | |
| 35 | RotateHeadPacket | ✓ | Entity head rotation. | |
| 38 | EntityEventPacket | ✓ | Entity events (hurt, death). | |
| 39 | SetEntityLinkPacket | ✓ | Leash / riding. | |
| 40 | SetEntityDataPacket | ✓ | Entity metadata update. | |
| 41 | UpdateMobEffectPacket | ✓ | Apply potion effect. | |
| 42 | RemoveMobEffectPacket | ✓ | Remove potion effect. | |
| 43 | SetExperiencePacket | ✓ | XP bar update. | |
| 44 | UpdateAttributesPacket | ✓ | Entity attributes. | |
| 50 | ChunkVisibilityPacket | ✓ | Chunk visibility. | |
| 51 | BlockRegionUpdatePacket | ✓ | Chunk data. | |
| 52 | ChunkTilesUpdatePacket | ✓ | Multi-block change. | |
| 53 | TileUpdatePacket | ✓ | Single block change. | |
| 54 | TileEventPacket | ✓ | Block action. | |
| 55 | TileDestructionPacket | ✓ | Block breaking animation. | |
| 60 | ExplodePacket | ✓ | Explosion. | |
| 61 | LevelEventPacket | ✓ | World event (sounds, particles). | |
| 62 | LevelSoundPacket | ✓ | Sound effect. | |
| 63 | LevelParticlesPacket | ✓ | Particle effect. | |
| 70 | GameEventPacket | ✓ | Game state change. | |
| 71 | AddGlobalEntityPacket | ✓ | Lightning bolt. | |
| 100 | ContainerOpenPacket | ✓ | Open container. | |
| 101 | ContainerClosePacket | ✓ | ✓ | Close container. |
| 102 | ContainerClickPacket | ✓ | Click container slot. | |
| 103 | ContainerSetSlotPacket | ✓ | ✓ | Set container slot. |
| 104 | ContainerSetContentPacket | ✓ | Set all container slots. | |
| 105 | ContainerSetDataPacket | ✓ | Container progress bar data. | |
| 106 | ContainerAckPacket | ✓ | ✓ | Transaction acknowledgement. |
| 107 | SetCreativeModeSlotPacket | ✓ | ✓ | Creative inventory action. |
| 108 | ContainerButtonClickPacket | ✓ | Enchanting / other button. | |
| 130 | SignUpdatePacket | ✓ | ✓ | Sign text update. |
| 131 | ComplexItemDataPacket | ✓ | Map data. | |
| 132 | TileEntityDataPacket | ✓ | Tile entity NBT data. | |
| 133 | TileEditorOpenPacket | ✓ | Open tile entity editor. | |
| 200 | AwardStatPacket | ✓ | Award statistic. | |
| 201 | PlayerInfoPacket | ✓ | ✓ | Player list info. |
| 202 | PlayerAbilitiesPacket | ✓ | ✓ | Player abilities. |
| 206 | SetObjectivePacket | ✓ | Scoreboard objective. | |
| 207 | SetScorePacket | ✓ | Scoreboard score. | |
| 208 | SetDisplayObjectivePacket | ✓ | Scoreboard display slot. | |
| 209 | SetPlayerTeamPacket | ✓ | Scoreboard team. | |
| 255 | DisconnectPacket | ✓ | ✓ | Disconnect. |