ServerboundDebugSubscriptionRequestPacket 0x17

ServerboundDebugSubscriptionRequestPacket: Minecraft 26.3 packet (0x17 Play serverbound).

Minecraft 26.3PlayServerboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x1723PLAYServerboundGamePacketTypes.SERVERBOUND_DEBUG_SUBSCRIPTION_REQUEST: "debug_subscription_request"

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
subscriptionsSet<DebugSubscription<?>>

Fields are the components of the packet record.

Stream codec

static final StreamCodec<RegistryFriendlyByteBuf, Set<DebugSubscription<?>>> SET_STREAM_CODEC = ByteBufCodecs.registry(Registries.DEBUG_SUBSCRIPTION) .apply(ByteBufCodecs.collection(ReferenceOpenHashS

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

Handling

Resolved on the ServerGamePacketListener packet-listener interface by void handleDebugSubscriptionRequest(ServerboundDebugSubscriptionRequestPacket serverbounddebugsubscriptionrequestpacket). The implementation in the game is ServerGamePacketListenerImpl.

Full Source

ServerboundDebugSubscriptionRequestPacket.java29 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
4
import java.util.Set;
5
import net.minecraft.core.registries.Registries;
6
import net.minecraft.network.RegistryFriendlyByteBuf;
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.util.debug.DebugSubscription;
12
13
public record ServerboundDebugSubscriptionRequestPacket(Set<DebugSubscription<?>> subscriptions) implements Packet<ServerGamePacketListener> {
14
	private static final StreamCodec<RegistryFriendlyByteBuf, Set<DebugSubscription<?>>> SET_STREAM_CODEC = ByteBufCodecs.registry(Registries.DEBUG_SUBSCRIPTION)
15
		.apply(ByteBufCodecs.collection(ReferenceOpenHashSet::new, 32));
16
	public static final StreamCodec<RegistryFriendlyByteBuf, ServerboundDebugSubscriptionRequestPacket> STREAM_CODEC = SET_STREAM_CODEC.map(
17
		ServerboundDebugSubscriptionRequestPacket::new, ServerboundDebugSubscriptionRequestPacket::subscriptions
18
	);
19
20
	@Override
21
	public PacketType<ServerboundDebugSubscriptionRequestPacket> type() {
22
		return GamePacketTypes.SERVERBOUND_DEBUG_SUBSCRIPTION_REQUEST;
23
	}
24
25
	public void handle(final ServerGamePacketListener listener) {
26
		listener.handleDebugSubscriptionRequest(this);
27
	}
28
}
29