ServerboundChatCommandPacket .java

net.minecraft.network.protocol.game.ServerboundChatCommandPacket (record): members: command, write, handle, STREAM_CODEC, type. imports: FriendlyByteBuf.

net.minecraft.network.protocol.gamerecord30 linescommon944 B

Implements

API Surface (2)

PacketType<ServerboundChatCommandPacket> type()
void handle(final ServerGamePacketListener listener)

Fields & Constants (1)

STREAM_CODEC

Same Package (197)

Code Graph: Dependencies (5)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ServerboundChatCommandPacket.java30 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
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
8
public record ServerboundChatCommandPacket(String command) implements Packet<ServerGamePacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ServerboundChatCommandPacket> STREAM_CODEC = Packet.codec(
10
		ServerboundChatCommandPacket::write, ServerboundChatCommandPacket::new
11
	);
12
13
	private ServerboundChatCommandPacket(final FriendlyByteBuf input) {
14
		this(input.readUtf());
15
	}
16
17
	private void write(final FriendlyByteBuf output) {
18
		output.writeUtf(this.command);
19
	}
20
21
	@Override
22
	public PacketType<ServerboundChatCommandPacket> type() {
23
		return GamePacketTypes.SERVERBOUND_CHAT_COMMAND;
24
	}
25
26
	public void handle(final ServerGamePacketListener listener) {
27
		listener.handleChatCommand(this);
28
	}
29
}
30

Decompiled Minecraft 26.3 source of ServerboundChatCommandPacket (net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java) with Mojang official mappings, stored verbatim on the site.