ClientboundStatusResponsePacket 0x00

ClientboundStatusResponsePacket: Minecraft 26.3 packet (0x00 Status clientbound). Wire name 'status_response', fields: status, handled

Minecraft 26.3StatusClientboundnet.minecraft.network.protocol.status

Protocol slots (1)

IDdecStateDirectionRegistry
0x000STATUSClientboundStatusPacketTypes.CLIENTBOUND_STATUS_RESPONSE: "status_response"

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
statusServerStatus

Fields are the components of the packet record.

Stream codec

static final StreamCodec<ByteBuf, ClientboundStatusResponsePacket> STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.lenientJson(32767).apply(ByteBufCodecs.fromCodec(OPS, ServerStatus.CODEC)), Clien

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

Handling

Resolved on the ClientStatusPacketListener packet-listener interface by void handleStatusResponse(ClientboundStatusResponsePacket clientboundstatusresponsepacket). The implementation in the game is ClientCommonPacketListenerImpl.

Full Source

ClientboundStatusResponsePacket.java30 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.status;
2
3
import com.google.gson.JsonElement;
4
import com.mojang.serialization.JsonOps;
5
import io.netty.buffer.ByteBuf;
6
import net.minecraft.core.RegistryAccess;
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
import net.minecraft.resources.RegistryOps;
12
13
public record ClientboundStatusResponsePacket(ServerStatus status) implements Packet<ClientStatusPacketListener> {
14
	private static final RegistryOps<JsonElement> OPS = RegistryAccess.EMPTY.createSerializationContext(JsonOps.INSTANCE);
15
	public static final StreamCodec<ByteBuf, ClientboundStatusResponsePacket> STREAM_CODEC = StreamCodec.composite(
16
		ByteBufCodecs.lenientJson(32767).apply(ByteBufCodecs.fromCodec(OPS, ServerStatus.CODEC)),
17
		ClientboundStatusResponsePacket::status,
18
		ClientboundStatusResponsePacket::new
19
	);
20
21
	@Override
22
	public PacketType<ClientboundStatusResponsePacket> type() {
23
		return StatusPacketTypes.CLIENTBOUND_STATUS_RESPONSE;
24
	}
25
26
	public void handle(final ClientStatusPacketListener listener) {
27
		listener.handleStatusResponse(this);
28
	}
29
}
30