technical documentation for Minecraft b1.7.3
1# Packets <img src=".assets/cc-by-sa.png" alt="CC-BY-SA" width="88" height="31">
2
3_This document is licensed under a [Creative Commons Attribution-ShareAlike 4.0
4license](https://creativecommons.org/licenses/by-sa/4.0/). Derivative works must
5be licensed using the same or a compatible license._
6
7All packets begin with a single "Packet ID" byte. Listed packet size **does not
8include** this byte. Packets are either Clientbound, Serverbound, or both.
9Packets that travel both Clientbound and Serverbound may reuse fields for
10different purposes.
11
12There is no "length" field; for variable length packets, you must parse to the
13end to determine the length.
14
15## Data Types
16
17| | Size (bytes) | Range | Notes |
18| ----- | ------------ | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
19| i8 | 1 | -128 to 127 | |
20| u8 | 1 | 0 to 255 | |
21| i16 | 2 | -32768 to 32767 | |
22| i32 | 4 | -2147483648 to 2147483647 | |
23| i64 | 8 | -9223372036854775808 to 9223372036854775807 | |
24| f32 | 4 | See [here][java8spec_floating]. | Single-precision 32-bit IEEE754 floating point. |
25| f64 | 8 | See [here][java8spec_floating]. | Double-precision 64-bit IEEE754 floating point. |
26| str8 | >=2 | N/A | [Modified UTF-8][mutf8] string. Prefixed by an `i16` containing the length of the string **in bytes**. |
27| str16 | >=2 | Minimum length of `0`, maximum character length of `32767` | [UTF-16][utf16] string. Prefixed by an `i16` containing the length of the string **in characters**. |
28| bool | 1 | `0x00` (`false`) or `0x01` (`true`) | |
29
30There are also additional types being used:
31
32### Entity types
33
34| ID | Entity | Category | LivingEntity |
35| --- | ------------- | ---------- | ------------ |
36| 1 | Item | Misc | ❌ |
37| 9 | Painting | Misc | ❌ |
38| 10 | Arrow | Projectile | ❌ |
39| 11 | Snowball | Projectile | ❌ |
40| 20 | Primed TNT | Misc | ❌ |
41| 21 | Falling Sand | Misc | ❌ |
42| 40 | Minecart | Vehicle | ❌ |
43| 41 | Boat | Vehicle | ❌ |
44| 50 | Creeper | Hostile | ✅ |
45| 51 | Skeleton | Hostile | ✅ |
46| 52 | Spider | Hostile | ✅ |
47| 53 | Giant | Hostile | ✅ |
48| 54 | Zombie | Hostile | ✅ |
49| 55 | Slime | Hostile | ✅ |
50| 56 | Ghast | Hostile | ✅ |
51| 57 | Zombie Pigman | Neutral | ✅ |
52| 90 | Pig | Passive | ✅ |
53| 91 | Sheep | Passive | ✅ |
54| 92 | Cow | Passive | ✅ |
55| 93 | Chicken | Passive | ✅ |
56| 94 | Squid | Passive | ✅ |
57| 95 | Wolf | Passive | ✅ |
58
59### Entity Metadata
60
61Entity metadata has a quirky packing format.
62
63A metadata field is a byte. The top three bits of the byte, when masked off
64(`(byte & 224) >> 5`) and interpreted as a three-bit number from 0 to 7,
65indicate the type of the field.
66
67The lower five bits are unused. The type of the byte indicates the size and
68type of a payload which follows the initial byte of the field.
69
70The metadata format consists of at least one field, followed by either another
71field or the magic number `0x7F`. `0x7F` terminates a metadata stream.
72
73Thus, the example metadata stream `0x00 0x01 0x7f` is decoded as a field of
74type 0, id 0, with a payload of byte 0x00.
75
76| Field ID | Field Type |
77| -------- | ------------------------------------------- |
78| 0 | i8 |
79| 1 | i16 |
80| 2 | i32 |
81| 3 | f32 |
82| 4 | str16 (maximum character length of 64) |
83| 5 | ItemStack; `i16` ID, `i8` count, `i16` data |
84| 6 | Vector of `i32`, 3 long (x,y,z) |
85
86More information is available at [0x18 Spawn Living Entity][spawn_living_entity].
87
88### Packed f64
89
90Sent as an `i32` on the wire, but is actually an `f64`.
91
92Java:
93
94```java
95public static int floorDouble(double aDouble) {
96 int anInteger = (int)aDouble;
97 return aDouble < (double)anInteger ? anInteger - 1 : anInteger;
98}
99```
100
101### Packed Rotation
102
103Sent as an `i8` on the wire, but is actually an `f32`.
104
105Basically, takes a rotation in degrees (`0..360`) and maps it into `0..255`.
106
107Java:
108
109```java
110public static byte packRotation(float rotation) {
111 return (byte)((int)(rotation * 256.0F / 360.0F))
112}
113```
114
115### Packed Motion i8
116
117Sent as an `i8` on the wire, but is actually an `f64`.
118
119Basically, just multiply the value by `128` and turn it into a (signed) byte.
120
121Java:
122
123```java
124public static byte packMotion(double motion) {
125 return (byte)((int)(motion * 128.0D))
126}
127```
128
129### Packed Motion i16
130
131Sent as an `i16` on the wire, but is actually an `f64`.
132
133Basically, just multiply the value by `128` and turn it into a (signed) byte.
134
135Java:
136
137```java
138public static byte packMotion(double motion) {
139 return (byte)((int)(motion * 128.0D))
140}
141```
142
143## 0x00 Keep Alive
144
145- Clientbound: [x]
146- Serverbound: [ ]
147- Size: 0
148
149This packet must be sent to keep the connection alive.
150
151- Keep Alive has no payload.
152
153## 0x01 Login Request
154
155- Clientbound: [x]
156- Serverbound: [x]
157- Size: 15 + length of strings
158
159### Clientbound
160
161Sent by the server if it accepts the client's login request. If it didn't it
162will send a [Disconnect][disconnect] instead.
163
164| Field Name | Field Type | Example | Notes |
165| ---------- | ---------- | ------- | --------------------------------------------------------------------------- |
166| Entity ID | i32 | `14` | The protocol version of Beta 1.7 is 14 |
167| Unused | str16 | N/A | Unused by the client. Vanilla server sends an empty string |
168| Map Seed | i64 | `0` | Used by the client to determine its current biome, among a few other things |
169| Dimension | i8 | `0` | `-1` for the Nether, `0` for the Overworld |
170
171### Serverbound
172
173Sent by the client after the handshake to finish logging in.
174
175| Field Name | Field Type | Example | Notes |
176| ---------------- | ---------- | ------------- | ------------------------------------------------------------------------------- |
177| Protocol version | i32 | `14` | The protocol version of Beta 1.7 is 14 |
178| Username | str16 | `kokiriglade` | The name of the player attempting to login. Max length of 16 |
179| Map Seed | i64 | `0` | Can be safely ignored by the server |
180| Dimension | i8 | `0` | `-1` for the Nether, `0` for the Overworld. Can be safely ignored by the server |
181
182## 0x02 Handshake
183
184- Clientbound: [x]
185- Serverbound: [x]
186- Size: 2 + length of strings
187
188### Clientbound
189
190| Field Name | Field Type | Example | Notes |
191| --------------- | ---------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
192| Connection Hash | str16 | `2e66f1dc032ab5f0` | A unique, per-connection hash. The vanilla server sends a random `i64` stringified as a hexadecimal number. For offline-mode, the string is always a single `-` |
193
194### Serverbound
195
196| Field Name | Field Type | Example | Notes |
197| ---------- | ---------- | ------------- | ---------------------------------------------------------------------------- |
198| Username | str16 | `kokiriglade` | The name of the player attempting to connect. Maximum character length of 16 |
199
200## 0x03 Chat Message
201
202- Clientbound: [x]
203- Serverbound: [x]
204- Size: 2 + length of strings
205
206| Field Name | Field Type | Example | Notes |
207| ---------- | ---------- | ---------------------- | ----------------------------------------------------------------------------- |
208| Message | str16 | `<kokiriglade> Hello!` | The name of the player attempting to connect. Maximum character length of 119 |
209
210## 0x04 Update Time
211
212- Clientbound: [x]
213- Serverbound: [ ]
214- Size: 8
215
216The time of day is based on `timestamp % 24000`, where:
217
218- 0 is sunrise
219- 6000 is noon
220- 12000 is sunset
221- 18000 is midnight
222
223| Field Name | Field Type | Example | Notes |
224| ---------- | ---------- | ------- | ----------------------- |
225| Time | i64 | | The world time in ticks |
226
227## 0x05 Set Player Equipment
228
229- Clientbound: [x]
230- Serverbound: [ ]
231- Size: 10
232
233After each [player spawn][spawn_player], there will be five of these packets for
234the equipped item and armor. If there are changes in visible equipment, another
235one of these packets is sent.
236
237| Field Name | Field Type | Example | Notes |
238| ---------- | ---------- | ------- | ------------------------------------ |
239| Entity ID | i32 | | Player's entity ID |
240| Slot | i16 | `4` | Equipment slot. See below |
241| Item ID | i16 | `-1` | Equipped item (`-1` for aempty slot) |
242| Data | i16 | | Item data value |
243
244### Equipment slots
245
246(These only apply to this packet)
247
248- `0`: Held item
249- `1`: Helmet
250- `2`: Chestpate
251- `3`: Leggings
252- `4`: Boots
253
254## 0x06 Spawn Position
255
256- Clientbound: [x]
257- Serverbound: [ ]
258- Size: 12
259
260Sent after login to specify the coordinates of the spawn point (the location at
261which players spawn, and which the compass points to).
262
263It can be sent at any time to update the point compasses point to.
264
265| Field Name | Field Type | Example | Notes |
266| ---------- | ---------- | ------- | ---------------------------- |
267| X | i32 | `117` | Spawn X in block coordinates |
268| Y | i32 | `70` | Spawn Y in block coordinates |
269| Z | i32 | `-46` | Spawn Z in block coordinates |
270
271## 0x07 Use Entity
272
273- Clientbound: [ ]
274- Serverbound: [x]
275- Size: 9
276
277Sent upon attacking or right clicking an entity.
278
279| Field Name | Field Type | Example | Notes |
280| ---------------- | ---------- | ------- | ----------------------------------------------------------------------- |
281| Entity ID | i32 | | Player's entity ID. Ignored by the server |
282| Target entity ID | i32 | | Entity ID of the entity being interacted with |
283| Left click | bool | `true` | `true` if the interaction was caused by a left click, `false` otherwise |
284
285## 0x08 Update Health
286
287- Clientbound: [x]
288- Serverbound: [ ]
289- Size: 2
290
291| Field Name | Field Type | Example | Notes |
292| ---------- | ---------- | ------- | ---------------- |
293| Health | i16 | `20` | Half a heart = 1 |
294
295## 0x09 Respawn
296
297- Clientbound: [X]
298- Serverbound: [X]
299- Size: 1
300
301Sent by the client when the player presses the "Respawn" button after dying.
302The server then teleports the player to the spawn point, and sends a respawn
303packet in response. The client will not leave the respawn screen until it
304receives a respawn packet.
305
306| Field Name | Field Type | Example | Notes |
307| ---------- | ---------- | ------- | ------------------------------------------------------------------------------- |
308| Dimension | i8 | `0` | `-1` for the Nether, `0` for the Overworld. Can be safely ignored by the server |
309
310## 0x0A On Ground
311
312- Clientbound: [x]
313- Serverbound: [x]
314- Size: 1
315
316| Field Name | Field Type | Example | Notes |
317| ---------- | ---------- | ------- | -------------------------------------------------------- |
318| On Ground | bool | `true` | `true` if the player is on the ground, `false` otherwise |
319
320## 0x0B Player Position
321
322- Clientbound: [x]
323- Serverbound: [x]
324- Size: 33
325
326Updates the player position on the server. If `(stance - y) < 0.1 || (stance - y) > 1.65`
327then the stance is illegal.
328
329If the distance between the last known position of
330the player and the new position set by this packet is greater than 100, then the
331movement is illegal.
332
333If the absolute number of `x` or `z` are set greater than `3.2E7` then the
334position is illegal.
335
336| Field Name | Field Type | Example | Notes |
337| ---------- | ---------- | --------- | ----------------------------------------------------------------------------- |
338| X | f64 | `102.809` | |
339| Y | f64 | `70.00` | |
340| Stance | f64 | `71.62` | Used to modify the players bounding box when going up stairs, crouching, etc. |
341| Z | f64 | `68.30` | |
342| On Ground | bool | `true` | `true` if the player is on the ground, `false` otherwise |
343
344## 0x0C Player Look
345
346- Clientbound: [x]
347- Serverbound: [x]
348- Size: 9
349
350Updates the direction the player is looking in.
351
352Yaw is measured in degrees, and does not follow classical trigonometry rules.
353
354The unit circle of yaw on the xz-plane starts at (0, 1) and turns backwards
355towards (-1, 0), or in other words, it turns clockwise instead of
356counter-clockwise. Additionally, yaw is not clamped to between 0 and 360
357degrees; any number is valid, including negative numbers and numbers greater
358than 360.
359
360| Field Name | Field Type | Example | Notes |
361| ---------- | ---------- | ------- | -------------------------------------------------------- |
362| Yaw | f32 | `0.0` | Rotation on the X Axis, in degrees |
363| Pitch | f32 | `0.0` | Rotation on the Y axis, in degrees |
364| On Ground | bool | `true` | `true` if the player is on the ground, `false` otherwise |
365
366## 0x0D Player Position and Look
367
368- Clientbound: [x]
369- Serverbound: [x]
370- Size: 41
371
372A combination of [Player Look][player_look] and [Player Position][player_position].
373
374| Field Name | Field Type | Example | Notes |
375| ---------- | ---------- | --------- | ----------------------------------------------------------------------------- |
376| X | f64 | `102.809` | |
377| Y | f64 | `70.00` | |
378| Stance | f64 | `71.62` | Used to modify the players bounding box when going up stairs, crouching, etc. |
379| Z | f64 | `68.30` | |
380| Yaw | f32 | `0.0` | Rotation on the X Axis, in degrees |
381| Pitch | f32 | `0.0` | Rotation on the Y axis, in degrees |
382| On Ground | bool | `true` | `true` if the player is on the ground, `false` otherwise |
383
384## 0x0E Block Dig
385
386- Clientbound: [ ]
387- Serverbound: [x]
388- Size: 11
389
390Sent when the player is digging a block.
391
392| Field Name | Field Type | Example | Notes |
393| ---------- | ---------- | ------- | ------------------------------------------------------------- |
394| Status | i8 | `1` | The action the player is taking against the block (see below) |
395| X | i32 | `32` | Block position |
396| Y | i8 | `64` | Block position |
397| Z | i32 | `32` | Block position |
398| Face | i8 | `3` | The face being hit (see below) |
399
400### Status
401
402Status can be:
403
404- `0`: Started digging
405- `2`: Finished digging
406- `4`: Drop item
407
408### Special cases
409
410For some unthinkable reason, when the player drops an item, it sends this packet
411but the status is `4`, and all other values are `0`.
412
413### Face
414
415Face can be:
416
417- `0`: Negative Y
418- `1`: Positive Y
419- `2`: Negative Z
420- `3`: Positive Z
421- `4`: Negative X
422- `5`: Positive X
423
424## 0x0F Block Interact
425
426- Clientbound: [ ]
427- Serverbound: [x]
428- Size: 12 or 15
429
430Sent when the player places a block or (probably) an item. The coordinates sent
431in this packet are actually the block being built against, which combined with
432the direction offset tell you where the block should be placed. This is
433required to correctly position furnaces, torches, etc.
434
435| Field Name | Field Type | Example | Notes |
436| ---------------- | ------------- | ------- | ---------------------------------------------------------- |
437| X | i32 | `32` | Block position |
438| Y | i8 | `64` | Block position |
439| Z | i32 | `32` | Block position |
440| Face | i8 | `3` | The face being placed against (see [Block Dig][block_dig]) |
441| Block or Item ID | i16 | `1` | The block or item to be placed |
442| Count | Optional<i8> | `34` | The count of the itemstack in the players hand |
443| Data | Optional<i16> | `83` | The data value of the itemstack |
444
445If the Block/ItemID field is greater than or equal to 0, then the last
4462 fields (count and data) are read. Otherwise, they are not read.
447
448When 'placing' (Or more accurately, using) your empty hand, the client sends -1
449as the Block/Item ID.
450
451### Special cases
452
453This packet has a special case where X, Y, Z, and Direction are all -1.
454This special packet indicates that the currently held item for the player should
455have its state updated such as eating food, shooting bows, using buckets, etc.
456
457When using buckets, the client might send two packets: first a normal and then a
458special case. The first normal packet is sent when you're looking at a block
459(e.g. the water you want to scoop up). This normal packet does not appear to do
460anything with a Vanilla server. The second, special case packet appears to
461perform the action - based on current position/orientation and with a distance
462check - it appears that buckets can only be used within a radius of 6 blocks.
463
464## 0x10 Change Current Slot
465
466- Clientbound: [ ]
467- Serverbound: [x]
468- Size: 2
469
470Sent when the player changes their current/active slot.
471
472| Field Name | Field Type | Example | Notes |
473| ---------- | ---------- | ------- | --------------------------------- |
474| Slot ID | i16 | `1` | Valid values are 0..8 (inclusive) |
475
476## 0x11 Sleep
477
478- Clientbound: [x]
479- Serverbound: [ ]
480- Size: 14
481
482Sent to indicate a player is sleeping in a bed.
483
484| Field Name | Field Type | Example | Notes |
485| ---------- | ---------- | ------- | ------------------ |
486| Entity ID | i32 | `89` | Player's entity ID |
487| Unknown | i8 | `0` | Always 0, unused |
488| X | i32 | `-247` | Block coordinate |
489| Y | i8 | `78` | Block coordinate |
490| Z | i32 | `128` | Block coordinate |
491
492## 0x12 Animation
493
494- Clientbound: [x]
495- Serverbound: [x]
496- Size: 5
497
498| Field Name | Field Type | Example | Notes |
499| ---------- | ---------- | ------- | ------------------ |
500| Entity ID | i32 | `55534` | Player's entity ID |
501| Animate | i8 | `1` | See below |
502
503### Animate
504
505Animate can be:
506
507- `0`: No animation
508- `1`: Swing arm
509- `2`: Damage animation
510- `3`: Leave bed
511
512## 0x13 Player Action
513
514- Clientbound: [ ]
515- Serverbound: [x]
516- Size: 5
517
518Sent when crouching and leaving a bed.
519
520| Field Name | Field Type | Example | Notes |
521| ---------- | ---------- | ------- | ------------------ |
522| Entity ID | i32 | `55534` | Player's entity ID |
523| Action | i8 | `1` | See below |
524
525### Action
526
527Action can be:
528
529- `1`: Start crouching
530- `2`: Stop crouching
531- `3`: Leave bed
532
533## 0x14 Spawn Player
534
535- Clientbound: [x]
536- Serverbound: [ ]
537- Size: 22 + length of strings
538
539Sent when a player comes into visible range. The vanilla client is not okay
540with receiving player entity packets that refer to its own username or EID; it
541will teleport to the absolute origin of the map and fall through the void any
542time it receives them.
543
544| Field Name | Field Type | Example | Notes |
545| ---------- | ---------- | ------------- | --------------------------------------------------------------------- |
546| Entity ID | i32 | `94453` | Player's entity ID |
547| Name | str16 | `kokiriglade` | Maximum character length of 16 |
548| X | i32 | `102.809` | [Packed f64][packed_f64] |
549| Y | i32 | `70.00` | [Packed f64][packed_f64] |
550| Z | i32 | `68.30` | [Packed f64][packed_f64] |
551| Yaw | i8 | `0.0` | [Packed rotation][packed_rotation] |
552| Pitch | i8 | `0.0` | [Packed rotation][packed_rotation] |
553| Held Item | i16 | `0` | The item the player is holding. `0` for no item. Must not be negative |
554
555## 0x15 Spawn Item
556
557- Clientbound: [x]
558- Serverbound: [ ]
559- Size: 24
560
561Sent when a thrown item comes into range of the player.
562
563| Field Name | Field Type | Example | Notes |
564| ---------- | ---------- | --------- | ------------------------------------ |
565| Entity ID | i32 | `157617` | Item's entity ID |
566| Item ID | i16 | `4` | |
567| Count | i8 | `1` | The count of the itemstack |
568| Data | i16 | Item data | |
569| X | i32 | `102.809` | [Packed f64][packed_f64] |
570| Y | i32 | `70.00` | [Packed f64][packed_f64] |
571| Z | i32 | `68.30` | [Packed f64][packed_f64] |
572| Motion X | i8 | `0.0` | [Packed motion-i8][packed_motion_i8] |
573| Motion Y | i8 | `0.0` | [Packed motion-i8][packed_motion_i8] |
574| Motion Z | i8 | `0.0` | [Packed motion-i8][packed_motion_i8] |
575
576## 0x16 Pickup Item
577
578- Clientbound: [x]
579- Serverbound: [ ]
580- Size: 8
581
582Sent when someone picks up an item lying on the ground - its sole purpose is
583the animation of the item flying towards the player.
584
585It doesn't destroy the entity in the client memory ([Destroy Entity][destroy_entity]
586does that), and it doesn't add it to the player's inventory ([Set Slot][set_slot]
587does that).
588
589The server only checks for items to be picked up after each [Player Position][player_position]
590and [Player Position and Look][player_position_and_look] packet sent by the client.
591
592| Field Name | Field Type | Example | Notes |
593| ------------------- | ---------- | ------- | -------------------------- |
594| Collected Entity ID | i32 | `28` | Collected item's entity ID |
595| Collector Entity ID | i32 | `30` | Collector's entity ID |
596
597## 0x17 Spawn Non-Living Entity
598
599- Clientbound: [x]
600- Serverbound: [ ]
601- Size: 21 or 27
602
603Sent when a Non-Living entity is created.
604
605| Field Name | Field Type | Example | Notes |
606| ----------- | ---------- | ------- | ---------------------------------------------------------------- |
607| Entity ID | i32 | `62` | |
608| Entity Type | i8 | `11` | [See Entity Types][entity_types] (must be of kind `Living`) |
609| X | i32 | `16080` | [Packed f64][packed_f64] |
610| Y | i32 | `2290` | [Packed f64][packed_f64] |
611| Z | i32 | `592` | [Packed f64][packed_f64] |
612| Has Motion | i32 | `0` | If this flag is bigger than 0 then the following fields are sent |
613| Motion X | i16 | `0` | [Packed motion-i16][packed_motion_i16] |
614| Motion Y | i16 | `0` | [Packed motion-i16][packed_motion_i16] |
615| Motion Z | i16 | `0` | [Packed motion-i16][packed_motion_i16] |
616
617## 0x18 Spawn Living Entity
618
619- Clientbound: [x]
620- Serverbound: [ ]
621- Size: 19 + [Metadata][entity_metadata] (at least 1)
622
623Sent when a Living Entity is created.
624
625| Field Name | Field Type | Example | Notes |
626| ------------------ | ---------------------------------- | ------- | -------------------------------------------------- |
627| Entity ID | i32 | `62` | |
628| Living Entity Type | i8 | `11` | See below |
629| X | i32 | `16080` | [Packed f64][packed_f64] |
630| Y | i32 | `2290` | [Packed f64][packed_f64] |
631| Z | i32 | `592` | [Packed f64][packed_f64] |
632| Yaw | i8 | `-27` | [Packed rotation][packed_rotation] |
633| Pitch | i8 | `0` | [Packed rotation][packed_rotation] |
634| Entity Metadata | [Entity Metadata][entity_metadata] | `127` | Indexed metadata, terminated by `0x7F` - see below |
635
636### Living Entity types
637
638- `50`: Creeper
639 - Index 16 is `i8`, for `fuse`
640 - `1` for blowing up, `-1` otherwise
641 - Index 17 is `bool`, for `is charged`
642- `51`: Skeleton
643- `52`: Spider
644- `53`: Giant Zombie
645- `54`: Zombie
646- `55`: Slime
647 - Index 16 is `i8`, for `size`
648- `56`: Ghast
649 - Index 16 is `i8`, for `is attacking`
650- `57`: Zombie Pigman
651- `90`: Pig
652 - Index 16 is `i8`, for `is saddled`
653- `91`: Sheep
654 - Index 16 is `i8` for `coat`
655 - You can use a `0x10` bit mask for `shearedness` and `0x0F` for `color` - see below
656- `92`: Cow
657- `93`: Chicken
658- `94`: Squid
659- `95`: Wolf
660 - Index 16 is `i8`, and is a bitmask:
661 - `0x01` for `is sitting`
662 - `0x02` for `is aggressive`
663 - `0x04` for `is tamed`
664 - Index 17 is `string16`, and is the `name of the player` who tamed the wolf
665 - Index 18 is `i32`, and is the `health` of the wolf
666
667Metadata index 0 is an `i8` representing a set of 8 `bool`s:
668
669- `0x01`: On fire
670- `0x02`: Is crouched
671- `0x04`: Is riding
672
673### Sheep colors
674
675- `0`: White
676- `1`: Orange
677- `2`: Magenta
678- `3`: Light Blue
679- `4`: Yellow
680- `5`: Lime
681- `6`: Pink
682- `7`: Gray
683- `8`: Light Gray (Silver)
684- `9`: Cyan
685- `10`: Purple
686- `11`: Blue
687- `12`: Brown
688- `13`: Green
689- `14`: Red
690- `15`: Black
691
692## 0x19 Spawn Painting
693
694- Clientbound: [x]
695- Serverbound: [ ]
696- Size: 22 + length of strings
697
698Sent when a painting is created.
699
700Calculating the center of an image: given a `(width x height)` grid of cells,
701with `(0, 0)` being the top left corner, the center is `(max(0, width / 2 - 1), height / 2)`.
702E.g:
703
704- 2x1 (1, 0)
705- 4x4 (1, 2)
706
707| Field Name | Field Type | Example | Notes |
708| ---------- | ---------- | ---------- | ---------------------------------------------------- |
709| Entity ID | i32 | `326` | |
710| Title | str16 | `Creepers` | Name of the painting. Maximum character length of 13 |
711| X | i32 | `50` | Center X coordinate |
712| Y | i32 | `66` | Center Y coordinate |
713| Z | i32 | `-50` | Center Z coordinate |
714| Direction | i32 | `0` | Direction the painting is facing, see below |
715
716### Direction
717
718- `0`: Negative Z
719- `1`: Negative X
720- `2`: Positive Z
721- `3`: Positive X
722
723## 0x1C Update Velocity
724
725- Clientbound: [x]
726- Serverbound: [ ]
727- Size: 10
728
729Velocity is believed to be in units of 1/32000 of a block per server tick
730(200ms); for example, `-1343` would move `(-1343 / 32000) = -0.04196875` blocks
731per tick (or `-0.20984375 blocks per second`).
732
733Each axis' velocity is capped between -0.9 and 0.9 blocks per tick (packet
734values -28800 to 28800).
735
736| Field Name | Field Type | Example | Notes |
737| ---------- | ---------- | ------- | ---------------------- |
738| Entity ID | i32 | `1805` | |
739| X | i16 | `-1343` | Velocity on the X axis |
740| Y | i16 | `0` | Velocity on the Y axis |
741| Z | i16 | `0` | Velocity on the Z axis |
742
743## 0x1D Destroy Entity
744
745- Clientbound: [x]
746- Serverbound: [ ]
747- Size: 4
748
749| Field Name | Field Type | Example | Notes |
750| ---------- | ---------- | ------- | ----- |
751| Entity ID | i32 | `446` | |
752
753## 0x1E Entity
754
755- Clientbound: [x]
756- Serverbound: [ ]
757- Size: 4
758
759Most entity-related packets are subclasses of this packet. When sent from the
760server to the client, it may initialize the entry.
761
762For player entities, either this packet or any move/look packet is sent several
763times per second. So the meaning of this packet is basically that the entity
764did not move/look since the last such packet.
765
766| Field Name | Field Type | Example | Notes |
767| ---------- | ---------- | ------- | ----- |
768| Entity ID | i32 | `446` | |
769
770## 0x1F Entity Relative Move
771
772- Clientbound: [x]
773- Serverbound: [ ]
774- Size: 7
775
776| Field Name | Field Type | Example | Notes |
777| ---------- | ---------- | ------- | ----- |
778| Entity ID | i32 | `446` | |
779| Relative X | i8 | `1` | |
780| Relative Y | i8 | `-7` | |
781| Relative Z | i8 | `5` | |
782
783Solid documentation on what these relative coordinates actually are is kind of
784lacking - apologies. I'll figure it out eventually though.
785
786## 0x20 Entity Look
787
788- Clientbound: [x]
789- Serverbound: [ ]
790- Size: 6
791
792This packet is sent by the server when an entity rotates.
793
794Example: `Yaw`=`64` means a 90 degree turn.
795
796| Field Name | Field Type | Example | Notes |
797| ---------- | ---------- | ------- | ---------------------------------- |
798| Entity ID | i32 | `459` | |
799| Yaw | i8 | `64` | [Packed rotation][packed_rotation] |
800| Pitch | i8 | `0` | [Packed rotation][packed_rotation] |
801
802## 0x21 Entity Look and Relative Move
803
804- Clientbound: [x]
805- Serverbound: [ ]
806- Size: 9
807
808This packet is sent by the server when an entity rotates and moves.
809
810Since `i8` range is limited from -128 to 127, this packet allows at most four b
811locks movement in any direction. (`-128/32 == -4`)
812
813| Field Name | Field Type | Example | Notes |
814| ---------- | ---------- | ------- | ------------------------------------ |
815| Entity ID | i32 | `446` | |
816| Relative X | i8 | `1` | |
817| Relative Y | i8 | `-7` | |
818| Relative Z | i8 | `5` | |
819| Yaw | i8 | `64` | X axis rotation as a fraction of 360 |
820| Pitch | i8 | `0` | Y axis rotation as a fraction of 360 |
821
822## 0x22 Entity Teleport
823
824- Clientbound: [x]
825- Serverbound: [ ]
826- Size: 18
827
828This packet is sent by the server when an entity moves more than 4 blocks.
829
830| Field Name | Field Type | Example | Notes |
831| ---------- | ---------- | ------- | ---------------------------------- |
832| Entity ID | i32 | `446` | |
833| X | i32 | `14162` | [Packed f64][packed_f64] |
834| Y | i32 | `2176` | [Packed f64][packed_f64] |
835| Z | i32 | `1111` | [Packed f64][packed_f64] |
836| Yaw | i8 | `64` | [Packed rotation][packed_rotation] |
837| Pitch | i8 | `0` | [Packed rotation][packed_rotation] |
838
839## 0x26 Entity Status
840
841- Clientbound: [x]
842- Serverbound: [ ]
843- Size: 5
844
845| Field Name | Field Type | Example | Notes |
846| ---------- | ---------- | ------- | --------- |
847| Entity ID | i32 | `446` | |
848| Status | i8 | `2` | See below |
849
850### Status
851
852- `2`: (Living Entities only) Attack animation
853- `3`: (Living Entities only) Death animation
854- `6`: (Wolf only) Make smoke particles
855- `7`: (Wolf only) Make hearts particles
856- `8`: (Wolf only) Shaking
857
858## 0x27 Ride Entity
859
860- Clientbound: [x]
861- Serverbound: [ ]
862- Size: 8
863
864This packet is sent when a player starts riding an entity.
865
866| Field Name | Field Type | Example | Notes |
867| ----------------- | ---------- | ------- | ------------------- |
868| Player Entity ID | i32 | `446` | Player's entity ID |
869| Vehicle Entity ID | i32 | `1805` | Vehicle's entity ID |
870
871## 0x28 Update Entity Metadata
872
873- Clientbound: [x]
874- Serverbound: [ ]
875- Size: 4 + [Metadata][entity_metadata] (at least 1)
876
877| Field Name | Field Type | Example | Notes |
878| --------------- | ---------------------------------- | ------- | ------------------------------------------------- |
879| Entity ID | i32 | `446` | Entity ID |
880| Entity Metadata | [Entity Metadata][entity_metadata] | `127` | Indexed metadata, terminated by `0x7F` - see link |
881
882## 0x32 Initialize Chunk
883
884- Clientbound: [x]
885- Serverbound: [ ]
886- Size: 9
887
888The client is expected to allocate space for a full chunk (16 x 128 x 16 blocks).
889
890One or more [Chunk Data][chunk_data] packets will follow, specifying actual data
891to fill the chunk with.
892
893Whenever you send this packet the client will clear any previous chunk at that
894spot if one has previously been sent. Clients don't like being in or next to an
895unloaded chunk, so try not to unload it if players are nearby. If the player
896appears to be twitching and stuck in place after joining the world, there is
897probably an unloaded chunk too close to them.
898
899| Field Name | Field Type | Example | Notes |
900| ----------- | ---------- | ------- | ------------------------------------------------------------------------------------- |
901| X | i32 | `-9` | Chunk coordinate |
902| Z | i32 | `12` | Chunk coordinate |
903| Load/Unload | bool | `true` | If `false`, the client unloads the chunk. If `true`, the client initializes the chunk |
904
905## 0x33 Chunk Data
906
907- Clientbound: [x]
908- Serverbound: [ ]
909- Size: 17 + compressed chunk size
910
911| Field Name | Field Type | Example | Notes |
912| --------------- | ---------- | ------- | ------------------------------------- |
913| X | i32 | `128` | Block coordinate |
914| Y | i16 | `0` | Block coordinate |
915| Z | i32 | `-192` | Block coordinate |
916| Size X | i8 | `15` | Size X is Actual X Size -1 |
917| Size Y | i8 | `127` | Size Y is Actual Y Size -1 |
918| Size Z | i8 | `15` | Size Z is Actual Z Size -1 |
919| Compressed size | i32 | `3663` | Size of compressed region data |
920| Compressed data | Vec\<u8\> | `...` | Compressed region data (zlib deflate) |
921
922### X,Y,Z
923
924This is the start position of the region, in world block coordinates.
925
926To find which chunk is affected, in the same coordinates given by [Initialize Chunk][initialize_chunk]:
927
928```
929chunkX = X >> 4
930chunkY = Y >> 7
931chunkZ = Z >> 4
932```
933
934And conversely, which local block in the chunk to start at:
935
936```
937startX = X & 15
938startY = Y & 127 (not always 0!)
939startZ = Z & 15
940```
941
942### Size X,Y,Z
943
944This is the size of the region, in blocks. The server will subtract one from
945the sizes and then cast them to a byte before sending. This is so that chunks
946as large as 256 are possible.
947
948### Compressed data
949
950The data is compressed using the deflate() function in [zlib]. After uncompressing,
951the data consists of four sequential sections, in order:
952
953- Block ID array (1 byte per block)
954- Block metadata array (half byte/nibble per block)
955- Block Light array (half byte/nibble per block)
956- Sky Light array (half byte/nibble per block)
957
958The data is exactly `(sizeX+1) * (sizeY+1) * (sizeZ+1) * 2.5` bytes long.
959Nibbles are not rounded either direction, which means that at least one
960dimension of the chunk must be even.
961
962The arrays are not interlaced.
963
964In other words, there are `sizeX` number of x planes, each plane made up of
965`sizeZ` number of z rows, each row made up of `sizeY` blocks indexed by y
966coordinate in order.
967
968The Block ID array is indexed with:
969
970```
971index = y + (z * (sizeY+1)) + (x * (sizeY+1) * (sizeZ+1))
972```
973
974The other arrays are similar but you need to divide the index by two after
975calculating the above. Then each byte contains data for two blocks. The low
976four bits contain the first (lower Y) nibble and the high four bits contain the
977second nibble.
978
979If you have a FULL map chunk (`sizeX = 15, sizeY = 127, sizeZ = 15`), you can
980calculate index coordinates:
981
982```
983x = X + ( index >> 11 )
984y = index & 0x7F
985z = Z + ( (index & 0x780) >> 7 )
986```
987
988## 0x34 Multi Block Change
989
990- Clientbound: [x]
991- Serverbound: [ ]
992- Size: 10 + arrays
993
994This is a multiple-block-change command; if you take the three arrays, and put
995together elements with the same index, and then decompose the `i16` into
996coordinates (top 4 bits is X, next 4 bits is Z, bottom 8 bits is Y), you get
997arrays like [((8, 7, 4), 11, 0), ((7, 13, 6), 11, 0), ((13, 1, 8), 11, 0), ((7, 6, 6), 11, 0)].
998
999| Field Name | Field Type | Example | Notes |
1000| -------------------- | ---------- | ------- | --------------------------------------- |
1001| X | i32 | `-9` | Chunk coordinate |
1002| Z | i32 | `12` | Chunk coordinate |
1003| Array size | i16 | `2` | The total number of elements per array |
1004| Coordinate array | Vec\<i16\> | `...` | The coordinates of the blocks to change |
1005| Block ID array | Vec\<i8\> | `...` | The ID for each block to change |
1006| Block metadata array | Vec\<i8\> | `...` | The metadata for each block changed |
1007
1008See [blocks] for information on the metadata variable.
1009
1010## 0x35 Block Change
1011
1012- Clientbound: [x]
1013- Serverbound: [ ]
1014- Size: 11
1015
1016| Field Name | Field Type | Example | Notes |
1017| -------------- | ---------- | ------- | -------------------------- |
1018| X | i32 | `128` | Block coordinate |
1019| Y | i8 | `0` | Block coordinate |
1020| Z | i32 | `-192` | Block coordinate |
1021| Block ID | i8 | `78` | The type for the block |
1022| Block metadata | i8 | `0` | The metadata for the block |
1023
1024See [blocks] for information on the metadata variable.
1025
1026## 0x36 Play Note Block
1027
1028- Clientbound: [x]
1029- Serverbound: [ ]
1030- Size: 12
1031
1032Sent when a note block is played.
1033
1034| Field Name | Field Type | Example | Notes |
1035| --------------- | ---------- | ------- | ----------------------------------------------- |
1036| X | i32 | `128` | Block coordinate |
1037| Y | i16 | `0` | Block coordinate |
1038| Z | i32 | `-192` | Block coordinate |
1039| Instrument type | i8 | `3` | See below |
1040| Pitch | i8 | `17` | The pitch of the note (between 0..24 inclusive) |
1041
1042### Instrument types
1043
1044- `0`: Harp
1045- `1`: Double Bass
1046- `2`: Snare Drum
1047- `3`: Clicks/Sticks (Hihat)
1048- `4`: Bass Drum
1049
1050## 0x3C Explosion
1051
1052- Clientbound: [x]
1053- Serverbound: [ ]
1054- Size: 32 + `3*(coordinate count)`
1055
1056Sent when an explosion occurs.
1057
1058| Field Name | Field Type | Example | Notes |
1059| ---------------- | --------------------- | -------- | ------------------------------ |
1060| X | f64 | `128.0` | Center coordinate |
1061| Y | f64 | `0.0` | Center coordinate |
1062| Z | f64 | `-192.0` | Center coordinate |
1063| Radius | f32 | `4.0` | |
1064| Coordinate count | i32 | `60` | |
1065| Records | (i8, i8, i8) \* count | `...` | XYZ offsets of affected blocks |
1066
1067## 0x3D Play Effect
1068
1069- Clientbound: [x]
1070- Serverbound: [ ]
1071- Size: 17
1072
1073Sent when a client is to play an effect.
1074
1075| Field Name | Field Type | Example | Notes |
1076| ---------- | ---------- | -------- | ---------------- |
1077| Effect ID | i32 | `1003` | See below |
1078| X | i32 | `128.0` | Block coordinate |
1079| Y | i8 | `0.0` | Block coordinate |
1080| Z | i32 | `-192.0` | Block coordinate |
1081| Data | i32 | `0` | See below |
1082
1083### Effects
1084
1085- `1000`: Play sound `random.click` with pitch 1.0
1086- `1001`: Play sound `random.click` with pitch 1.2
1087- `1002`: Play sound `random.bow` with pitch 1.2
1088- `1003`: Play sound randomly between `random.door_open` and `random.door_close` with random uniform pitch between 0.0 and 1.0
1089- `1004`: Play sound `random.fizz` with volume 0.5 and random pitch
1090- `1005`: Play record sound.
1091 - The record item ID is given in the effect data.
1092- `2000`: Spawn smoke particles
1093 - The radius is given in effect data with two bits for X and Z axis, like this: `0bZZXX`
1094- `2001`: Play and show block break sound and particles.
1095 - The block id is given in effect data.
1096
1097## 0x46 Notification
1098
1099- Clientbound: [x]
1100- Serverbound: [ ]
1101- Size: 1
1102
1103Sent to notify the client of some state.
1104
1105| Field Name | Field Type | Example | Notes |
1106| ---------- | ---------- | ------- | --------- |
1107| Reason | i8 | `1` | See below |
1108
1109### Reason
1110
1111- `0`: Invalid bed
1112- `1`: Start raining
1113- `2`: Stop raining
1114
1115## 0x47 Lightning
1116
1117- Clientbound: [x]
1118- Serverbound: [ ]
1119- Size: 17
1120
1121Notifies the client of thunderbolts striking somewhere. The coordinates specify
1122where exactly the thunderbolt strikes.
1123
1124| Field Name | Field Type | Example | Notes |
1125| ---------- | ---------- | ------- | ------------------------ |
1126| Entity ID | i32 | `4` | Lightning bolt entity ID |
1127| ??? | bool | `true` | Always `true` |
1128| X | i32 | `133` | [Packed f64][packed_f64] |
1129| Y | i32 | `913` | [Packed f64][packed_f64] |
1130| Z | i32 | `63552` | [Packed f64][packed_f64] |
1131
1132## 0x64 Open Inventory
1133
1134- Clientbound: [x]
1135- Serverbound: [ ]
1136- Size: 5 + length of strings
1137
1138| Field Name | Field Type | Example | Notes |
1139| --------------- | ---------- | ------- | -------------------- |
1140| Inventory ID | i8 | `123` | |
1141| Inventory Type | i8 | `0` | See below |
1142| Title | str8 | `Chest` | Only used for chests |
1143| Number of slots | i8 | `3` | |
1144
1145### Inventory Type
1146
1147- `0`: Chest
1148- `1`: Crafting table
1149- `2`: Furnace
1150- `3`: Dispenser
1151
1152## 0x65 Close Inventory
1153
1154- Clientbound: [x]
1155- Serverbound: [x]
1156- Size: 1
1157
1158Clients send this packet with Inventory ID `0` when they close their inventory.
1159
1160| Field Name | Field Type | Example | Notes |
1161| ------------ | ---------- | ------- | ------------------------ |
1162| Inventory ID | i8 | `123` | 0 for player's inventory |
1163
1164## 0x66 Click Inventory
1165
1166- Clientbound: [ ]
1167- Serverbound: [x]
1168- Size: 9 or 12
1169
1170Sent when the playuer clicks on a slot in an inventory.
1171
1172| Field Name | Field Type | Example | Notes |
1173| -------------- | ---------- | ------- | ----------------------------------------------------------------------------------------------------- |
1174| Inventory ID | i8 | `123` | 0 for player's inventory |
1175| Cicked Slot | i16 | `36` | |
1176| Right clicking | bool | `true` | `true` if right cicking, `false` otherwise |
1177| Action number | `i16` | `12` | Unique number for the action, used for [transaction handling][transaction] |
1178| Shift | bool | `fase` | `true` if the player was holding shift, `false` otherwise |
1179| Item ID | `i16` | `3` | ID of the item that was in the slot. `-1` for no item. If `-1`, this is the last field in the packet. |
1180| Item Count | `i8` | `64` | |
1181| Item Data | `i16` | `10` | |
1182
1183When right-clicking on a stack of items, half the stack will be picked up and
1184half left in the slot. If the stack is an odd number, the half left in the slot
1185will be smaller of the amounts.
1186
1187The Action number is actually a counter, starting at `1`. This number is used by
1188the server as a transaction ID to send back a [transaction] packet.
1189
1190For help with slot IDs, see the next packet.
1191
1192## 0x67 Set Inventory Slot
1193
1194- Clientbound: [x]
1195- Serverbound: [ ]
1196- Size: 5 or 8
1197
1198Sent by the server when an item in a slot is added/removed.
1199
1200| Field Name | Field Type | Example | Notes |
1201| ------------ | ---------- | ------- | ---------------------------------------------------------------- |
1202| Inventory ID | i8 | `123` | 0 for player's inventory |
1203| Slot | i16 | `36` | |
1204| Item ID | `i16` | `3` | `-1` for no item. If `-1`, this is the last field in the packet. |
1205| Item Count | `i8` | `64` | |
1206| Item Data | `i16` | `10` | |
1207
1208Note that if window ID and slot are both `-1`, it means the item currently attached to the cursor.
1209
1210### Slot
1211
1212
1213
1214## 0x68 Set Inventory Slots
1215
1216- Clientbound: [x]
1217- Serverbound: [ ]
1218- Size: 3 + size of payload
1219
1220Sent by the server when items in slots are added/removed. This includes the
1221player inventory, equipped armor, and crafting slots.
1222
1223| Field Name | Field Type | Example | Notes |
1224| ------------- | ---------- | ------- | ------------------------ |
1225| Inventory ID | i8 | `123` | 0 for player's inventory |
1226| Payload count | i16 | `4` | See below |
1227| Payload | ... | | See below |
1228
1229This packet is a bit trickier to parse than most others because the size of its
1230payload is variable. The payload is an array of shorts (item ID) optionally
1231followed by a byte-short pair (count and data) as long as the item ID does not
1232equal `-1`, which signifies an empty slot.
1233
1234```python
1235offset = 0
1236
1237for slot in count:
1238 item_id = payload[offset] as short
1239 offset += 2
1240 if item_id is not equal to -1:
1241 count = payload[offset] as byte
1242 offset += 1
1243 uses = payload[offset] as short
1244 offset += 2
1245 inventory[slot] = new item(item_id, count, uses)
1246 else:
1247 inventory[slot] = None
1248```
1249
1250## 0x69 Update Progress Bar
1251
1252- Clientbound: [x]
1253- Serverbound: [ ]
1254- Size: 5
1255
1256| Field Name | Field Type | Example | Notes |
1257| ------------ | ---------- | ------- | ------------------------ |
1258| Inventory ID | i8 | `123` | 0 for player's inventory |
1259| Progress Bar | i16 | `1` | See below |
1260| Value | i16 | 650 | See below |
1261
1262### Furnace
1263
1264#### Progress bar
1265
1266- `0`: Arrow
1267- `1`: Fire
1268- `2`: Current Item Burn Time
1269 - time in ticks that the fuel item takes to burn
1270
1271#### Value
1272
1273- `0`: Empty
1274- Full progress arrow: approx. `180`
1275- Full fire icon: approx. `250`
1276
1277## 0x6A Transaction
1278
1279- Clientbound: [x]
1280- Serverbound: [x]
1281- Size: 4
1282
1283A packet from the server indicating whether a request from the client was
1284accepted, or whether there was a conflict (due to lag). This packet is also
1285sent from the client to the server in response to a server transaction rejection
1286packet.
1287
1288| Field Name | Field Type | Example | Notes |
1289| ------------- | ---------- | ------- | ------------------------ |
1290| Inventory ID | i8 | `123` | 0 for player's inventory |
1291| Action Number | i16 | `12` | |
1292| Accepted | bool | `true` | |
1293
1294## 0x82 Update Sign
1295
1296- Clientbound: [x]
1297- Serverbound: [x]
1298- Size: 10 + length of strings
1299
1300This message is sent from the server to the client whenever a sign comes into
1301view distance or created. This message is sent from the client to the server when the "Done"
1302button is pressed after placing a sign.
1303
1304| Field Name | Field Type | Example | Notes |
1305| ---------- | ---------- | ------------- | ----- |
1306| X | i32 | `123` | |
1307| Y | i16 | `0` | |
1308| Z | i32 | `-128` | |
1309| Text1 | str16 | `First line` | |
1310| Text2 | str16 | `Second line` | |
1311| Text3 | str16 | `Third line` | |
1312| Text4 | str16 | `Fourth line` | |
1313
1314## 0x83 Map Data
1315
1316- Clientbound: [x]
1317- Serverbound: [ ]
1318- Size: 5 + length of payload
1319
1320Sends map updates (columns of pixels or decorations).
1321
1322It allows the server to stream partial changes to a map rather than the entire
1323128x128 bitmap.
1324
1325| Field Name | Field Type | Example | Notes |
1326| -------------- | ---------- | ------- | --------- |
1327| Item ID | i16 | `358` | |
1328| Item Data | i16 | `0` | |
1329| Payload length | u8 | `35` | |
1330| Payload | Vec\<i8\> | `...` | See below |
1331
1332### Payload formats
1333
1334The first byte of the payload is a _tag_ indicating the type of update:
1335
1336#### Tag `0` (Column update)
1337
1338- `u8 x_start`: X coordinate (0..127) of the column.
1339- `u8 y_start`: Y coordinate (0..127) of the starting pixel.
1340- `Vec<u8> colors`: Palette indices (one per pixel) written _downwards_ starting at `(x_start, y_start)`.
1341
1342Each color is a raw color (0–255), not a limited palette enum. The raw value is
1343`base_id * 4 + shade`, where:
1344
1345- `base_id` is one of the 14 map palette entries.
1346- `shade` is 0..3 for brightness variation.
1347
1348#### Tag `1` (Decorations)
1349
1350Sequence of entries, each 3 bytes:
1351
1352- `u8 data`: Upper 4 bits = direction (0..15), lower 4 bits = type (always 0).
1353- `u8 x`: X coordinate of the decoration on the map (0..127).
1354- `u8 y`: Y coordinate of the decoration on the map (0..127).
1355
1356Decorations are only used to show the player cursors on the map in Beta 1.7.
1357
1358## 0xC8 Increment Statistic
1359
1360- Clientbound: [x]
1361- Serverbound: [ ]
1362- Size: 5
1363
1364| Field Name | Field Type | Example | Notes |
1365| ------------ | ---------- | ------- | --------------------- |
1366| Statistic ID | i32 | `1003` | See below |
1367| Amount | i8 | `1` | Negative to decrement |
1368
1369### Statistic ID
1370
1371- TODO :-( - but you can [try this forum post][statistics]?
1372
1373## 0xFF Disconnect
1374
1375- Clientbound: [x]
1376- Serverbound: [x]
1377- Size: 2 + length of strings
1378
1379Sent by the server before it disconnects a client, or by the client before it
1380disconnects from the server. The receiver of this packet assumes that the
1381sender has already closed the connection by the time the packet arrives.
1382
1383| Field Name | Field Type | Example | Notes |
1384| ---------- | ---------- | --------------------- | ----- |
1385| Reason | str16 | `The server is full!` | |
1386
1387[blocks]: blocks.md
1388[entity_metadata]: #entity-metadata
1389[packed_f64]: #floored-double
1390[packed_rotation]: #packed-rotation
1391[packed_motion_i8]: #packed-motion-i8
1392[packed_motion_i16]: #packed-motion-i16
1393[entity_types]: #entity-types
1394[player_position]: #0x0b-player-position
1395[player_look]: #0x0c-player-look
1396[player_position_and_look]: #0x0d-player-position-and-look
1397[block_dig]: #0x0e-block-dig
1398[spawn_player]: #0x14-spawn-player
1399[spawn_living_entity]: #0x18-spawn-living-entity
1400[destroy_entity]: #0x1d-destroy-entity
1401[initialize_chunk]: #0x32-initialize-chunk
1402[chunk_data]: #0x33-chunk-data
1403[set_slot]: #0x67-set-slot
1404[transaction]: #0x6a-transaction
1405[disconnect]: #0xff-disconnect
1406[statistics]: http://www.minecraftforum.net/viewtopic.php?f=1020&t=295360
1407[zlib]: http://www.zlib.net/
1408[java8spec_floating]: https://docs.oracle.com/javase/specs/jls/se9/html/jls-4.html#jls-4.2.3
1409[utf16]: https://en.wikipedia.org/wiki/UTF-16
1410[mutf8]: https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html#modified-utf-8