ClientboundSystemChatPacket 0x7C

ClientboundSystemChatPacket: Minecraft 26.3 packet (0x7C Play clientbound). Wire name 'system_chat', fields: content, overlay, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x7C124PLAYClientboundGamePacketTypes.CLIENTBOUND_SYSTEM_CHAT: "system_chat"

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
contentComponent
overlayboolean

Fields are the components of the packet record.

Stream codec

static final StreamCodec<RegistryFriendlyByteBuf, ClientboundSystemChatPacket> STREAM_CODEC = StreamCodec.composite( ComponentSerialization.TRUSTED_STREAM_CODEC, ClientboundSystemChatPacket::content,

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleSystemChat(ClientboundSystemChatPacket clientboundsystemchatpacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundSystemChatPacket.java34 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import net.minecraft.network.RegistryFriendlyByteBuf;
4
import net.minecraft.network.chat.Component;
5
import net.minecraft.network.chat.ComponentSerialization;
6
import net.minecraft.network.codec.ByteBufCodecs;
7
import net.minecraft.network.codec.StreamCodec;
8
import net.minecraft.network.protocol.Packet;
9
import net.minecraft.network.protocol.PacketType;
10
11
public record ClientboundSystemChatPacket(Component content, boolean overlay) implements Packet<ClientGamePacketListener> {
12
	public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundSystemChatPacket> STREAM_CODEC = StreamCodec.composite(
13
		ComponentSerialization.TRUSTED_STREAM_CODEC,
14
		ClientboundSystemChatPacket::content,
15
		ByteBufCodecs.BOOL,
16
		ClientboundSystemChatPacket::overlay,
17
		ClientboundSystemChatPacket::new
18
	);
19
20
	@Override
21
	public PacketType<ClientboundSystemChatPacket> type() {
22
		return GamePacketTypes.CLIENTBOUND_SYSTEM_CHAT;
23
	}
24
25
	public void handle(final ClientGamePacketListener listener) {
26
		listener.handleSystemChat(this);
27
	}
28
29
	@Override
30
	public boolean isSkippable() {
31
		return true;
32
	}
33
}
34