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
0x01ID_UNCONNECTED_PING_OPEN_CONNECTIONS - S->C
0x1CID_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
0x05OPEN_CONNECTION_REQUEST_1 - S->C
0x06OPEN_CONNECTION_REPLY_1 - C->S
0x07OPEN_CONNECTION_REQUEST_2 - S->C
0x08OPEN_CONNECTION_REPLY_2 - C->S
0x09CLIENT_CONNECT - S->C
0x10SERVER_HANDSHAKE - C->S
0x13CLIENT_HANDSHAKE
Then you may start pinging the client and get ready for login, once you have finished the RakNet handshake:
- C->S
0x8fGAME_LOGIN - S->C
0x90PLAYER_STATUS of 0 - S->C
0x9dMOVE_PLAYER (note: entity id of -1) - S->C
0x95START_GAME (note: entity id of -1) - S->C
0xb1SET_SPAWN_POSITION - S->C
0x9dMOVE_PLAYER (note: entity id of -1) - S->C
0x94SET_TIME - S->C
0xbcADVENTURE_SETTINGS - S->C
0xb3RESPAWN - C->S
0xc8REQUEST_CHUNK_RADIUS - S->C
0xc9CHUNK_RADIUS_UPDATE (optional) - S->C
0xbfFULL_CHUNK_DATA (batch packet) - S->C
0x90PLAYER_STATUS of 3 - S->C
0x94SET_TIME