ServerboundChatSessionUpdatePacket 0x0A

ServerboundChatSessionUpdatePacket: Minecraft 26.3 packet (0x0A Play serverbound). Wire name 'chat_session_update', fields: chatSession, handled

Minecraft 26.3PlayServerboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x0A10PLAYServerboundGamePacketTypes.SERVERBOUND_CHAT_SESSION_UPDATE: "chat_session_update"

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 (1)

FieldType
chatSessionRemoteChatSession.Data

Fields are the components of the packet record.

Stream codec

static final StreamCodec<ByteBuf, ServerboundChatSessionUpdatePacket> STREAM_CODEC = RemoteChatSession.Data.STREAM_CODEC .map(ServerboundChatSessionUpdatePacket::new, ServerboundChatSessionUpdatePacke

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

Handling

Resolved on the ServerGamePacketListener packet-listener interface by void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket serverboundchatsessionupdatepacket). The implementation in the game is ServerGamePacketListenerImpl.

Full Source

ServerboundChatSessionUpdatePacket.java22 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.network.chat.RemoteChatSession;
5
import net.minecraft.network.codec.StreamCodec;
6
import net.minecraft.network.protocol.Packet;
7
import net.minecraft.network.protocol.PacketType;
8
9
public record ServerboundChatSessionUpdatePacket(RemoteChatSession.Data chatSession) implements Packet<ServerGamePacketListener> {
10
	public static final StreamCodec<ByteBuf, ServerboundChatSessionUpdatePacket> STREAM_CODEC = RemoteChatSession.Data.STREAM_CODEC
11
		.map(ServerboundChatSessionUpdatePacket::new, ServerboundChatSessionUpdatePacket::chatSession);
12
13
	@Override
14
	public PacketType<ServerboundChatSessionUpdatePacket> type() {
15
		return GamePacketTypes.SERVERBOUND_CHAT_SESSION_UPDATE;
16
	}
17
18
	public void handle(final ServerGamePacketListener listener) {
19
		listener.handleChatSessionUpdate(this);
20
	}
21
}
22