ServerboundCookieResponsePacket 0x01

ServerboundCookieResponsePacket: Minecraft 26.3 packet (0x01 Configuration serverbound, 0x15 Play serverbound, 0x04 Login serverbound).

Minecraft 26.3ConfigurationServerboundnet.minecraft.network.protocol.cookie

Protocol slots (3)

IDdecStateDirectionRegistry
0x011CONFIGURATIONServerboundCookiePacketTypes.SERVERBOUND_COOKIE_RESPONSE: "cookie_response"
0x1521PLAYServerboundCookiePacketTypes.SERVERBOUND_COOKIE_RESPONSE: "cookie_response"
0x044LOGINServerboundCookiePacketTypes.SERVERBOUND_COOKIE_RESPONSE: "cookie_response"

Packet ids are positional: the id is the index of the addPacket call in the protocol builder (see ProtocolInfoBuilder.listPackets). Ids change between game versions.

Wire fields (2)

FieldType
keyIdentifier
payloadbyte @Nullable []

Fields are the components of the packet record.

Stream codec

static final StreamCodec<FriendlyByteBuf, ServerboundCookieResponsePacket> STREAM_CODEC = Packet.codec( ServerboundCookieResponsePacket::write, ServerboundCookieResponsePacket::new );

Modern packets serialize through StreamCodecs instead of read/write methods.

Handling

Resolved on the ServerCookiePacketListener packet-listener interface by void handleCookieResponse(ServerboundCookieResponsePacket serverboundcookieresponsepacket). The implementation in the game is ServerCommonPacketListenerImpl.

Full Source

ServerboundCookieResponsePacket.java34 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.cookie;
2
3
import net.minecraft.network.FriendlyByteBuf;
4
import net.minecraft.network.codec.StreamCodec;
5
import net.minecraft.network.protocol.Packet;
6
import net.minecraft.network.protocol.PacketType;
7
import net.minecraft.network.protocol.common.ClientboundStoreCookiePacket;
8
import net.minecraft.resources.Identifier;
9
import org.jspecify.annotations.Nullable;
10
11
public record ServerboundCookieResponsePacket(Identifier key, byte @Nullable [] payload) implements Packet<ServerCookiePacketListener> {
12
	public static final StreamCodec<FriendlyByteBuf, ServerboundCookieResponsePacket> STREAM_CODEC = Packet.codec(
13
		ServerboundCookieResponsePacket::write, ServerboundCookieResponsePacket::new
14
	);
15
16
	private ServerboundCookieResponsePacket(final FriendlyByteBuf input) {
17
		this(input.readIdentifier(), input.readNullable(ClientboundStoreCookiePacket.PAYLOAD_STREAM_CODEC));
18
	}
19
20
	private void write(final FriendlyByteBuf output) {
21
		output.writeIdentifier(this.key);
22
		output.writeNullable(this.payload, ClientboundStoreCookiePacket.PAYLOAD_STREAM_CODEC);
23
	}
24
25
	@Override
26
	public PacketType<ServerboundCookieResponsePacket> type() {
27
		return CookiePacketTypes.SERVERBOUND_COOKIE_RESPONSE;
28
	}
29
30
	public void handle(final ServerCookiePacketListener listener) {
31
		listener.handleCookieResponse(this);
32
	}
33
}
34