ClientboundCodeOfConductPacket 0x13

ClientboundCodeOfConductPacket: Minecraft 26.3 packet (0x13 Configuration clientbound, 0x14 Configuration clientbound).

Minecraft 26.3ConfigurationClientboundnet.minecraft.network.protocol.configuration

Protocol slots (2)

IDdecStateDirectionRegistry
0x1319CONFIGURATIONClientboundConfigurationPacketTypes.CLIENTBOUND_CODE_OF_CONDUCT: "code_of_conduct"
0x1420CONFIGURATIONClientboundConfigurationPacketTypes.CLIENTBOUND_CODE_OF_CONDUCT: "code_of_conduct"

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
codeOfConductString

Fields are the components of the packet record.

Stream codec

static final StreamCodec<ByteBuf, ClientboundCodeOfConductPacket> STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.STRING_UTF8, ClientboundCodeOfConductPacket::codeOfConduct, ClientboundCodeOfCondu

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

Handling

Resolved on the ClientConfigurationPacketListener packet-listener interface by void handleCodeOfConduct(ClientboundCodeOfConductPacket clientboundcodeofconductpacket). The implementation in the game is ClientConfigurationPacketListenerImpl.

Full Source

ClientboundCodeOfConductPacket.java23 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.configuration;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.network.codec.ByteBufCodecs;
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 ClientboundCodeOfConductPacket(String codeOfConduct) implements Packet<ClientConfigurationPacketListener> {
10
	public static final StreamCodec<ByteBuf, ClientboundCodeOfConductPacket> STREAM_CODEC = StreamCodec.composite(
11
		ByteBufCodecs.STRING_UTF8, ClientboundCodeOfConductPacket::codeOfConduct, ClientboundCodeOfConductPacket::new
12
	);
13
14
	@Override
15
	public PacketType<ClientboundCodeOfConductPacket> type() {
16
		return ConfigurationPacketTypes.CLIENTBOUND_CODE_OF_CONDUCT;
17
	}
18
19
	public void handle(final ClientConfigurationPacketListener listener) {
20
		listener.handleCodeOfConduct(this);
21
	}
22
}
23