ServerboundClientCommandPacket .java

net.minecraft.network.protocol.game.ServerboundClientCommandPacket (class, 45 lines): members: getAction, Action, action, handle, STREAM_CODEC, type.

net.minecraft.network.protocol.gameclass45 linescommon1.3 KB

Implements

API Surface (3)

PacketType<ServerboundClientCommandPacket> type()
void handle(final ServerGamePacketListener listener)
ServerboundClientCommandPacket.Action getAction()

Fields & Constants (2)

STREAM_CODEC
action

Same Package (197)

Full Source

ServerboundClientCommandPacket.java45 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 class ServerboundClientCommandPacket implements Packet<ServerGamePacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ServerboundClientCommandPacket> STREAM_CODEC = Packet.codec(
10
		ServerboundClientCommandPacket::write, ServerboundClientCommandPacket::new
11
	);
12
	private final ServerboundClientCommandPacket.Action action;
13
14
	public ServerboundClientCommandPacket(final ServerboundClientCommandPacket.Action action) {
15
		this.action = action;
16
	}
17
18
	private ServerboundClientCommandPacket(final FriendlyByteBuf input) {
19
		this.action = input.readEnum(ServerboundClientCommandPacket.Action.class);
20
	}
21
22
	private void write(final FriendlyByteBuf output) {
23
		output.writeEnum(this.action);
24
	}
25
26
	@Override
27
	public PacketType<ServerboundClientCommandPacket> type() {
28
		return GamePacketTypes.SERVERBOUND_CLIENT_COMMAND;
29
	}
30
31
	public void handle(final ServerGamePacketListener listener) {
32
		listener.handleClientCommand(this);
33
	}
34
35
	public ServerboundClientCommandPacket.Action getAction() {
36
		return this.action;
37
	}
38
39
	public enum Action {
40
		PERFORM_RESPAWN,
41
		REQUEST_STATS,
42
		REQUEST_GAMERULE_VALUES;
43
	}
44
}
45

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