technical documentation for Minecraft b1.7.3

feat: initial commit

+25
LICENSE-MIT
···
+
Copyright (c) kokiriglade
+
+
Permission is hereby granted, free of charge, to any
+
person obtaining a copy of this software and associated
+
documentation files (the "Software"), to deal in the
+
Software without restriction, including without
+
limitation the rights to use, copy, modify, merge,
+
publish, distribute, sublicense, and/or sell copies of
+
the Software, and to permit persons to whom the Software
+
is furnished to do so, subject to the following
+
conditions:
+
+
The above copyright notice and this permission notice
+
shall be included in all copies or substantial portions
+
of the Software.
+
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+
DEALINGS IN THE SOFTWARE.
+13
README.md
···
+
# Minecraft Beta 1.7.3 Documentation
+
+
## Licensing
+
+
All content [MIT licensed][mit] unless otherwise noted.
+
+
The following is [CC-BY-SA-4.0][ccbysa4]:
+
+
- `docs/packets.md`
+
- `docs/.assets/slots.png`
+
+
[mit]: /LICENSE-MIT
+
[ccbysa4]: https://creativecommons.org/licenses/by-sa/4.0/
docs/.assets/cc-by-sa.png

This is a binary file and will not be displayed.

docs/.assets/slots.png

This is a binary file and will not be displayed.

+820
docs/blocks.md
···
+
# Blocks
+
+
For empty data values, assume it to **always** be `0`.
+
+
ID is an `i8`, and metadata is an `i8` where the final 4 bits are the _metadata
+
nibble_.
+
+
| Name | ID | Data |
+
| ------------------------ | --- | ------------------------------ |
+
| Air | 0 | |
+
| Stone | 1 | |
+
| Grass Block | 2 | |
+
| Dirt | 3 | |
+
| Cobblestone | 4 | |
+
| Wooden Planks | 5 | |
+
| Oak Sapling | 6 | `0` |
+
| Spruce Sapling | 6 | `1` |
+
| Birch Sapling | 6 | `2` |
+
| Bedrock | 7 | |
+
| Water (Flowing) | 8 | [See below][fluid] |
+
| Water (Still) | 9 | |
+
| Lava (Flowing) | 10 | [See below][fluid] |
+
| Lava (Still) | 11 | |
+
| Sand | 12 | |
+
| Gravel | 13 | |
+
| Gold Ore | 14 | |
+
| Iron Ore | 15 | |
+
| Coal Ore | 16 | |
+
| Oak Log | 17 | `0` |
+
| Spruce Log | 17 | `1` |
+
| Birch Log | 17 | `2` |
+
| Oak Leaves | 18 | `0` |
+
| Spruce Leaves | 18 | `1` |
+
| Birch Leaves | 18 | `2` |
+
| Sponge | 19 | |
+
| Glass | 20 | |
+
| Lapis Lazuli Ore | 21 | |
+
| Lapis Lazuli Block | 22 | |
+
| Dispenser | 23 | [See below][dispenser] |
+
| Sandstone | 24 | |
+
| Note Block | 25 | |
+
| Bed | 26 | [See below][bed] |
+
| Powered Rail | 27 | [See below][powered_rail] |
+
| Detector Rail | 28 | [See below][detector_rail] |
+
| Sticky Piston | 29 | [See below][piston] |
+
| Cobweb | 30 | |
+
| Dead Shrub | 31 | `0` |
+
| Grass | 31 | `1` |
+
| Fern | 31 | `2` |
+
| Dead Bush | 32 | |
+
| Piston | 33 | [See below][piston] |
+
| Piston Head | 34 | [See below][piston_head] |
+
| White Wool | 35 | `0` |
+
| Orange Wool | 35 | `1` |
+
| Magenta Wool | 35 | `2` |
+
| Light Blue Wool | 35 | `3` |
+
| Yellow Wool | 35 | `4` |
+
| Lime Wool | 35 | `5` |
+
| Pink Wool | 35 | `6` |
+
| Gray Wool | 35 | `7` |
+
| Light Gray (Silver) Wool | 35 | `8` |
+
| Cyan Wool | 35 | `9` |
+
| Purple Wool | 35 | `10` |
+
| Blue Wool | 35 | `11` |
+
| Brown Wool | 35 | `12` |
+
| Green Wool | 35 | `13` |
+
| Red Wool | 35 | `14` |
+
| Black Wool | 35 | `15` |
+
| Moving Piston | 36 | |
+
| Dandelion | 37 | |
+
| Rose | 38 | |
+
| Brown Mushroom | 39 | |
+
| Red Mushroom | 40 | |
+
| Gold Block | 41 | |
+
| Iron Block | 42 | |
+
| Double Stone Slab | 43 | `0` |
+
| Double Sandstone Slab | 43 | `1` |
+
| Double Wooden Slab | 43 | `2` |
+
| Double Cobblestone Slab | 43 | `3` |
+
| Stone Slab | 44 | `0` |
+
| Sandstone Slab | 44 | `1` |
+
| Wooden Slab | 44 | `2` |
+
| Cobblestone Slab | 44 | `3` |
+
| Bricks | 45 | |
+
| TNT | 46 | |
+
| Bookshelves | 47 | |
+
| Mossy Cobblestone | 48 | |
+
| Obsidian | 49 | |
+
| Torch | 50 | [See below][torch] |
+
| Fire | 51 | [See below][fire] |
+
| Monster Spawner | 52 | |
+
| Wooden Stairs | 53 | [See below][stairs] |
+
| Chest | 54 | |
+
| Redstone Wire | 55 | [See below][redstone_wire] |
+
| Diamond Ore | 56 | |
+
| Diamond Block | 57 | |
+
| Crafting Table | 58 | |
+
| Wheat | 59 | [See below][wheat] |
+
| Farmland | 60 | [See below][farmland] |
+
| Furnace | 61 | [See below][furnace] |
+
| Lit Furnace | 62 | [See below][furnace] |
+
| Standing Sign | 63 | [See below][standing_sign] |
+
| Wooden Door | 64 | [See below][door] |
+
| Ladder | 65 | [See below][ladder] |
+
| Rail | 66 | [See below][rail] |
+
| Cobblestone Stairs | 67 | [See below][stairs] |
+
| Wall-Mounted Sign | 68 | [See below][wall_sign] |
+
| Lever | 69 | [See below][lever] |
+
| Stone Pressure Plate | 70 | [See below][pressure_plate] |
+
| Iron Door | 71 | [See below][door] |
+
| Wooden Pressure Plate | 72 | [See below][pressure_plate] |
+
| Redstone Ore | 73 | |
+
| Glowing Redstone Ore | 74 | |
+
| Redstone Torch (Off) | 75 | [See below][redstone_torch] |
+
| Redstone Torch (On) | 76 | [See below][redstone_torch] |
+
| Button | 77 | [See below][button] |
+
| Snow Layer | 78 | [See below][snow_layer] |
+
| Ice | 79 | |
+
| Snow Block | 80 | |
+
| Cactus | 81 | |
+
| Clay Block | 82 | |
+
| Sugar Cane | 83 | |
+
| Jukebox | 84 | |
+
| Fence | 85 | |
+
| Pumpkin | 86 | [See below][pumpkin] |
+
| Netherrack | 87 | |
+
| Soul Sand | 88 | |
+
| Glowstone | 89 | |
+
| Nether Portal | 90 | |
+
| Jack O Lantern | 91 | [See below][pumpkin] |
+
| Cake | 92 | [See below][cake] |
+
| Redstone Repeater (Off) | 93 | [See below][redstone_repeater] |
+
| Redstone Repeater (On) | 94 | [See below][redstone_repeater] |
+
| Locked Chest | 95 | |
+
| Trapdoor | 96 | [See below][trapdoor] |
+
+
## Bed Metadata
+
+
- Bit Usage: `H O F F`
+
- Valid range: `0..15`
+
+
### Bit Definitions:
+
+
- `FF`: Facing direction
+
- `0 (00)`: Positive Z (South)
+
- `1 (01)`: Negative X (West)
+
- `2 (10)`: Negative Z (North)
+
- `3 (11)`: Positive X (East)
+
+
- `O`: Occupied status
+
- `0`: Unoccupied
+
- `1`: Occupied
+
+
- `H`: Head piece
+
- `0`: Foot piece
+
- `1`: Head piece
+
+
### Examples:
+
+
- `0 (0000)`: Foot, unoccupied, facing South
+
- `5 (0101)`: Foot, unoccupied, facing West
+
- `11 (1011)`: Head, unoccupied, facing East
+
- `15 (1111)`: Head, occupied, facing East
+
+
## Fluid Metadata
+
+
- Bit Usage: `F D D D`
+
- Valid range: `0..15`
+
+
### Bit Definitions:
+
+
- `DDD`: Distance to source
+
- `0`: Source block or adjacent to source
+
- `1-7`: Distance from source
+
+
- `F`: Falling state
+
- `0`: Normal horizontal flow
+
- `1`: Falling vertically (acts like source for spreading)
+
+
### Examples:
+
+
- `0 (0000)`: Source block
+
- `3 (0011)`: Distance 3 from source, flowing horizontally
+
- `8 (1000)`: Falling fluid (acts like source)
+
- `11 (1011)`: Falling fluid with distance 3 (rare edge case)
+
+
## Dispenser Metadata
+
+
- Bit Usage: `F F F F`
+
- Valid range: `0..5`
+
+
### Bit Definitions:
+
+
- `FFFF`: Facing direction
+
- `0`: Negative Y (Down)
+
- `1`: Positive Y (Up)
+
- `2`: Negative Z (North)
+
- `3`: Positive Z (South)
+
- `4`: Negative X (West)
+
- `5`: Positive X (East)
+
+
### Examples:
+
+
- `0 (0000)`: Facing down
+
- `2 (0010)`: Facing north
+
- `4 (0100)`: Facing west
+
- `5 (0101)`: Facing east
+
+
## Rail Metadata
+
+
- Bit Usage: `D D D D`
+
- Valid range: `0..9`
+
+
### Bit Definitions:
+
+
- `DDDD`: Direction/Shape
+
- `0`: North-South straight
+
- `1`: East-West straight
+
- `2`: East ascending (going up towards +X)
+
- `3`: West ascending (going up towards -X)
+
- `4`: North ascending (going up towards -Z)
+
- `5`: South ascending (going up towards +Z)
+
- `6`: South-East curve
+
- `7`: South-West curve
+
- `8`: North-West curve
+
- `9`: North-East curve
+
+
### Examples:
+
+
- `0 (0000)`: North-South straight
+
- `6 (0110)`: South-East curve
+
- `8 (1000)`: North-West curve
+
- `9 (1001)`: North-East curve
+
+
## Powered Rail Metadata
+
+
- Bit Usage: `P D D D`
+
- Valid range: `0..13`
+
+
### Bit Definitions:
+
+
- `DDD`: Direction/Shape
+
- `0`: North-South straight
+
- `1`: East-West straight
+
- `2`: East ascending (going up towards +X)
+
- `3`: West ascending (going up towards -X)
+
- `4`: North ascending (going up towards -Z)
+
- `5`: South ascending (going up towards +Z)
+
+
- `P`: Powered state
+
- `0`: Unpowered
+
- `1`: Powered
+
+
### Examples:
+
+
- `0 (0000)`: North-South straight, unpowered
+
- `1 (0001)`: East-West straight, unpowered
+
- `8 (1000)`: North-South straight, powered
+
- `10 (1010)`: East ascending, powered
+
+
## Detector Rail Metadata
+
+
- Bit Usage: `A D D D`
+
- Valid range: `0..13`
+
+
### Bit Definitions:
+
+
- `DDD`: Direction/Shape
+
- `0`: North-South straight
+
- `1`: East-West straight
+
- `2`: East ascending (going up towards +X)
+
- `3`: West ascending (going up towards -X)
+
- `4`: North ascending (going up towards -Z)
+
- `5`: South ascending (going up towards +Z)
+
+
- `A`: Active/Triggered state
+
- `0`: No minecart detected
+
- `1`: Minecart detected
+
+
### Examples:
+
+
- `0 (0000)`: North-South straight, no minecart
+
- `1 (0001)`: East-West straight, no minecart
+
- `8 (1000)`: North-South straight, minecart detected (powering)
+
- `10 (1010)`: East ascending, minecart detected (powering)
+
+
## Piston Head Metadata
+
+
- Bit Usage: `S D D D`
+
- Valid range:\*\* `0..13`
+
+
### Bit Definitions:
+
+
- `DDD`: Facing direction
+
- `0`: Down (Negative Y)
+
- `1`: Up (Positive Y)
+
- `2`: North (Negative Z)
+
- `3`: South (Positive Z)
+
- `4`: West (Negative X)
+
- `5`: East (Positive X)
+
+
- `S`: Is Sticky
+
- `0`: Regular
+
- `1`: Sticky
+
+
### Examples:
+
+
- `0 (0000)`: Regular piston head facing down
+
- `1 (0001)`: Regular piston head facing up
+
- `8 (1000)`: Sticky piston head facing down
+
- `13 (1101)`: Sticky piston head facing south
+
+
## Piston Metadata
+
+
Piston is pretty much the same as its [Piston Head][piston_head] counterpart,
+
just with different uses of the 3rd bit.
+
+
- Bit Usage: `E D D D`
+
- Valid range: `0..13`
+
+
### Bit Definitions:
+
+
- `DDD`: Facing direction
+
- `0`: Down (Negative Y)
+
- `1`: Up (Positive Y)
+
- `2`: North (Negative Z)
+
- `3`: South (Positive Z)
+
- `4`: West (Negative X)
+
- `5`: East (Positive X)
+
+
- `E`: Is Extended
+
- `0`: Retracted
+
- `1`: Extended
+
+
### Special Behaviors:
+
+
- Note that stickiness is determined by block ID
+
+
### Examples:
+
+
- `0 (0000)`: Facing down, retracted
+
- `1 (0001)`: Facing up, retracted
+
- `8 (1000)`: Facing down, extended
+
- `11 (1011)`: Facing south, extended
+
+
## Torch Metadata
+
+
- Bit Usage: `- A A A`
+
- Valid range: `1..5`
+
+
### Bit Definitions:
+
+
- `AAA`: Attachment direction
+
- `1`: Attached to West face (pointing East)
+
- `2`: Attached to East face (pointing West)
+
- `3`: Attached to North face (pointing South)
+
- `4`: Attached to South face (pointing North)
+
- `5`: Standing on ground/block below
+
+
### Examples:
+
+
- `1 (0001)`: Wall torch pointing East (attached to West wall)
+
- `3 (0011)`: Wall torch pointing South (attached to North wall)
+
- `5 (0101)`: Standing torch (on ground/block below)
+
+
## Fire Metadata
+
+
- Bit Usage: `A A A A`
+
- Valid range: `0..15`
+
+
### Bit Definitions:
+
+
- `AAAA`: Age/Intensity level (4 bits)
+
- `0`: Newly created fire
+
- `1-14`: Aging fire
+
- `15`: Maximum age (most likely to spread or die out)
+
+
### Special Behaviors:
+
+
- Age increases by 0 or 1 each tick (randomly)
+
- Death conditions:
+
- Age > 3 and no solid block below = dies
+
- Age = 15 and no flammable neighbors = may die randomly
+
- Younger fires spread more aggressively
+
+
### Examples:
+
+
- `0 (0000)`: Fresh fire just lit
+
- `5 (0101)`: Moderate age fire
+
- `15 (1111)`: Maximum age fire
+
+
## Stairs Metadata
+
+
- Bit Usage: `- - D D`
+
- Valid range: `0..3`
+
+
### Bit Definitions:
+
+
- `DD`: Facing direction
+
- `0`: Ascending East (facing West wall)
+
- `1`: Ascending West (facing East wall)
+
- `2`: Ascending South (facing North wall)
+
- `3`: Ascending North (facing South wall)
+
+
### Examples:
+
+
- `0 (0000)`: Stairs ascending toward East
+
- `1 (0001)`: Stairs ascending toward West
+
- `2 (0010)`: Stairs ascending toward South
+
- `3 (0011)`: Stairs ascending toward North
+
+
## Redstone Wire Metadata
+
+
- Bit Usage: `P P P P`
+
- Valid range: `0..15`
+
+
### Bit Definitions:
+
+
- `PPPP`: Power level
+
- `0`: No power
+
- `1-15`: Power strength (15 is maximum)
+
+
### Examples:
+
+
- `0 (0000)`: Unpowered wire
+
- `1 (0001)`: Weak power (far from source)
+
- `15 (1111)`: Maximum power (at source or powered by strong source)
+
+
## Wheat Metadata
+
+
- Bit Usage: `- G G G`
+
- Valid range: `0..7`
+
+
### Bit Definitions:
+
+
- `GGG`: Growth stage
+
- `0`: Just planted (smallest)
+
- `1-6`: Growing stages
+
- `7`: Fully grown (ready to harvest)
+
+
### Examples:
+
+
- `0 (0000)`: Newly planted wheat
+
- `3 (0011)`: Half-grown wheat
+
- `7 (0111)`: Fully mature wheat (harvestable)
+
+
## Farmland Metadata
+
+
- Bit Usage: `- H H H`
+
- Valid range: `0..7`
+
+
### Bit Definitions:
+
+
- `HHH`: Hydration level
+
- `0`: Dry farmland (will revert to dirt without crops nearby)
+
- `1-6`: Partially hydrated
+
- `7`: Fully hydrated (optimal for crop growth)
+
+
### Examples:
+
+
- `0 (0000)`: Dry farmland
+
- `4 (0100)`: Moderately hydrated farmland
+
- `7 (0111)`: Fully hydrated farmland
+
+
## Furnace Metadata
+
+
- Bit Usage: `- - D D`
+
- Valid range: `2..5`
+
+
### Bit Definitions:
+
+
- `DD`: Facing direction
+
- `2`: North (Negative Z)
+
- `3`: South (Positive Z)
+
- `4`: West (Negative X)
+
- `5`: East (Positive X)
+
+
### Special Behaviors:
+
+
- Note that idle/active state is determined by block ID
+
+
### Examples:
+
+
- `2 (0010)`: Furnace facing North
+
- `3 (0011)`: Furnace facing South
+
- `4 (0100)`: Furnace facing West
+
- `5 (0101)`: Furnace facing East
+
+
## Standing Sign Metadata
+
+
- Bit Usage: `D D D D`
+
- Valid range: `0..15`
+
+
### Bit Definitions:
+
+
- `DDDD`: Rotation direction
+
- `0`: South
+
- `1`: South-Southwest
+
- `2`: Southwest
+
- `3`: West-Southwest
+
- `4`: West
+
- `5`: West-Northwest
+
- `6`: Northwest
+
- `7`: North-Northwest
+
- `8`: North
+
- `9`: North-Northeast
+
- `10`: Northeast
+
- `11`: East-Northeast
+
- `12`: East
+
- `13`: East-Southeast
+
- `14`: Southeast
+
- `15`: South-Southeast
+
+
### Examples:
+
+
- `0 (0000)`: Sign facing South
+
- `4 (0100)`: Sign facing West
+
- `8 (1000)`: Sign facing North
+
- `12 (1100)`: Sign facing East
+
+
## Wall Sign Metadata
+
+
- Bit Usage: `- - D D`
+
- Valid range: `2..5`
+
+
### Bit Definitions:
+
+
- `DD`: Attached wall direction
+
- `2`: Attached to North wall (facing South)
+
- `3`: Attached to South wall (facing North)
+
- `4`: Attached to West wall (facing East)
+
- `5`: Attached to East wall (facing West)
+
+
### Examples:
+
+
- `2 (0010)`: Wall sign facing South (attached to North wall)
+
- `3 (0011)`: Wall sign facing North (attached to South wall)
+
- `4 (0100)`: Wall sign facing East (attached to West wall)
+
- `5 (0101)`: Wall sign facing West (attached to East wall)
+
+
## Door Metadata
+
+
- Bit Usage: `T O F F`
+
- Valid range: `0..15`
+
+
### Bit Definitions:
+
+
- `FF`: Facing direction
+
- `0`: North (Negative Z)
+
- `1`: East (Positive X)
+
- `2`: South (Positive Z)
+
- `3`: West (Negative X)
+
+
- `O`: Is Open
+
- `0`: Closed
+
- `1`: Open
+
+
- `T`: Half
+
- `0`: Bottom half of door
+
- `1`: Top half of door
+
+
### Examples:
+
+
- `0 (0000)`: Bottom half, closed, facing North
+
- `4 (0100)`: Bottom half, open, facing North
+
- `8 (1000)`: Top half, closed, facing North
+
- `12 (1100)`: Top half, open, facing North
+
+
## Ladder Metadata
+
+
- Bit Usage: `- - D D`
+
- Valid range: `2..5`
+
+
### Bit Definitions:
+
+
- `DD`: Attached wall direction
+
- `2`: Attached to South wall (facing North)
+
- `3`: Attached to North wall (facing South)
+
- `4`: Attached to East wall (facing West)
+
- `5`: Attached to West wall (facing East)
+
+
### Examples:
+
+
- `2 (0010)`: Ladder on South wall (climb facing North)
+
- `3 (0011)`: Ladder on North wall (climb facing South)
+
- `4 (0100)`: Ladder on East wall (climb facing West)
+
- `5 (0101)`: Ladder on West wall (climb facing East)
+
+
## Lever Metadata
+
+
- Bit Usage: `A A A A`
+
- Valid range: `1..14`
+
+
### Bit Definitions:
+
+
- `AAA`: Attachment orientation
+
- `1`: Attached to West wall (lever points East)
+
- `2`: Attached to East wall (lever points West)
+
- `3`: Attached to North wall (lever points South)
+
- `4`: Attached to South wall (lever points North)
+
- `5`: On ground/ceiling (random orientation)
+
- `6`: On ground/ceiling (alternate orientation)
+
+
- `A`:` Is Activated
+
- `0`: Lever off
+
- `1`: Lever on
+
+
### Examples:
+
+
- `1 (0001)`: Wall lever off, pointing East
+
- `9 (1001)`: Wall lever on, pointing East
+
- `5 (0101)`: Ground lever off
+
- `13 (1101)`: Ground lever on
+
+
## Pressure Plate Metadata
+
+
- Bit Usage: `- - - A`
+
- Valid range: `0..1`
+
+
### Bit Definitions:
+
+
- `A`: Activation state
+
- `0`: Not pressed
+
- `1`: Pressed
+
+
### Examples:
+
+
- `0 (0000)`: Pressure plate not pressed
+
- `1 (0001)`: Pressure plate pressed (providing power)
+
+
## Redstone Torch Metadata
+
+
- Bit Usage: `- A A A`
+
- Valid range: `1..5`
+
+
### Bit Definitions:
+
+
- `AAA`: Attachment direction
+
- `1`: Attached to West face (pointing East)
+
- `2`: Attached to East face (pointing West)
+
- `3`: Attached to North face (pointing South)
+
- `4`: Attached to South face (pointing North)
+
- `5`: Standing on ground/block below
+
+
### Special Behaviors:
+
+
- Note that on/off state is determined by block ID
+
+
### Examples:
+
+
- `1 (0001)`: Redstone torch pointing East (attached to West wall)
+
- `3 (0011)`: Redstone torch pointing South (attached to North wall)
+
- `5 (0101)`: Standing redstone torch (on ground/block below)
+
+
## Snow Layer Metadata
+
+
- Bit Usage: `- D D D`
+
- Valid range: `0..7`
+
+
### Bit Definitions:
+
+
- `DDD`: Snow depth/thickness
+
- `0`: 1 layer thick (2/16 blocks high)
+
- `1`: 2 layers thick (4/16 blocks high)
+
- `2`: 3 layers thick (6/16 blocks high)
+
- `3`: 4 layers thick (0.5 blocks high, starts having collision)
+
- `4`: 5 layers thick (10/16 blocks high)
+
- `5`: 6 layers thick (12/16 blocks high)
+
- `6`: 7 layers thick (14/16 blocks high)
+
- `7`: 8 layers thick (1 block high)
+
+
### Examples:
+
+
- `0 (0000)`: Thin snow layer (2/16 block high)
+
- `3 (0011)`: Half-block snow (8/16 block high, has collision)
+
- `7 (0111)`: Full-block snow (16/16 block high)
+
+
## Button Metadata
+
+
- Bit Usage: `A D D D`
+
- Valid range: `1..12`
+
+
### Bit Definitions:
+
+
- `DDD`: Attached wall direction
+
- `1`: Attached to West wall (button faces East)
+
- `2`: Attached to East wall (button faces West)
+
- `3`: Attached to North wall (button faces South)
+
- `4`: Attached to South wall (button faces North)
+
+
- `A`: Activated state
+
- `0`: Button not pressed
+
- `1`: Button pressed
+
+
### Examples:
+
+
- `1 (0001)`: Button on West wall, not pressed
+
- `9 (1001)`: Button on West wall, pressed (providing power)
+
- `4 (0100)`: Button on South wall, not pressed
+
- `12 (1100)`: Button on South wall, pressed (providing power)
+
+
## Pumpkin Metadata
+
+
- Bit Usage: `- - D D`
+
- Valid range: `0..3`
+
+
### Bit Definitions:
+
+
- `DD`: Facing direction
+
- `0`: South (Positive Z)
+
- `1`: West (Negative X)
+
- `2`: North (Negative Z)
+
- `3`: East (Positive X)
+
+
### Examples:
+
+
- `0 (0000)`: Pumpkin facing South
+
- `1 (0001)`: Pumpkin facing West
+
- `2 (0010)`: Pumpkin facing North
+
- `3 (0011)`: Pumpkin facing East
+
+
## Cake Metadata
+
+
- Bit Usage: `- B B B`
+
- Valid range: `0..5`
+
+
### Bit Definitions:
+
+
- `BBB`: Slices eaten
+
- `0`: Whole cake
+
- `1-5`: Number of slices eaten so far
+
+
### Examples:
+
+
- `0 (0000)`: Full cake, uneaten
+
- `3 (0011)`: 3 slices eaten (half cake left)
+
- `5 (0101)`: 5 slices eaten (last visible slice)
+
+
## Redstone Repeater Metadata
+
+
- Bit Usage: `D D F F`
+
- Valid range: `0..15`
+
+
### Bit Definitions:
+
+
- `FF`: Facing (output direction)
+
- `0`: South (Positive Z)
+
- `1`: West (Negative X)
+
- `2`: North (Negative Z)
+
- `3`: East (Positive X)
+
+
- `DD`: Delay setting
+
- `0`: 1 redstone tick (2 ticks)
+
- `1`: 2 redstone ticks (4 ticks)
+
- `2`: 3 redstone ticks (6 ticks)
+
- `3`: 4 redstone ticks (8 ticks)
+
+
### Special Behaviors:
+
+
- Note that powered/unpowered state is determined by block ID.
+
+
### Examples:
+
+
- `0 (0000)`: Facing South, 1-tick delay
+
- `5 (0101)`: Facing West, 2-tick delay
+
- `10 (1010)`: Facing North, 3-tick delay
+
- `15 (1111)`: Facing East, 4-tick delay
+
+
## Trapdoor Metadata
+
+
- Bit Usage: `O D D`
+
- Valid range: `0..7`
+
+
### Bit Definitions:
+
+
- `DD`: Attached wall
+
- `0`: Attached to South wall (block at +Z)
+
- `1`: Attached to North wall (block at −Z)
+
- `2`: Attached to East wall (block at +X)
+
- `3`: Attached to West wall (block at −X)
+
+
- `O`: Open state
+
- `0`: Closed
+
- `1`: Open
+
+
### Examples:
+
+
- `0 (000)`: Closed, attached to South wall
+
- `1 (001)`: Closed, attached to North wall
+
- `4 (100)`: Open, attached to South wall
+
- `7 (111)`: Open, attached to West wall
+
+
[wheat]: #wheat-metadata
+
[trapdoor]: #trapdoor-metadata
+
[redstone_repeater]: #redstone-repeater-metadata
+
[cake]: #cake-metadata
+
[pumpkin]: #pumpkin-metadata
+
[button]: #button-metadata
+
[snow_layer]: #snow-layer-metadata
+
[redstone_torch]: #redstone-torch-metadata
+
[pressure_plate]: #pressure-plate-metadata
+
[lever]: #lever-metadata
+
[ladder]: #ladder-metadata
+
[door]: #door-metadata
+
[standing_sign]: #standing-sign-metadata
+
[wall_sign]: #wall-sign-metadata
+
[furnace]: #furnace-metadata
+
[farmland]: #farmland-metadata
+
[redstone_wire]: #redstone-wire-metadata
+
[stairs]: #stairs-metadata
+
[fire]: #fire-metadata
+
[torch]: #torch-metadata
+
[piston]: #piston-metadata
+
[piston_head]: #piston-head-metadata
+
[fluid]: #fluid-metadata
+
[dispenser]: #dispenser-metadata
+
[bed]: #bed-metadata
+
[rail]: #rail-metadata
+
[powered_rail]: #powered-rail-metadata
+
[detector_rail]: #detector-rail-metadata
+179
docs/items.md
···
+
# Items
+
+
For empty "data use", assume it to **always** be `0`.
+
+
| Name | ID | Data Use |
+
| ----------------------- | ---- | ---------------------- |
+
| Iron Shovel | 256 | Damage |
+
| Iron Pickaxe | 257 | Damage |
+
| Iron Axe | 258 | Damage |
+
| Flint and Steel | 259 | Damage |
+
| Apple | 260 | |
+
| Bow | 261 | |
+
| Arrow | 262 | |
+
| Coal | 263 | Type distinction: `0` |
+
| Charcoal | 263 | Type distinction: `1` |
+
| Diamond | 264 | |
+
| Iron Ingot | 265 | |
+
| Gold Ingot | 266 | |
+
| Iron Sword | 267 | Damage |
+
| Wooden Sword | 268 | Damage |
+
| Wooden Shovel | 269 | Damage |
+
| Wooden Pickaxe | 270 | Damage |
+
| Wooden Axe | 271 | Damage |
+
| Stone Sword | 272 | Damage |
+
| Stone Shovel | 273 | Damage |
+
| Stone Pickaxe | 274 | Damage |
+
| Stone Axe | 275 | Damage |
+
| Diamond Sword | 276 | Damage |
+
| Diamond Shovel | 277 | Damage |
+
| Diamond Pickaxe | 278 | Damage |
+
| Diamond Axe | 279 | Damage |
+
| Stick | 280 | |
+
| Bowl | 281 | |
+
| Mushroom Stew | 282 | |
+
| Golden Sword | 283 | Damage |
+
| Golden Shovel | 284 | Damage |
+
| Golden Pickaxe | 285 | Damage |
+
| Golden Axe | 286 | Damage |
+
| String | 287 | |
+
| Feather | 288 | |
+
| Gunpowder | 289 | |
+
| Wooden Hoe | 290 | Damage |
+
| Stone Hoe | 291 | Damage |
+
| Iron Hoe | 292 | Damage |
+
| Golden Hoe | 293 | Damage |
+
| Diamond Hoe | 294 | Damage |
+
| Seeds | 295 | |
+
| Wheat | 296 | |
+
| Bread | 297 | |
+
| Leather Helmet | 298 | Damage |
+
| Leather Chestplate | 299 | Damage |
+
| Leather Leggings | 300 | Damage |
+
| Leather Boots | 301 | Damage |
+
| Chainmail Helmet | 302 | Damage |
+
| Chainmail Chestplate | 303 | Damage |
+
| Chainmail Leggings | 304 | Damage |
+
| Chainmail Boots | 305 | Damage |
+
| Iron Helmet | 306 | Damage |
+
| Iron Chestplate | 307 | Damage |
+
| Iron Leggings | 308 | Damage |
+
| Iron Boots | 309 | Damage |
+
| Diamond Helmet | 310 | Damage |
+
| Diamond Chestplate | 311 | Damage |
+
| Diamond Leggings | 312 | Damage |
+
| Diamond Boots | 313 | Damage |
+
| Golden Helmet | 314 | Damage |
+
| Golden Chestplate | 315 | Damage |
+
| Golden Leggings | 316 | Damage |
+
| Golden Boots | 317 | Damage |
+
| Flint | 318 | |
+
| Raw Porkchop | 319 | |
+
| Cooked Porkchop | 320 | |
+
| Painting | 321 | |
+
| Golden Apple | 322 | |
+
| Sign | 323 | |
+
| Wooden Door | 324 | |
+
| Bucket | 325 | |
+
| Water Bucket | 326 | |
+
| Lava Bucket | 327 | |
+
| Minecart | 328 | |
+
| Saddle | 329 | |
+
| Iron Door | 330 | |
+
| Redstone Dust | 331 | |
+
| Snowball | 332 | |
+
| Boat | 333 | |
+
| Leather | 334 | |
+
| Milk Bucket | 335 | |
+
| Brick | 336 | |
+
| Clay | 337 | |
+
| Sugar Cane | 338 | |
+
| Paper | 339 | |
+
| Book | 340 | |
+
| Slime Ball | 341 | |
+
| Minecart with Chest | 342 | |
+
| Minecart with Furnace | 343 | |
+
| Egg | 344 | |
+
| Compass | 345 | |
+
| Fishing Rod | 346 | Damage |
+
| Clock | 347 | |
+
| Glowstone Dust | 348 | |
+
| Raw Fish | 349 | |
+
| Cooked Fish | 350 | |
+
| Ink Sac | 351 | Type distinction: `0` |
+
| Rose Red | 351 | Type distinction: `1` |
+
| Cactus Green | 351 | Type distinction: `2` |
+
| Cocoa Beans | 351 | Type distinction: `3` |
+
| Lapis Lazuli | 351 | Type distinction: `4` |
+
| Purple Dye | 351 | Type distinction: `5` |
+
| Cyan Dye | 351 | Type distinction: `6` |
+
| Light Gray (Silver) Dye | 351 | Type distinction: `7` |
+
| Gray Dye | 351 | Type distinction: `8` |
+
| Pink Dye | 351 | Type distinction: `9` |
+
| Lime Dye | 351 | Type distinction: `10` |
+
| Yellow Dye | 351 | Type distinction: `11` |
+
| Light Blue Dye | 351 | Type distinction: `12` |
+
| Magenta Dye | 351 | Type distinction: `13` |
+
| Orange Dye | 351 | Type distinction: `14` |
+
| Bone Meal | 351 | Type distinction: `15` |
+
| Bone | 352 | |
+
| Sugar | 353 | |
+
| Cake | 354 | |
+
| Bed | 355 | |
+
| Redstone Repeater | 356 | |
+
| Cookie | 357 | |
+
| Map | 358 | Map ID |
+
| Shears | 359 | Damage |
+
| Music Disc 13 | 2256 | |
+
| Music Disc Cat | 2257 | |
+
+
## Durability
+
+
### Tools
+
+
- Wooden tools have a maximum usage of `59`.
+
- Stone tools have a maximum usage of `131`.
+
- Iron tools have a maximum usage of `250`.
+
- Gold tools have a maximum usage of `32`.
+
- Diamond tools have a maximum usage of `1561`.
+
+
### Armor
+
+
- Helmets have a base maximum usage of `11`.
+
- Chestplates have a base maximum usage of `16`.
+
- Leggings have a base maximum usage of `15`.
+
- Boots have a base maximum usage of `13`.
+
+
The base usage is then multiplied based off the tier of material:
+
+
- Leather: `3`
+
- Chain: `6`
+
- Gold: `6`
+
- Iron: `12`
+
- Diamond: `24`
+
+
### Other
+
+
- Shears have a maximum usage of `238`.
+
- Fishing rods have a maximum usage of `64`.
+
- Flint and Steel has a maximum usage of `64`.
+
+
## Entity Damage
+
+
- Swords have a base damage of `4`.
+
- Axes have a base damage of `3`.
+
- Pickaxes have a base damage of `2`.
+
- Shovels have a base damage of `1`.
+
+
The base damage is then added with a value based off the tier of material:
+
+
- Wood: `0`
+
- Stone: `1`
+
- Iron: `2`
+
- Gold: `0`
+
- Diamond: `3`
+
+
### Swords
+
+
The "material modifier" is multiplied by `2` before being added to the base
+
damage.
+1410
docs/packets.md
···
+
# Packets <img src=".assets/cc-by-sa.png" alt="CC-BY-SA" width="88" height="31">
+
+
_This document is licensed under a [Creative Commons Attribution-ShareAlike 4.0
+
license](https://creativecommons.org/licenses/by-sa/4.0/). Derivative works must
+
be licensed using the same or a compatible license._
+
+
All packets begin with a single "Packet ID" byte. Listed packet size **does not
+
include** this byte. Packets are either Clientbound, Serverbound, or both.
+
Packets that travel both Clientbound and Serverbound may reuse fields for
+
different purposes.
+
+
There is no "length" field; for variable length packets, you must parse to the
+
end to determine the length.
+
+
## Data Types
+
+
| | Size (bytes) | Range | Notes |
+
| ----- | ------------ | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
+
| i8 | 1 | -128 to 127 | |
+
| u8 | 1 | 0 to 255 | |
+
| i16 | 2 | -32768 to 32767 | |
+
| i32 | 4 | -2147483648 to 2147483647 | |
+
| i64 | 8 | -9223372036854775808 to 9223372036854775807 | |
+
| f32 | 4 | See [here][java8spec_floating]. | Single-precision 32-bit IEEE754 floating point. |
+
| f64 | 8 | See [here][java8spec_floating]. | Double-precision 64-bit IEEE754 floating point. |
+
| str8 | >=2 | N/A | [Modified UTF-8][mutf8] string. Prefixed by an `i16` containing the length of the string **in bytes**. |
+
| 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**. |
+
| bool | 1 | `0x00` (`false`) or `0x01` (`true`) | |
+
+
There are also additional types being used:
+
+
### Entity types
+
+
| ID | Entity | Category | LivingEntity |
+
| --- | ------------- | ---------- | ------------ |
+
| 1 | Item | Misc | ❌ |
+
| 9 | Painting | Misc | ❌ |
+
| 10 | Arrow | Projectile | ❌ |
+
| 11 | Snowball | Projectile | ❌ |
+
| 20 | Primed TNT | Misc | ❌ |
+
| 21 | Falling Sand | Misc | ❌ |
+
| 40 | Minecart | Vehicle | ❌ |
+
| 41 | Boat | Vehicle | ❌ |
+
| 50 | Creeper | Hostile | ✅ |
+
| 51 | Skeleton | Hostile | ✅ |
+
| 52 | Spider | Hostile | ✅ |
+
| 53 | Giant | Hostile | ✅ |
+
| 54 | Zombie | Hostile | ✅ |
+
| 55 | Slime | Hostile | ✅ |
+
| 56 | Ghast | Hostile | ✅ |
+
| 57 | Zombie Pigman | Neutral | ✅ |
+
| 90 | Pig | Passive | ✅ |
+
| 91 | Sheep | Passive | ✅ |
+
| 92 | Cow | Passive | ✅ |
+
| 93 | Chicken | Passive | ✅ |
+
| 94 | Squid | Passive | ✅ |
+
| 95 | Wolf | Passive | ✅ |
+
+
### Entity Metadata
+
+
Entity metadata has a quirky packing format.
+
+
A metadata field is a byte. The top three bits of the byte, when masked off
+
(`(byte & 224) >> 5`) and interpreted as a three-bit number from 0 to 7,
+
indicate the type of the field.
+
+
The lower five bits are unused. The type of the byte indicates the size and
+
type of a payload which follows the initial byte of the field.
+
+
The metadata format consists of at least one field, followed by either another
+
field or the magic number `0x7F`. `0x7F` terminates a metadata stream.
+
+
Thus, the example metadata stream `0x00 0x01 0x7f` is decoded as a field of
+
type 0, id 0, with a payload of byte 0x00.
+
+
| Field ID | Field Type |
+
| -------- | ------------------------------------------- |
+
| 0 | i8 |
+
| 1 | i16 |
+
| 2 | i32 |
+
| 3 | f32 |
+
| 4 | str16 (maximum character length of 64) |
+
| 5 | ItemStack; `i16` ID, `i8` count, `i16` data |
+
| 6 | Vector of `i32`, 3 long (x,y,z) |
+
+
More information is available at [0x18 Spawn Living Entity][spawn_living_entity].
+
+
### Packed f64
+
+
Sent as an `i32` on the wire, but is actually an `f64`.
+
+
Java:
+
+
```java
+
public static int floorDouble(double aDouble) {
+
int anInteger = (int)aDouble;
+
return aDouble < (double)anInteger ? anInteger - 1 : anInteger;
+
}
+
```
+
+
### Packed Rotation
+
+
Sent as an `i8` on the wire, but is actually an `f32`.
+
+
Basically, takes a rotation in degrees (`0..360`) and maps it into `0..255`.
+
+
Java:
+
+
```java
+
public static byte packRotation(float rotation) {
+
return (byte)((int)(rotation * 256.0F / 360.0F))
+
}
+
```
+
+
### Packed Motion i8
+
+
Sent as an `i8` on the wire, but is actually an `f64`.
+
+
Basically, just multiply the value by `128` and turn it into a (signed) byte.
+
+
Java:
+
+
```java
+
public static byte packMotion(double motion) {
+
return (byte)((int)(motion * 128.0D))
+
}
+
```
+
+
### Packed Motion i16
+
+
Sent as an `i16` on the wire, but is actually an `f64`.
+
+
Basically, just multiply the value by `128` and turn it into a (signed) byte.
+
+
Java:
+
+
```java
+
public static byte packMotion(double motion) {
+
return (byte)((int)(motion * 128.0D))
+
}
+
```
+
+
## 0x00 Keep Alive
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 0
+
+
This packet must be sent to keep the connection alive.
+
+
- Keep Alive has no payload.
+
+
## 0x01 Login Request
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 15 + length of strings
+
+
### Clientbound
+
+
Sent by the server if it accepts the client's login request. If it didn't it
+
will send a [Disconnect][disconnect] instead.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | --------------------------------------------------------------------------- |
+
| Entity ID | i32 | `14` | The protocol version of Beta 1.7 is 14 |
+
| Unused | str16 | N/A | Unused by the client. Vanilla server sends an empty string |
+
| Map Seed | i64 | `0` | Used by the client to determine its current biome, among a few other things |
+
| Dimension | i8 | `0` | `-1` for the Nether, `0` for the Overworld |
+
+
### Serverbound
+
+
Sent by the client after the handshake to finish logging in.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------------- | ---------- | ------------- | ------------------------------------------------------------------------------- |
+
| Protocol version | i32 | `14` | The protocol version of Beta 1.7 is 14 |
+
| Username | str16 | `kokiriglade` | The name of the player attempting to login. Max length of 16 |
+
| Map Seed | i64 | `0` | Can be safely ignored by the server |
+
| Dimension | i8 | `0` | `-1` for the Nether, `0` for the Overworld. Can be safely ignored by the server |
+
+
## 0x02 Handshake
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 2 + length of strings
+
+
### Clientbound
+
+
| Field Name | Field Type | Example | Notes |
+
| --------------- | ---------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+
| 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 `-` |
+
+
### Serverbound
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------------- | ---------------------------------------------------------------------------- |
+
| Username | str16 | `kokiriglade` | The name of the player attempting to connect. Maximum character length of 16 |
+
+
## 0x03 Chat Message
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 2 + length of strings
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ---------------------- | ----------------------------------------------------------------------------- |
+
| Message | str16 | `<kokiriglade> Hello!` | The name of the player attempting to connect. Maximum character length of 119 |
+
+
## 0x04 Update Time
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 8
+
+
The time of day is based on `timestamp % 24000`, where:
+
+
- 0 is sunrise
+
- 6000 is noon
+
- 12000 is sunset
+
- 18000 is midnight
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ----------------------- |
+
| Time | i64 | | The world time in ticks |
+
+
## 0x05 Set Player Equipment
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 10
+
+
After each [player spawn][spawn_player], there will be five of these packets for
+
the equipped item and armor. If there are changes in visible equipment, another
+
one of these packets is sent.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ------------------------------------ |
+
| Entity ID | i32 | | Player's entity ID |
+
| Slot | i16 | `4` | Equipment slot. See below |
+
| Item ID | i16 | `-1` | Equipped item (`-1` for aempty slot) |
+
| Data | i16 | | Item data value |
+
+
### Equipment slots
+
+
(These only apply to this packet)
+
+
- `0`: Held item
+
- `1`: Helmet
+
- `2`: Chestpate
+
- `3`: Leggings
+
- `4`: Boots
+
+
## 0x06 Spawn Position
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 12
+
+
Sent after login to specify the coordinates of the spawn point (the location at
+
which players spawn, and which the compass points to).
+
+
It can be sent at any time to update the point compasses point to.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ---------------------------- |
+
| X | i32 | `117` | Spawn X in block coordinates |
+
| Y | i32 | `70` | Spawn Y in block coordinates |
+
| Z | i32 | `-46` | Spawn Z in block coordinates |
+
+
## 0x07 Use Entity
+
+
- Clientbound: [ ]
+
- Serverbound: [x]
+
- Size: 9
+
+
Sent upon attacking or right clicking an entity.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------------- | ---------- | ------- | ----------------------------------------------------------------------- |
+
| Entity ID | i32 | | Player's entity ID. Ignored by the server |
+
| Target entity ID | i32 | | Entity ID of the entity being interacted with |
+
| Left click | bool | `true` | `true` if the interaction was caused by a left click, `false` otherwise |
+
+
## 0x08 Update Health
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 2
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ---------------- |
+
| Health | i16 | `20` | Half a heart = 1 |
+
+
## 0x09 Respawn
+
+
- Clientbound: [X]
+
- Serverbound: [X]
+
- Size: 1
+
+
Sent by the client when the player presses the "Respawn" button after dying.
+
The server then teleports the player to the spawn point, and sends a respawn
+
packet in response. The client will not leave the respawn screen until it
+
receives a respawn packet.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ------------------------------------------------------------------------------- |
+
| Dimension | i8 | `0` | `-1` for the Nether, `0` for the Overworld. Can be safely ignored by the server |
+
+
## 0x0A On Ground
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 1
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | -------------------------------------------------------- |
+
| On Ground | bool | `true` | `true` if the player is on the ground, `false` otherwise |
+
+
## 0x0B Player Position
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 33
+
+
Updates the player position on the server. If `(stance - y) < 0.1 || (stance - y) > 1.65`
+
then the stance is illegal.
+
+
If the distance between the last known position of
+
the player and the new position set by this packet is greater than 100, then the
+
movement is illegal.
+
+
If the absolute number of `x` or `z` are set greater than `3.2E7` then the
+
position is illegal.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | --------- | ----------------------------------------------------------------------------- |
+
| X | f64 | `102.809` | |
+
| Y | f64 | `70.00` | |
+
| Stance | f64 | `71.62` | Used to modify the players bounding box when going up stairs, crouching, etc. |
+
| Z | f64 | `68.30` | |
+
| On Ground | bool | `true` | `true` if the player is on the ground, `false` otherwise |
+
+
## 0x0C Player Look
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 9
+
+
Updates the direction the player is looking in.
+
+
Yaw is measured in degrees, and does not follow classical trigonometry rules.
+
+
The unit circle of yaw on the xz-plane starts at (0, 1) and turns backwards
+
towards (-1, 0), or in other words, it turns clockwise instead of
+
counter-clockwise. Additionally, yaw is not clamped to between 0 and 360
+
degrees; any number is valid, including negative numbers and numbers greater
+
than 360.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | -------------------------------------------------------- |
+
| Yaw | f32 | `0.0` | Rotation on the X Axis, in degrees |
+
| Pitch | f32 | `0.0` | Rotation on the Y axis, in degrees |
+
| On Ground | bool | `true` | `true` if the player is on the ground, `false` otherwise |
+
+
## 0x0D Player Position and Look
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 41
+
+
A combination of [Player Look][player_look] and [Player Position][player_position].
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | --------- | ----------------------------------------------------------------------------- |
+
| X | f64 | `102.809` | |
+
| Y | f64 | `70.00` | |
+
| Stance | f64 | `71.62` | Used to modify the players bounding box when going up stairs, crouching, etc. |
+
| Z | f64 | `68.30` | |
+
| Yaw | f32 | `0.0` | Rotation on the X Axis, in degrees |
+
| Pitch | f32 | `0.0` | Rotation on the Y axis, in degrees |
+
| On Ground | bool | `true` | `true` if the player is on the ground, `false` otherwise |
+
+
## 0x0E Block Dig
+
+
- Clientbound: [ ]
+
- Serverbound: [x]
+
- Size: 11
+
+
Sent when the player is digging a block.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ------------------------------------------------------------- |
+
| Status | i8 | `1` | The action the player is taking against the block (see below) |
+
| X | i32 | `32` | Block position |
+
| Y | i8 | `64` | Block position |
+
| Z | i32 | `32` | Block position |
+
| Face | i8 | `3` | The face being hit (see below) |
+
+
### Status
+
+
Status can be:
+
+
- `0`: Started digging
+
- `2`: Finished digging
+
- `4`: Drop item
+
+
### Special cases
+
+
For some unthinkable reason, when the player drops an item, it sends this packet
+
but the status is `4`, and all other values are `0`.
+
+
### Face
+
+
Face can be:
+
+
- `0`: Negative Y
+
- `1`: Positive Y
+
- `2`: Negative Z
+
- `3`: Positive Z
+
- `4`: Negative X
+
- `5`: Positive X
+
+
## 0x0F Block Interact
+
+
- Clientbound: [ ]
+
- Serverbound: [x]
+
- Size: 12 or 15
+
+
Sent when the player places a block or (probably) an item. The coordinates sent
+
in this packet are actually the block being built against, which combined with
+
the direction offset tell you where the block should be placed. This is
+
required to correctly position furnaces, torches, etc.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------------- | ------------- | ------- | ---------------------------------------------------------- |
+
| X | i32 | `32` | Block position |
+
| Y | i8 | `64` | Block position |
+
| Z | i32 | `32` | Block position |
+
| Face | i8 | `3` | The face being placed against (see [Block Dig][block_dig]) |
+
| Block or Item ID | i16 | `1` | The block or item to be placed |
+
| Count | Optional<i8> | `34` | The count of the itemstack in the players hand |
+
| Data | Optional<i16> | `83` | The data value of the itemstack |
+
+
If the Block/ItemID field is greater than or equal to 0, then the last
+
2 fields (count and data) are read. Otherwise, they are not read.
+
+
When 'placing' (Or more accurately, using) your empty hand, the client sends -1
+
as the Block/Item ID.
+
+
### Special cases
+
+
This packet has a special case where X, Y, Z, and Direction are all -1.
+
This special packet indicates that the currently held item for the player should
+
have its state updated such as eating food, shooting bows, using buckets, etc.
+
+
When using buckets, the client might send two packets: first a normal and then a
+
special case. The first normal packet is sent when you're looking at a block
+
(e.g. the water you want to scoop up). This normal packet does not appear to do
+
anything with a Vanilla server. The second, special case packet appears to
+
perform the action - based on current position/orientation and with a distance
+
check - it appears that buckets can only be used within a radius of 6 blocks.
+
+
## 0x10 Change Current Slot
+
+
- Clientbound: [ ]
+
- Serverbound: [x]
+
- Size: 2
+
+
Sent when the player changes their current/active slot.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | --------------------------------- |
+
| Slot ID | i16 | `1` | Valid values are 0..8 (inclusive) |
+
+
## 0x11 Sleep
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 14
+
+
Sent to indicate a player is sleeping in a bed.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ------------------ |
+
| Entity ID | i32 | `89` | Player's entity ID |
+
| Unknown | i8 | `0` | Always 0, unused |
+
| X | i32 | `-247` | Block coordinate |
+
| Y | i8 | `78` | Block coordinate |
+
| Z | i32 | `128` | Block coordinate |
+
+
## 0x12 Animation
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 5
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ------------------ |
+
| Entity ID | i32 | `55534` | Player's entity ID |
+
| Animate | i8 | `1` | See below |
+
+
### Animate
+
+
Animate can be:
+
+
- `0`: No animation
+
- `1`: Swing arm
+
- `2`: Damage animation
+
- `3`: Leave bed
+
+
## 0x13 Player Action
+
+
- Clientbound: [ ]
+
- Serverbound: [x]
+
- Size: 5
+
+
Sent when crouching and leaving a bed.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ------------------ |
+
| Entity ID | i32 | `55534` | Player's entity ID |
+
| Action | i8 | `1` | See below |
+
+
### Action
+
+
Action can be:
+
+
- `1`: Start crouching
+
- `2`: Stop crouching
+
- `3`: Leave bed
+
+
## 0x14 Spawn Player
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 22 + length of strings
+
+
Sent when a player comes into visible range. The vanilla client is not okay
+
with receiving player entity packets that refer to its own username or EID; it
+
will teleport to the absolute origin of the map and fall through the void any
+
time it receives them.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------------- | --------------------------------------------------------------------- |
+
| Entity ID | i32 | `94453` | Player's entity ID |
+
| Name | str16 | `kokiriglade` | Maximum character length of 16 |
+
| X | i32 | `102.809` | [Packed f64][packed_f64] |
+
| Y | i32 | `70.00` | [Packed f64][packed_f64] |
+
| Z | i32 | `68.30` | [Packed f64][packed_f64] |
+
| Yaw | i8 | `0.0` | [Packed rotation][packed_rotation] |
+
| Pitch | i8 | `0.0` | [Packed rotation][packed_rotation] |
+
| Held Item | i16 | `0` | The item the player is holding. `0` for no item. Must not be negative |
+
+
## 0x15 Spawn Item
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 24
+
+
Sent when a thrown item comes into range of the player.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | --------- | ------------------------------------ |
+
| Entity ID | i32 | `157617` | Item's entity ID |
+
| Item ID | i16 | `4` | |
+
| Count | i8 | `1` | The count of the itemstack |
+
| Data | i16 | Item data | |
+
| X | i32 | `102.809` | [Packed f64][packed_f64] |
+
| Y | i32 | `70.00` | [Packed f64][packed_f64] |
+
| Z | i32 | `68.30` | [Packed f64][packed_f64] |
+
| Motion X | i8 | `0.0` | [Packed motion-i8][packed_motion_i8] |
+
| Motion Y | i8 | `0.0` | [Packed motion-i8][packed_motion_i8] |
+
| Motion Z | i8 | `0.0` | [Packed motion-i8][packed_motion_i8] |
+
+
## 0x16 Pickup Item
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 8
+
+
Sent when someone picks up an item lying on the ground - its sole purpose is
+
the animation of the item flying towards the player.
+
+
It doesn't destroy the entity in the client memory ([Destroy Entity][destroy_entity]
+
does that), and it doesn't add it to the player's inventory ([Set Slot][set_slot]
+
does that).
+
+
The server only checks for items to be picked up after each [Player Position][player_position]
+
and [Player Position and Look][player_position_and_look] packet sent by the client.
+
+
| Field Name | Field Type | Example | Notes |
+
| ------------------- | ---------- | ------- | -------------------------- |
+
| Collected Entity ID | i32 | `28` | Collected item's entity ID |
+
| Collector Entity ID | i32 | `30` | Collector's entity ID |
+
+
## 0x17 Spawn Non-Living Entity
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 21 or 27
+
+
Sent when a Non-Living entity is created.
+
+
| Field Name | Field Type | Example | Notes |
+
| ----------- | ---------- | ------- | ---------------------------------------------------------------- |
+
| Entity ID | i32 | `62` | |
+
| Entity Type | i8 | `11` | [See Entity Types][entity_types] (must be of kind `Living`) |
+
| X | i32 | `16080` | [Packed f64][packed_f64] |
+
| Y | i32 | `2290` | [Packed f64][packed_f64] |
+
| Z | i32 | `592` | [Packed f64][packed_f64] |
+
| Has Motion | i32 | `0` | If this flag is bigger than 0 then the following fields are sent |
+
| Motion X | i16 | `0` | [Packed motion-i16][packed_motion_i16] |
+
| Motion Y | i16 | `0` | [Packed motion-i16][packed_motion_i16] |
+
| Motion Z | i16 | `0` | [Packed motion-i16][packed_motion_i16] |
+
+
## 0x18 Spawn Living Entity
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 19 + [Metadata][entity_metadata] (at least 1)
+
+
Sent when a Living Entity is created.
+
+
| Field Name | Field Type | Example | Notes |
+
| ------------------ | ---------------------------------- | ------- | -------------------------------------------------- |
+
| Entity ID | i32 | `62` | |
+
| Living Entity Type | i8 | `11` | See below |
+
| X | i32 | `16080` | [Packed f64][packed_f64] |
+
| Y | i32 | `2290` | [Packed f64][packed_f64] |
+
| Z | i32 | `592` | [Packed f64][packed_f64] |
+
| Yaw | i8 | `-27` | [Packed rotation][packed_rotation] |
+
| Pitch | i8 | `0` | [Packed rotation][packed_rotation] |
+
| Entity Metadata | [Entity Metadata][entity_metadata] | `127` | Indexed metadata, terminated by `0x7F` - see below |
+
+
### Living Entity types
+
+
- `50`: Creeper
+
- Index 16 is `i8`, for `fuse`
+
- `1` for blowing up, `-1` otherwise
+
- Index 17 is `bool`, for `is charged`
+
- `51`: Skeleton
+
- `52`: Spider
+
- `53`: Giant Zombie
+
- `54`: Zombie
+
- `55`: Slime
+
- Index 16 is `i8`, for `size`
+
- `56`: Ghast
+
- Index 16 is `i8`, for `is attacking`
+
- `57`: Zombie Pigman
+
- `90`: Pig
+
- Index 16 is `i8`, for `is saddled`
+
- `91`: Sheep
+
- Index 16 is `i8` for `coat`
+
- You can use a `0x10` bit mask for `shearedness` and `0x0F` for `color` - see below
+
- `92`: Cow
+
- `93`: Chicken
+
- `94`: Squid
+
- `95`: Wolf
+
- Index 16 is `i8`, and is a bitmask:
+
- `0x01` for `is sitting`
+
- `0x02` for `is aggressive`
+
- `0x04` for `is tamed`
+
- Index 17 is `string16`, and is the `name of the player` who tamed the wolf
+
- Index 18 is `i32`, and is the `health` of the wolf
+
+
Metadata index 0 is an `i8` representing a set of 8 `bool`s:
+
+
- `0x01`: On fire
+
- `0x02`: Is crouched
+
- `0x04`: Is riding
+
+
### Sheep colors
+
+
- `0`: White
+
- `1`: Orange
+
- `2`: Magenta
+
- `3`: Light Blue
+
- `4`: Yellow
+
- `5`: Lime
+
- `6`: Pink
+
- `7`: Gray
+
- `8`: Light Gray (Silver)
+
- `9`: Cyan
+
- `10`: Purple
+
- `11`: Blue
+
- `12`: Brown
+
- `13`: Green
+
- `14`: Red
+
- `15`: Black
+
+
## 0x19 Spawn Painting
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 22 + length of strings
+
+
Sent when a painting is created.
+
+
Calculating the center of an image: given a `(width x height)` grid of cells,
+
with `(0, 0)` being the top left corner, the center is `(max(0, width / 2 - 1), height / 2)`.
+
E.g:
+
+
- 2x1 (1, 0)
+
- 4x4 (1, 2)
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ---------- | ---------------------------------------------------- |
+
| Entity ID | i32 | `326` | |
+
| Title | str16 | `Creepers` | Name of the painting. Maximum character length of 13 |
+
| X | i32 | `50` | Center X coordinate |
+
| Y | i32 | `66` | Center Y coordinate |
+
| Z | i32 | `-50` | Center Z coordinate |
+
| Direction | i32 | `0` | Direction the painting is facing, see below |
+
+
### Direction
+
+
- `0`: Negative Z
+
- `1`: Negative X
+
- `2`: Positive Z
+
- `3`: Positive X
+
+
## 0x1C Update Velocity
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 10
+
+
Velocity is believed to be in units of 1/32000 of a block per server tick
+
(200ms); for example, `-1343` would move `(-1343 / 32000) = -0.04196875` blocks
+
per tick (or `-0.20984375 blocks per second`).
+
+
Each axis' velocity is capped between -0.9 and 0.9 blocks per tick (packet
+
values -28800 to 28800).
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ---------------------- |
+
| Entity ID | i32 | `1805` | |
+
| X | i16 | `-1343` | Velocity on the X axis |
+
| Y | i16 | `0` | Velocity on the Y axis |
+
| Z | i16 | `0` | Velocity on the Z axis |
+
+
## 0x1D Destroy Entity
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 4
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ----- |
+
| Entity ID | i32 | `446` | |
+
+
## 0x1E Entity
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 4
+
+
Most entity-related packets are subclasses of this packet. When sent from the
+
server to the client, it may initialize the entry.
+
+
For player entities, either this packet or any move/look packet is sent several
+
times per second. So the meaning of this packet is basically that the entity
+
did not move/look since the last such packet.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ----- |
+
| Entity ID | i32 | `446` | |
+
+
## 0x1F Entity Relative Move
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 7
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ----- |
+
| Entity ID | i32 | `446` | |
+
| Relative X | i8 | `1` | |
+
| Relative Y | i8 | `-7` | |
+
| Relative Z | i8 | `5` | |
+
+
Solid documentation on what these relative coordinates actually are is kind of
+
lacking - apologies. I'll figure it out eventually though.
+
+
## 0x20 Entity Look
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 6
+
+
This packet is sent by the server when an entity rotates.
+
+
Example: `Yaw`=`64` means a 90 degree turn.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ---------------------------------- |
+
| Entity ID | i32 | `459` | |
+
| Yaw | i8 | `64` | [Packed rotation][packed_rotation] |
+
| Pitch | i8 | `0` | [Packed rotation][packed_rotation] |
+
+
## 0x21 Entity Look and Relative Move
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 9
+
+
This packet is sent by the server when an entity rotates and moves.
+
+
Since `i8` range is limited from -128 to 127, this packet allows at most four b
+
locks movement in any direction. (`-128/32 == -4`)
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ------------------------------------ |
+
| Entity ID | i32 | `446` | |
+
| Relative X | i8 | `1` | |
+
| Relative Y | i8 | `-7` | |
+
| Relative Z | i8 | `5` | |
+
| Yaw | i8 | `64` | X axis rotation as a fraction of 360 |
+
| Pitch | i8 | `0` | Y axis rotation as a fraction of 360 |
+
+
## 0x22 Entity Teleport
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 18
+
+
This packet is sent by the server when an entity moves more than 4 blocks.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ---------------------------------- |
+
| Entity ID | i32 | `446` | |
+
| X | i32 | `14162` | [Packed f64][packed_f64] |
+
| Y | i32 | `2176` | [Packed f64][packed_f64] |
+
| Z | i32 | `1111` | [Packed f64][packed_f64] |
+
| Yaw | i8 | `64` | [Packed rotation][packed_rotation] |
+
| Pitch | i8 | `0` | [Packed rotation][packed_rotation] |
+
+
## 0x26 Entity Status
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 5
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | --------- |
+
| Entity ID | i32 | `446` | |
+
| Status | i8 | `2` | See below |
+
+
### Status
+
+
- `2`: (Living Entities only) Attack animation
+
- `3`: (Living Entities only) Death animation
+
- `6`: (Wolf only) Make smoke particles
+
- `7`: (Wolf only) Make hearts particles
+
- `8`: (Wolf only) Shaking
+
+
## 0x27 Ride Entity
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 8
+
+
This packet is sent when a player starts riding an entity.
+
+
| Field Name | Field Type | Example | Notes |
+
| ----------------- | ---------- | ------- | ------------------- |
+
| Player Entity ID | i32 | `446` | Player's entity ID |
+
| Vehicle Entity ID | i32 | `1805` | Vehicle's entity ID |
+
+
## 0x28 Update Entity Metadata
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 4 + [Metadata][entity_metadata] (at least 1)
+
+
| Field Name | Field Type | Example | Notes |
+
| --------------- | ---------------------------------- | ------- | ------------------------------------------------- |
+
| Entity ID | i32 | `446` | Entity ID |
+
| Entity Metadata | [Entity Metadata][entity_metadata] | `127` | Indexed metadata, terminated by `0x7F` - see link |
+
+
## 0x32 Initialize Chunk
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 9
+
+
The client is expected to allocate space for a full chunk (16 x 128 x 16 blocks).
+
+
One or more [Chunk Data][chunk_data] packets will follow, specifying actual data
+
to fill the chunk with.
+
+
Whenever you send this packet the client will clear any previous chunk at that
+
spot if one has previously been sent. Clients don't like being in or next to an
+
unloaded chunk, so try not to unload it if players are nearby. If the player
+
appears to be twitching and stuck in place after joining the world, there is
+
probably an unloaded chunk too close to them.
+
+
| Field Name | Field Type | Example | Notes |
+
| ----------- | ---------- | ------- | ------------------------------------------------------------------------------------- |
+
| X | i32 | `-9` | Chunk coordinate |
+
| Z | i32 | `12` | Chunk coordinate |
+
| Load/Unload | bool | `true` | If `false`, the client unloads the chunk. If `true`, the client initializes the chunk |
+
+
## 0x33 Chunk Data
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 17 + compressed chunk size
+
+
| Field Name | Field Type | Example | Notes |
+
| --------------- | ---------- | ------- | ------------------------------------- |
+
| X | i32 | `128` | Block coordinate |
+
| Y | i16 | `0` | Block coordinate |
+
| Z | i32 | `-192` | Block coordinate |
+
| Size X | i8 | `15` | Size X is Actual X Size -1 |
+
| Size Y | i8 | `127` | Size Y is Actual Y Size -1 |
+
| Size Z | i8 | `15` | Size Z is Actual Z Size -1 |
+
| Compressed size | i32 | `3663` | Size of compressed region data |
+
| Compressed data | Vec\<u8\> | `...` | Compressed region data (zlib deflate) |
+
+
### X,Y,Z
+
+
This is the start position of the region, in world block coordinates.
+
+
To find which chunk is affected, in the same coordinates given by [Initialize Chunk][initialize_chunk]:
+
+
```
+
chunkX = X >> 4
+
chunkY = Y >> 7
+
chunkZ = Z >> 4
+
```
+
+
And conversely, which local block in the chunk to start at:
+
+
```
+
startX = X & 15
+
startY = Y & 127 (not always 0!)
+
startZ = Z & 15
+
```
+
+
### Size X,Y,Z
+
+
This is the size of the region, in blocks. The server will subtract one from
+
the sizes and then cast them to a byte before sending. This is so that chunks
+
as large as 256 are possible.
+
+
### Compressed data
+
+
The data is compressed using the deflate() function in [zlib]. After uncompressing,
+
the data consists of four sequential sections, in order:
+
+
- Block ID array (1 byte per block)
+
- Block metadata array (half byte/nibble per block)
+
- Block Light array (half byte/nibble per block)
+
- Sky Light array (half byte/nibble per block)
+
+
The data is exactly `(sizeX+1) * (sizeY+1) * (sizeZ+1) * 2.5` bytes long.
+
Nibbles are not rounded either direction, which means that at least one
+
dimension of the chunk must be even.
+
+
The arrays are not interlaced.
+
+
In other words, there are `sizeX` number of x planes, each plane made up of
+
`sizeZ` number of z rows, each row made up of `sizeY` blocks indexed by y
+
coordinate in order.
+
+
The Block ID array is indexed with:
+
+
```
+
index = y + (z * (sizeY+1)) + (x * (sizeY+1) * (sizeZ+1))
+
```
+
+
The other arrays are similar but you need to divide the index by two after
+
calculating the above. Then each byte contains data for two blocks. The low
+
four bits contain the first (lower Y) nibble and the high four bits contain the
+
second nibble.
+
+
If you have a FULL map chunk (`sizeX = 15, sizeY = 127, sizeZ = 15`), you can
+
calculate index coordinates:
+
+
```
+
x = X + ( index >> 11 )
+
y = index & 0x7F
+
z = Z + ( (index & 0x780) >> 7 )
+
```
+
+
## 0x34 Multi Block Change
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 10 + arrays
+
+
This is a multiple-block-change command; if you take the three arrays, and put
+
together elements with the same index, and then decompose the `i16` into
+
coordinates (top 4 bits is X, next 4 bits is Z, bottom 8 bits is Y), you get
+
arrays like [((8, 7, 4), 11, 0), ((7, 13, 6), 11, 0), ((13, 1, 8), 11, 0), ((7, 6, 6), 11, 0)].
+
+
| Field Name | Field Type | Example | Notes |
+
| -------------------- | ---------- | ------- | --------------------------------------- |
+
| X | i32 | `-9` | Chunk coordinate |
+
| Z | i32 | `12` | Chunk coordinate |
+
| Array size | i16 | `2` | The total number of elements per array |
+
| Coordinate array | Vec\<i16\> | `...` | The coordinates of the blocks to change |
+
| Block ID array | Vec\<i8\> | `...` | The ID for each block to change |
+
| Block metadata array | Vec\<i8\> | `...` | The metadata for each block changed |
+
+
See [blocks] for information on the metadata variable.
+
+
## 0x35 Block Change
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 11
+
+
| Field Name | Field Type | Example | Notes |
+
| -------------- | ---------- | ------- | -------------------------- |
+
| X | i32 | `128` | Block coordinate |
+
| Y | i8 | `0` | Block coordinate |
+
| Z | i32 | `-192` | Block coordinate |
+
| Block ID | i8 | `78` | The type for the block |
+
| Block metadata | i8 | `0` | The metadata for the block |
+
+
See [blocks] for information on the metadata variable.
+
+
## 0x36 Play Note Block
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 12
+
+
Sent when a note block is played.
+
+
| Field Name | Field Type | Example | Notes |
+
| --------------- | ---------- | ------- | ----------------------------------------------- |
+
| X | i32 | `128` | Block coordinate |
+
| Y | i16 | `0` | Block coordinate |
+
| Z | i32 | `-192` | Block coordinate |
+
| Instrument type | i8 | `3` | See below |
+
| Pitch | i8 | `17` | The pitch of the note (between 0..24 inclusive) |
+
+
### Instrument types
+
+
- `0`: Harp
+
- `1`: Double Bass
+
- `2`: Snare Drum
+
- `3`: Clicks/Sticks (Hihat)
+
- `4`: Bass Drum
+
+
## 0x3C Explosion
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 32 + `3*(coordinate count)`
+
+
Sent when an explosion occurs.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------------- | --------------------- | -------- | ------------------------------ |
+
| X | f64 | `128.0` | Center coordinate |
+
| Y | f64 | `0.0` | Center coordinate |
+
| Z | f64 | `-192.0` | Center coordinate |
+
| Radius | f32 | `4.0` | |
+
| Coordinate count | i32 | `60` | |
+
| Records | (i8, i8, i8) \* count | `...` | XYZ offsets of affected blocks |
+
+
## 0x3D Play Effect
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 17
+
+
Sent when a client is to play an effect.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | -------- | ---------------- |
+
| Effect ID | i32 | `1003` | See below |
+
| X | i32 | `128.0` | Block coordinate |
+
| Y | i8 | `0.0` | Block coordinate |
+
| Z | i32 | `-192.0` | Block coordinate |
+
| Data | i32 | `0` | See below |
+
+
### Effects
+
+
- `1000`: Play sound `random.click` with pitch 1.0
+
- `1001`: Play sound `random.click` with pitch 1.2
+
- `1002`: Play sound `random.bow` with pitch 1.2
+
- `1003`: Play sound randomly between `random.door_open` and `random.door_close` with random uniform pitch between 0.0 and 1.0
+
- `1004`: Play sound `random.fizz` with volume 0.5 and random pitch
+
- `1005`: Play record sound.
+
- The record item ID is given in the effect data.
+
- `2000`: Spawn smoke particles
+
- The radius is given in effect data with two bits for X and Z axis, like this: `0bZZXX`
+
- `2001`: Play and show block break sound and particles.
+
- The block id is given in effect data.
+
+
## 0x46 Notification
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 1
+
+
Sent to notify the client of some state.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | --------- |
+
| Reason | i8 | `1` | See below |
+
+
### Reason
+
+
- `0`: Invalid bed
+
- `1`: Start raining
+
- `2`: Stop raining
+
+
## 0x47 Lightning
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 17
+
+
Notifies the client of thunderbolts striking somewhere. The coordinates specify
+
where exactly the thunderbolt strikes.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------- | ------------------------ |
+
| Entity ID | i32 | `4` | Lightning bolt entity ID |
+
| ??? | bool | `true` | Always `true` |
+
| X | i32 | `133` | [Packed f64][packed_f64] |
+
| Y | i32 | `913` | [Packed f64][packed_f64] |
+
| Z | i32 | `63552` | [Packed f64][packed_f64] |
+
+
## 0x64 Open Inventory
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 5 + length of strings
+
+
| Field Name | Field Type | Example | Notes |
+
| --------------- | ---------- | ------- | -------------------- |
+
| Inventory ID | i8 | `123` | |
+
| Inventory Type | i8 | `0` | See below |
+
| Title | str8 | `Chest` | Only used for chests |
+
| Number of slots | i8 | `3` | |
+
+
### Inventory Type
+
+
- `0`: Chest
+
- `1`: Crafting table
+
- `2`: Furnace
+
- `3`: Dispenser
+
+
## 0x65 Close Inventory
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 1
+
+
Clients send this packet with Inventory ID `0` when they close their inventory.
+
+
| Field Name | Field Type | Example | Notes |
+
| ------------ | ---------- | ------- | ------------------------ |
+
| Inventory ID | i8 | `123` | 0 for player's inventory |
+
+
## 0x66 Click Inventory
+
+
- Clientbound: [ ]
+
- Serverbound: [x]
+
- Size: 9 or 12
+
+
Sent when the playuer clicks on a slot in an inventory.
+
+
| Field Name | Field Type | Example | Notes |
+
| -------------- | ---------- | ------- | ----------------------------------------------------------------------------------------------------- |
+
| Inventory ID | i8 | `123` | 0 for player's inventory |
+
| Cicked Slot | i16 | `36` | |
+
| Right clicking | bool | `true` | `true` if right cicking, `false` otherwise |
+
| Action number | `i16` | `12` | Unique number for the action, used for [transaction handling][transaction] |
+
| Shift | bool | `fase` | `true` if the player was holding shift, `false` otherwise |
+
| 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. |
+
| Item Count | `i8` | `64` | |
+
| Item Data | `i16` | `10` | |
+
+
When right-clicking on a stack of items, half the stack will be picked up and
+
half left in the slot. If the stack is an odd number, the half left in the slot
+
will be smaller of the amounts.
+
+
The Action number is actually a counter, starting at `1`. This number is used by
+
the server as a transaction ID to send back a [transaction] packet.
+
+
For help with slot IDs, see the next packet.
+
+
## 0x67 Set Inventory Slot
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 5 or 8
+
+
Sent by the server when an item in a slot is added/removed.
+
+
| Field Name | Field Type | Example | Notes |
+
| ------------ | ---------- | ------- | ---------------------------------------------------------------- |
+
| Inventory ID | i8 | `123` | 0 for player's inventory |
+
| Slot | i16 | `36` | |
+
| Item ID | `i16` | `3` | `-1` for no item. If `-1`, this is the last field in the packet. |
+
| Item Count | `i8` | `64` | |
+
| Item Data | `i16` | `10` | |
+
+
Note that if window ID and slot are both `-1`, it means the item currently attached to the cursor.
+
+
### Slot
+
+
![Minecraft inventory with slot IDs crudely labelled](.assets/slots.png)
+
+
## 0x68 Set Inventory Slots
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 3 + size of payload
+
+
Sent by the server when items in slots are added/removed. This includes the
+
player inventory, equipped armor, and crafting slots.
+
+
| Field Name | Field Type | Example | Notes |
+
| ------------- | ---------- | ------- | ------------------------ |
+
| Inventory ID | i8 | `123` | 0 for player's inventory |
+
| Payload count | i16 | `4` | See below |
+
| Payload | ... | | See below |
+
+
This packet is a bit trickier to parse than most others because the size of its
+
payload is variable. The payload is an array of shorts (item ID) optionally
+
followed by a byte-short pair (count and data) as long as the item ID does not
+
equal `-1`, which signifies an empty slot.
+
+
```python
+
offset = 0
+
+
for slot in count:
+
item_id = payload[offset] as short
+
offset += 2
+
if item_id is not equal to -1:
+
count = payload[offset] as byte
+
offset += 1
+
uses = payload[offset] as short
+
offset += 2
+
inventory[slot] = new item(item_id, count, uses)
+
else:
+
inventory[slot] = None
+
```
+
+
## 0x69 Update Progress Bar
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 5
+
+
| Field Name | Field Type | Example | Notes |
+
| ------------ | ---------- | ------- | ------------------------ |
+
| Inventory ID | i8 | `123` | 0 for player's inventory |
+
| Progress Bar | i16 | `1` | See below |
+
| Value | i16 | 650 | See below |
+
+
### Furnace
+
+
#### Progress bar
+
+
- `0`: Arrow
+
- `1`: Fire
+
- `2`: Current Item Burn Time
+
- time in ticks that the fuel item takes to burn
+
+
#### Value
+
+
- `0`: Empty
+
- Full progress arrow: approx. `180`
+
- Full fire icon: approx. `250`
+
+
## 0x6A Transaction
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 4
+
+
A packet from the server indicating whether a request from the client was
+
accepted, or whether there was a conflict (due to lag). This packet is also
+
sent from the client to the server in response to a server transaction rejection
+
packet.
+
+
| Field Name | Field Type | Example | Notes |
+
| ------------- | ---------- | ------- | ------------------------ |
+
| Inventory ID | i8 | `123` | 0 for player's inventory |
+
| Action Number | i16 | `12` | |
+
| Accepted | bool | `true` | |
+
+
## 0x82 Update Sign
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 10 + length of strings
+
+
This message is sent from the server to the client whenever a sign comes into
+
view distance or created. This message is sent from the client to the server when the "Done"
+
button is pressed after placing a sign.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | ------------- | ----- |
+
| X | i32 | `123` | |
+
| Y | i16 | `0` | |
+
| Z | i32 | `-128` | |
+
| Text1 | str16 | `First line` | |
+
| Text2 | str16 | `Second line` | |
+
| Text3 | str16 | `Third line` | |
+
| Text4 | str16 | `Fourth line` | |
+
+
## 0x83 Map Data
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 5 + length of payload
+
+
Sends map updates (columns of pixels or decorations).
+
+
It allows the server to stream partial changes to a map rather than the entire
+
128x128 bitmap.
+
+
| Field Name | Field Type | Example | Notes |
+
| -------------- | ---------- | ------- | --------- |
+
| Item ID | i16 | `358` | |
+
| Item Data | i16 | `0` | |
+
| Payload length | u8 | `35` | |
+
| Payload | Vec\<i8\> | `...` | See below |
+
+
### Payload formats
+
+
The first byte of the payload is a _tag_ indicating the type of update:
+
+
#### Tag `0` (Column update)
+
+
- `u8 x_start`: X coordinate (0..127) of the column.
+
- `u8 y_start`: Y coordinate (0..127) of the starting pixel.
+
- `Vec<u8> colors`: Palette indices (one per pixel) written _downwards_ starting at `(x_start, y_start)`.
+
+
Each color is a raw color (0–255), not a limited palette enum. The raw value is
+
`base_id * 4 + shade`, where:
+
+
- `base_id` is one of the 14 map palette entries.
+
- `shade` is 0..3 for brightness variation.
+
+
#### Tag `1` (Decorations)
+
+
Sequence of entries, each 3 bytes:
+
+
- `u8 data`: Upper 4 bits = direction (0..15), lower 4 bits = type (always 0).
+
- `u8 x`: X coordinate of the decoration on the map (0..127).
+
- `u8 y`: Y coordinate of the decoration on the map (0..127).
+
+
Decorations are only used to show the player cursors on the map in Beta 1.7.
+
+
## 0xC8 Increment Statistic
+
+
- Clientbound: [x]
+
- Serverbound: [ ]
+
- Size: 5
+
+
| Field Name | Field Type | Example | Notes |
+
| ------------ | ---------- | ------- | --------------------- |
+
| Statistic ID | i32 | `1003` | See below |
+
| Amount | i8 | `1` | Negative to decrement |
+
+
### Statistic ID
+
+
- TODO :-( - but you can [try this forum post][statistics]?
+
+
## 0xFF Disconnect
+
+
- Clientbound: [x]
+
- Serverbound: [x]
+
- Size: 2 + length of strings
+
+
Sent by the server before it disconnects a client, or by the client before it
+
disconnects from the server. The receiver of this packet assumes that the
+
sender has already closed the connection by the time the packet arrives.
+
+
| Field Name | Field Type | Example | Notes |
+
| ---------- | ---------- | --------------------- | ----- |
+
| Reason | str16 | `The server is full!` | |
+
+
[blocks]: blocks.md
+
[entity_metadata]: #entity-metadata
+
[packed_f64]: #floored-double
+
[packed_rotation]: #packed-rotation
+
[packed_motion_i8]: #packed-motion-i8
+
[packed_motion_i16]: #packed-motion-i16
+
[entity_types]: #entity-types
+
[player_position]: #0x0b-player-position
+
[player_look]: #0x0c-player-look
+
[player_position_and_look]: #0x0d-player-position-and-look
+
[block_dig]: #0x0e-block-dig
+
[spawn_player]: #0x14-spawn-player
+
[spawn_living_entity]: #0x18-spawn-living-entity
+
[destroy_entity]: #0x1d-destroy-entity
+
[initialize_chunk]: #0x32-initialize-chunk
+
[chunk_data]: #0x33-chunk-data
+
[set_slot]: #0x67-set-slot
+
[transaction]: #0x6a-transaction
+
[disconnect]: #0xff-disconnect
+
[statistics]: http://www.minecraftforum.net/viewtopic.php?f=1020&t=295360
+
[zlib]: http://www.zlib.net/
+
[java8spec_floating]: https://docs.oracle.com/javase/specs/jls/se9/html/jls-4.html#jls-4.2.3
+
[utf16]: https://en.wikipedia.org/wiki/UTF-16
+
[mutf8]: https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html#modified-utf-8