Pocket Edition Login
From wiki.vg
This article describes the 0.14.3 login sequence in Minecraft: PE
The recommended login sequence and ping sequence looks like this, where C is the client and S is the server:
Pinging
- C->S
0x01
ID_UNCONNECTED_PING_OPEN_CONNECTIONS - S->C
0x1C
ID_UNCONNECTED_PONG
Note that the servername field in the ID_UNCONNECTED_PONG follows a specific format for MCPE as described below:
Field Name | Field Value | Notes |
---|---|---|
Prefix | MCPE | |
Server Name | The MOTD of your server | Can also include any MCPE colors |
Protocol Number | Represented as ‘10 10’ if 10 was the current number | Must be the minor major separated by a space |
The Text Version | A string that is shown to the player, must be MAJOR.MINOR.PATCH | The protocol number affects if the client rejects the connection or not, this can have any value |
Online Players | A number of online players | |
Max Players | A number of max players |
Each value is separated by a colon.
An example is: MCPE;A Minecraft: PE Server;70 70;0.14.3;0;20
Connecting
Firstly, you’ll need the RakNet handshake:
- C->S
0x05
OPEN_CONNECTION_REQUEST_1 - S->C
0x06
OPEN_CONNECTION_REPLY_1 - C->S
0x07
OPEN_CONNECTION_REQUEST_2 - S->C
0x08
OPEN_CONNECTION_REPLY_2 - C->S
0x09
CLIENT_CONNECT - S->C
0x10
SERVER_HANDSHAKE - C->S
0x13
CLIENT_HANDSHAKE
Then you may start pinging the client and get ready for login, once you have finished the RakNet handshake:
- C->S
0x8f
GAME_LOGIN - S->C
0x90
PLAYER_STATUS of 0 - S->C
0x9d
MOVE_PLAYER (note: entity id of -1) - S->C
0x95
START_GAME (note: entity id of -1) - S->C
0xb1
SET_SPAWN_POSITION - S->C
0x9d
MOVE_PLAYER (note: entity id of -1) - S->C
0x94
SET_TIME - S->C
0xbc
ADVENTURE_SETTINGS - S->C
0xb3
RESPAWN - C->S
0xc8
REQUEST_CHUNK_RADIUS - S->C
0xc9
CHUNK_RADIUS_UPDATE (optional) - S->C
0xbf
FULL_CHUNK_DATA (batch packet) - S->C
0x90
PLAYER_STATUS of 3 - S->C
0x94
SET_TIME