Skip to main content
Version: Next

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.

FieldDisplay NameTypeNotes
reasonDisconnection ReasonComponentThis field contains the reason for the disconnection, formatted as a JSON string. It is serialized and deserialized using the Component.Serializer class.
STREAM_CODECStream CodecStreamCodec<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.

FieldDisplay NameTypeNotes
serverIdServer IdentifierUtfA 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.
publicKeyServer Public KeyByteArrayThe server's public key, used for encrypting data sent to the server. It is read and written as a byte array.
challengeAuthentication ChallengeByteArrayA random byte array used as a challenge in the authentication process. It is read and written as a byte array.
shouldAuthenticateAuthentication Requirement FlagBooleanA 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.

FieldDisplay NameTypeNotes
gameProfileGame Profilecom.mojang.authlib.GameProfileThis 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.

FieldDisplay NameTypeNotes
compressionThresholdCompression ThresholdVarIntThis 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.

FieldDisplay NameTypeNotes
transactionIdTransaction IDVarIntA unique identifier for the transaction, used to match responses to requests.
payloadCustom Query PayloadCustomQueryPayloadThe payload of the query, which contains the data the server wants to send to the client.
STREAM_CODECStream CodecStreamCodec<FriendlyByteBuf ClientboundCustomQueryPacket>A codec for encoding and decoding the packet data.
MAX_PAYLOAD_SIZEMaximum Payload SizeintThe maximum allowed size for the payload, set to 1048576 bytes.

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.

FieldDisplay NameTypeNotes
keyResource Location KeyResourceLocationThis 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.

FieldDisplay NameTypeNotes
namePlayer NameUtfThe player's name is read from the buffer with a maximum length of 16 characters.
profileIdPlayer UUIDUUIDThe 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.

FieldDisplay NameTypeNotes
keybytesEncrypted Secret Key Bytesbyte[]This field contains the secret key encrypted using the server's public key. It is used to establish a secure communication channel.
encryptedChallengeEncrypted Challenge Bytesbyte[]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.

FieldDisplay NameTypeNotes
transactionIdTransaction IDVarIntThis field represents the unique identifier for the transaction, allowing the server to match the response with the original query.
payloadPayloadCustomQueryAnswerPayloadThis 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.

FieldDisplay NameTypeNotes
INSTANCESingleton InstanceServerboundLoginAcknowledgedPacketA singleton instance of the packet, used to avoid creating multiple instances.
STREAM_CODECStream CodecStreamCodec<ByteBuf ServerboundLoginAcknowledgedPacket>A codec for encoding and decoding the packet, using a unit codec for the singleton instance.

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.

FieldDisplay NameTypeNotes
keyCookie KeyResourceLocationThis field represents the unique identifier for the cookie. It is read from the buffer using the readResourceLocation method and written using the writeResourceLocation method.
payloadCookie Payloadbyte[]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.