Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Bedrock Edition protocol: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
Tag: Replaced
SyncBot (talk | contribs)
Sync: updated from Minecraft
Line 142: Line 142:
  | 15
  | 15
  | Vector3 and three byte angles
  | Vector3 and three byte angles
  | Legacy compact position/rotation form. Convert each rotation byte to degrees with <code>value * 360 / 256</code>; rotation order is specified by the packet.
  | Legacy compact position/rotation form. Convert each rotation byte to degrees with {{cd|value * 360 / 256}}; rotation order is specified by the packet.
  |-
  |-
  ! UUID
  ! UUID
Line 166: Line 166:
|}
|}


Compression is configured through [[Minecraft:Bedrock_Edition_protocol/Packets#Network Settings|Network Settings]]. When compression framing is enabled, a one-byte algorithm identifier precedes the batch data: <code>0x00</code> for raw DEFLATE, <code>0x01</code> for Snappy, or <code>0xFF</code> for an uncompressed batch. Raw DEFLATE has no [https://zlib.net/ 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>[https://github.com/Sandertv/gophertunnel/blob/master/minecraft/protocol/packet/compression.go gophertunnel: Compression implementations]</ref>
Compression is configured through [[Minecraft:Bedrock_Edition_protocol/Packets#Network Settings|Network Settings]]. When compression framing is enabled, a one-byte algorithm identifier precedes the batch data: {{cd|0x00}} for raw DEFLATE, {{cd|0x01}} for [[Minecraft:wikipedia:Snappy_(compression)|Snappy]], or {{cd|0xFF}} for an uncompressed batch. Raw DEFLATE has no [https://zlib.net/ 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>[https://github.com/Sandertv/gophertunnel/blob/master/minecraft/protocol/packet/compression.go gophertunnel: Compression implementations]</ref>


With [[Minecraft:RakNet]], the batch begins with <code>0xFE</code>. 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>[https://github.com/Sandertv/gophertunnel/blob/master/minecraft/protocol/packet/decoder.go gophertunnel: Batch decoder]</ref><ref>[https://github.com/Sandertv/gophertunnel/blob/master/minecraft/protocol/packet/encryption.go gophertunnel: Application encryption]</ref>
With [[Minecraft:RakNet]], the batch begins with {{cd|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>[https://github.com/Sandertv/gophertunnel/blob/master/minecraft/protocol/packet/decoder.go gophertunnel: Batch decoder]</ref><ref>[https://github.com/Sandertv/gophertunnel/blob/master/minecraft/protocol/packet/encryption.go gophertunnel: Application encryption]</ref>


[[Minecraft:NetherNet]] carries batches over [[Minecraft:wikipedia:WebRTC|WebRTC]] data channels. The WebRTC connection uses [[Minecraft:wikipedia:Datagram_Transport_Layer_Security|DTLS]] for transport security.<ref name="nethernet-guide">[https://mojang.github.io/bedrock-protocol-docs/guides/nether-net-onboarding-guide/ Mojang: NetherNet onboarding guide]</ref> Unlike RakNet, NetherNet does not use the <code>0xFE</code> batch marker or RakNet's application-layer encryption step.<ref>[https://pkg.go.dev/github.com/df-mc/go-nethernet%40v1.0.24#Conn.BatchHeader go-nethernet: Conn]</ref>
[[Minecraft:NetherNet]] carries batches over [[Minecraft:wikipedia:WebRTC|WebRTC]] data channels. The WebRTC connection uses [[Minecraft:wikipedia:Datagram_Transport_Layer_Security|DTLS]] for transport security.<ref name="nethernet-guide">[https://mojang.github.io/bedrock-protocol-docs/guides/nether-net-onboarding-guide/ Mojang: NetherNet onboarding guide]</ref> Unlike RakNet, NetherNet does not use the <code>0xFE</code> batch marker or RakNet's application-layer encryption step.<ref>[https://pkg.go.dev/github.com/df-mc/go-nethernet%40v1.0.24#Conn.BatchHeader go-nethernet: Conn]</ref>

Revision as of 11:04, 4 October 2026

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 Template:Cd; 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: Template:Cd for raw DEFLATE, Template:Cd for Snappy, or Template:Cd 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 Template:Cd. 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" />

References

Template:Reflist

External documentation and implementations

Navigation

Template:Navbox Bedrock Edition