Login
Clientbound (Client → Server)
0x00 Clientbound Login Disconnect Packet
This packet is sent from the server to the client to indicate that the client has been disconnected during the login process. The packet includes a reason for the disconnection, which is displayed to the user.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| reason | Disconnection Reason | Component | This field contains the reason for the disconnection, formatted as a JSON string. It is serialized and deserialized using the Component.Serializer class. |
| STREAM_CODEC | Stream Codec | StreamCodec<FriendlyByteBuf ClientboundLoginDisconnectPacket> | This static field defines the codec used for encoding and decoding the packet. It uses the write method for encoding and the constructor for decoding. |
0x01 Server Hello Packet
This packet is sent from the server to the client during the login process. It contains information necessary for the client to authenticate with the server.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| serverId | Server Identifier | Utf | A unique identifier for the server, used during the authentication process. It is read and written as a UTF-8 string with a maximum length of 20 characters. |
| publicKey | Server Public Key | ByteArray | The server's public key, used for encrypting data sent to the server. It is read and written as a byte array. |
| challenge | Authentication Challenge | ByteArray | A random byte array used as a challenge in the authentication process. It is read and written as a byte array. |
| shouldAuthenticate | Authentication Requirement Flag | Boolean | A boolean flag indicating whether the client should authenticate with the server. It is read and written as a boolean value. |
0x02 Clientbound Login Finished Packet
This packet is sent from the server to the client to indicate that the login process has been successfully completed. It contains the game profile of the player who has logged in.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| gameProfile | Game Profile | com.mojang.authlib.GameProfile | This field contains the game profile of the player, which includes information such as the player's UUID and username. |
0x03 Compression Threshold Packet
This packet is sent from the server to the client during the login phase to specify the compression threshold for network packets. If the packet size exceeds this threshold, the packet will be compressed.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| compressionThreshold | Compression Threshold | VarInt | This field specifies the threshold size in bytes. If a packet's size exceeds this value, it will be compressed. It is read from the buffer using readVarInt and written using writeVarInt. |
0x04 Clientbound Custom Query Packet
This packet is used during the login phase to send a custom query from the server to the client. It includes a transaction ID and a payload that the client must respond to.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| transactionId | Transaction ID | VarInt | A unique identifier for the transaction, used to match responses to requests. |
| payload | Custom Query Payload | CustomQueryPayload | The payload of the query, which contains the data the server wants to send to the client. |
| STREAM_CODEC | Stream Codec | StreamCodec<FriendlyByteBuf ClientboundCustomQueryPacket> | A codec for encoding and decoding the packet data. |
| MAX_PAYLOAD_SIZE | Maximum Payload Size | int | The maximum allowed size for the payload, set to 1048576 bytes. |
0x05 Clientbound Cookie Request Packet
This packet is used to request a cookie from the client. It is part of the client-server communication protocol in Minecraft, specifically for handling cookie-related operations.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| key | Resource Location Key | ResourceLocation | This field represents the unique identifier for the cookie being requested. It is read from the buffer when the packet is constructed and written to the buffer when the packet is sent. |
Serverbound (Server → Client)
0x00 Serverbound Hello Packet
This packet is sent by the client to the server during the login process. It contains the player's name and UUID, which are used to identify the player on the server.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| name | Player Name | Utf | The player's name is read from the buffer with a maximum length of 16 characters. |
| profileId | Player UUID | UUID | The player's unique identifier, which is read from the buffer as a UUID. |
0x01 Serverbound Key Packet
This packet is used during the login process to securely exchange a secret key and a challenge response between the client and server. It ensures that the communication is encrypted and authenticated.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| keybytes | Encrypted Secret Key Bytes | byte[] | This field contains the secret key encrypted using the server's public key. It is used to establish a secure communication channel. |
| encryptedChallenge | Encrypted Challenge Bytes | byte[] | This field contains the challenge response encrypted using the server's public key. It is used to verify the authenticity of the client. |
0x02 Serverbound Custom Query Answer Packet
This packet is used to send a response to a custom query from the server during the login phase. It includes a transaction ID and an optional payload.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| transactionId | Transaction ID | VarInt | This field represents the unique identifier for the transaction, allowing the server to match the response with the original query. |
| payload | Payload | CustomQueryAnswerPayload | This is an optional field that contains the response data for the custom query. It can be null if there is no data to send. |
0x03 Login Acknowledgement Packet
This packet is sent by the client to acknowledge the server's login process. It indicates that the client has received and processed the server's login response.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| INSTANCE | Singleton Instance | ServerboundLoginAcknowledgedPacket | A singleton instance of the packet, used to avoid creating multiple instances. |
| STREAM_CODEC | Stream Codec | StreamCodec<ByteBuf ServerboundLoginAcknowledgedPacket> | A codec for encoding and decoding the packet, using a unit codec for the singleton instance. |
0x04 Serverbound Cookie Response Packet
This packet is used to send a response from the client to the server regarding a cookie operation. It includes a key identifying the cookie and an optional payload containing additional data.
| Field | Display Name | Type | Notes |
|---|---|---|---|
| key | Cookie Key | ResourceLocation | This field represents the unique identifier for the cookie. It is read from the buffer using the readResourceLocation method and written using the writeResourceLocation method. |
| payload | Cookie Payload | byte[] | This is an optional field that contains additional data related to the cookie. It is read and written using the readNullable and writeNullable methods, respectively, with the ClientboundStoreCookiePacket.PAYLOAD_STREAM_CODEC as the codec. |