ServerboundChatCommandSignedPacket 0x08

ServerboundChatCommandSignedPacket: Minecraft 26.3 packet (0x08 Play serverbound). Wire name 'chat_command_signed', fields: command, timeStamp, salt

Minecraft 26.3PlayServerboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x088PLAYServerboundGamePacketTypes.SERVERBOUND_CHAT_COMMAND_SIGNED: "chat_command_signed"

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

FieldType
commandString
timeStampInstant
saltlong
argumentSignaturesArgumentSignatures
lastSeenMessagesLastSeenMessages.Update

Fields are the components of the packet record.

Stream codec

static final StreamCodec<ByteBuf, ServerboundChatCommandSignedPacket> STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.STRING_UTF8, ServerboundChatCommandSignedPacket::command, ByteBufCodecs.INSTAN

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

Handling

Resolved on the ServerGamePacketListener packet-listener interface by void handleSignedChatCommand(ServerboundChatCommandSignedPacket serverboundchatcommandsignedpacket). The implementation in the game is ServerGamePacketListenerImpl.

Full Source

ServerboundChatCommandSignedPacket.java38 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import io.netty.buffer.ByteBuf;
4
import java.time.Instant;
5
import net.minecraft.commands.arguments.ArgumentSignatures;
6
import net.minecraft.network.chat.LastSeenMessages;
7
import net.minecraft.network.codec.ByteBufCodecs;
8
import net.minecraft.network.codec.StreamCodec;
9
import net.minecraft.network.protocol.Packet;
10
import net.minecraft.network.protocol.PacketType;
11
12
public record ServerboundChatCommandSignedPacket(
13
	String command, Instant timeStamp, long salt, ArgumentSignatures argumentSignatures, LastSeenMessages.Update lastSeenMessages
14
) implements Packet<ServerGamePacketListener> {
15
	public static final StreamCodec<ByteBuf, ServerboundChatCommandSignedPacket> STREAM_CODEC = StreamCodec.composite(
16
		ByteBufCodecs.STRING_UTF8,
17
		ServerboundChatCommandSignedPacket::command,
18
		ByteBufCodecs.INSTANT,
19
		ServerboundChatCommandSignedPacket::timeStamp,
20
		ByteBufCodecs.LONG,
21
		ServerboundChatCommandSignedPacket::salt,
22
		ArgumentSignatures.STREAM_CODEC,
23
		ServerboundChatCommandSignedPacket::argumentSignatures,
24
		LastSeenMessages.Update.STREAM_CODEC,
25
		ServerboundChatCommandSignedPacket::lastSeenMessages,
26
		ServerboundChatCommandSignedPacket::new
27
	);
28
29
	@Override
30
	public PacketType<ServerboundChatCommandSignedPacket> type() {
31
		return GamePacketTypes.SERVERBOUND_CHAT_COMMAND_SIGNED;
32
	}
33
34
	public void handle(final ServerGamePacketListener listener) {
35
		listener.handleSignedChatCommand(this);
36
	}
37
}
38