Skip to content

Encapsulation Protocol

Shevchik edited this page Aug 25, 2020 · 6 revisions

Type definition

byte - normal java byte
boolean - encoded as byte (1 - true, 0 - false)
varint - mojang style vlq - http://wiki.vg/Protocol#VarInt_and_VarLong
vbytearray - byte array prefixed with length encoded as varint

Handshake

Before sending any actual game packets the client should send data of this format:

  • Always zero - byte
  • Encapsulation protocol version - varint (current version id is 1)
  • Has address data - boolean
  • Address - vbytearray (only present if Has address data is true)
  • Port - varint (only present if Has address data is true)
  • Has compression - boolean

Pipeline

Decode:

Frame decoder -> Decompressor -> User pipeline (Packet decoder, Packet handler, etc)
Frame decoder: same as current mojang one http://wiki.vg/Protocol#Without_compression
Decompressor: only present if Has compression is true, same as current mojang one http://wiki.vg/Protocol#With_compression but compression threshold is not synched, both client and server should not check it

Encode:

Frame encoder <- Compressor <- User pipeline (Packet encoder, etc)
Frame encoder: same as current mojang one http://wiki.vg/Protocol#Without_compression
Compressor: only present if Has compression is true, same as current mojang one http://wiki.vg/Protocol#With_compression but compression threshold is not synched, so both client and server may decide to compress any number of bytes

Clone this wiki locally