Minecraft:Bedrock Edition protocol
More actions
Template:For Template:Exclusive
This article documents the Template:BE protocol. Individual packets, their data types, and the login sequence are documented on the Packets, Data types, and Login sequence pages.
Bedrock Edition uses Minecraft:NetherNet, a WebRTC-based transport, alongside the legacy Minecraft:RakNet transport. NetherNet became the default transport for dedicated servers in Minecraft:26.50. RakNet is deprecated in the Minecraft:26.60.22 Preview.Template:Upcoming
The default Bedrock Edition port is 19132.
Information for this page was obtained from the CloudburstMC Protocol library, and gophertunnel.
For more complete documentation, consider visiting the Official Docs.
Primitives
VarInt and VarLong below refer to unsigned encodings; SignedVarInt and SignedVarLong use ZigZag encoding.<ref>Mojang: Protocol primitives</ref> Composite encodings are illustrated by gophertunnel's protocol reader.<ref>gophertunnel: Protocol reader</ref>
| Type | Size (Bytes) | Range | Notes |
|---|---|---|---|
| Byte | 1 | 0 to 255 | Unsigned 8-bit integer. |
| Signed Byte | 1 | -128 to 127 | Signed 8-bit integer. |
| Boolean | 1 | 0 or 1 | 0 is false; 1 is true. Nonzero values are read as true. |
| Short | 2 | -32768 to 32767 | Signed 16-bit little-endian integer. |
| Unsigned Short | 2 | 0 to 65535 | Unsigned 16-bit little-endian integer. |
| Int | 4 | -2147483648 to 2147483647 | Signed little-endian 32-bit Integer |
| Int (big endian) | 4 | -2147483648 to 2147483647 | Signed 32-bit big-endian integer. |
| Unsigned Int | 4 | 0 to 4294967295 | Unsigned 32-bit little-endian integer. |
| Long | 8 | -263 to 263 - 1 | Signed 64-bit little-endian integer. |
| Unsigned Long | 8 | 0 to 264 - 1 | Unsigned 64-bit little-endian integer. |
| Float | 4 | IEEE 754 binary32 | Little-endian 32-bit floating-point number. |
| Double | 8 | IEEE 754 binary64 | Little-endian 64-bit floating-point number. |
| VarInt | 1-5 | 0 to 4294967295 | Unsigned variable-length integer (varuint32). Each byte carries 7 value bits; the high bit indicates continuation. |
| SignedVarInt | 1-5 | -2147483648 to 2147483647 | Signed variable-length integer (varint32), using ZigZag encoding. |
| VarLong | 1-10 | 0 to 264 - 1 | Unsigned variable-length integer (varuint64), using the same 7-bit groups as VarInt. |
| SignedVarLong | 1-10 | -263 to 263 - 1 | Signed variable-length integer (varint64), using ZigZag encoding. |
| String | Variable | - | UTF-8 bytes prefixed by their byte count as a VarInt, not their character count. |
| Vector3 | 12 | Three Float values | X, Y and Z, in that order. |
| Vector2 | 8 | Two Float values | Two consecutive Float values; their meaning depends on the field. |
| NBT | Variable | - | Named Binary Tag data. The field determines the NBT encoding and framing; network and little-endian forms must not be treated as interchangeable. |
| ByteArray | Variable | - | Raw bytes prefixed by their byte count as a VarInt. |
| BlockCoordinates | 3-15 | X/Z: signed 32-bit; Y: unsigned 32-bit | Legacy unsigned-Y form: SignedVarInt X, VarInt Y, SignedVarInt Z. Use only where the packet specifies this form. |
| BlockPos | 3-15 | Each coordinate: signed 32-bit | SignedVarInt X, SignedVarInt Y, SignedVarInt Z. |
| PlayerLocation | 15 | Vector3 and three byte angles | Legacy compact position/rotation form. Convert each rotation byte to degrees with value * 360 / 256; rotation order is specified by the packet.
|
| UUID | 16 | 128-bit identifier | Two little-endian 64-bit halves: most significant half first, then least significant half. This reverses bytes within each half relative to the standard UUID byte representation. |
Packet Format
Minecraft:Bedrock Edition game packets are grouped into batches. In an uncompressed batch, each packet is prefixed by its byte length as a VarInt, followed by its packet header and payload. The length includes the packet header, but not the length prefix. A batch can contain one or more packets.<ref name="batch-encoder">gophertunnel: Batch encoder</ref>
The packet header is an unsigned VarInt containing the packet ID and the sender and target sub-client IDs, which are used for split-screen players.<ref>gophertunnel: Packet header</ref>
| Bits | Field | Range |
|---|---|---|
| 0-9 | Packet ID | 0-1023 |
| 10-11 | Sender sub-client ID | 0-3 |
| 12-13 | Target sub-client ID | 0-3 |
Compression is configured through Network Settings. When compression framing is enabled, a one-byte algorithm identifier precedes the batch data: 0x00 for raw DEFLATE, 0x01 for Snappy, or 0xFF for an uncompressed batch. Raw DEFLATE has no zlib header or trailer. Batches smaller than the configured threshold are sent uncompressed. Before compression framing is enabled, the algorithm identifier is absent.<ref name="batch-encoder" /><ref>gophertunnel: Compression implementations</ref>
With Minecraft:RakNet, the batch begins with 0xFE. If application-layer encryption is enabled, the data after this byte is encrypted after compression. This includes the compression identifier, when present, and an appended eight-byte checksum. The receiver decrypts and verifies the data, decompresses it if needed, and then reads the length-prefixed packets.<ref>gophertunnel: Batch decoder</ref><ref>gophertunnel: Application encryption</ref>
Minecraft:NetherNet carries batches over WebRTC data channels. The WebRTC connection uses DTLS for transport security.<ref name="nethernet-guide">Mojang: NetherNet onboarding guide</ref> Unlike RakNet, NetherNet does not use the 0xFE batch marker or RakNet's application-layer encryption step.<ref>go-nethernet: Conn</ref>
Each Minecraft:NetherNet data-channel message begins with a one-byte fragment header. A value of zero marks a complete message or the final fragment; a positive value gives the number of fragments remaining. Only the reliable channel supports fragmentation. Remove the header and reassemble fragmented messages before decoding the batch.<ref name="nethernet-guide" />