ServerboundDebugSubscriptionRequestPacket .java

net.minecraft.network.protocol.game.ServerboundDebugSubscriptionRequestPacket (record, 29 lines): members: subscriptions, SET_STREAM_CODEC, handle, type.

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

Implements

API Surface (2)

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

Fields & Constants (2)

SET_STREAM_CODEC
STREAM_CODEC

Same Package (197)

Full Source

ServerboundDebugSubscriptionRequestPacket.java29 lines · Minecraft 26.3 · verbatim
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

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