ClientboundLoginPacket .java

net.minecraft.network.protocol.game.ClientboundLoginPacket (record, 65 lines): members: playerId, hardcore, levels, maxPlayers, chunkRadius, onlineMode.

net.minecraft.network.protocol.gamerecord65 linescommon2.1 KB

Implements

API Surface (2)

PacketType<ClientboundLoginPacket> type()
void handle(final ClientGamePacketListener listener)

Fields & Constants (1)

STREAM_CODEC

Same Package (197)

Full Source

ClientboundLoginPacket.java65 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import com.google.common.collect.Sets;
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.resources.ResourceKey;
12
import net.minecraft.world.level.Level;
13
14
public record ClientboundLoginPacket(
15
	int playerId,
16
	boolean hardcore,
17
	Set<ResourceKey<Level>> levels,
18
	int maxPlayers,
19
	int chunkRadius,
20
	int simulationDistance,
21
	boolean reducedDebugInfo,
22
	boolean showDeathScreen,
23
	boolean doLimitedCrafting,
24
	CommonPlayerSpawnInfo commonPlayerSpawnInfo,
25
	boolean onlineMode,
26
	boolean enforcesSecureChat
27
) implements Packet<ClientGamePacketListener> {
28
	public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundLoginPacket> STREAM_CODEC = StreamCodec.composite(
29
		ByteBufCodecs.INT,
30
		ClientboundLoginPacket::playerId,
31
		ByteBufCodecs.BOOL,
32
		ClientboundLoginPacket::hardcore,
33
		ResourceKey.streamCodec(Registries.DIMENSION).apply(ByteBufCodecs.collection(Sets::newHashSetWithExpectedSize)),
34
		ClientboundLoginPacket::levels,
35
		ByteBufCodecs.VAR_INT,
36
		ClientboundLoginPacket::maxPlayers,
37
		ByteBufCodecs.VAR_INT,
38
		ClientboundLoginPacket::chunkRadius,
39
		ByteBufCodecs.VAR_INT,
40
		ClientboundLoginPacket::simulationDistance,
41
		ByteBufCodecs.BOOL,
42
		ClientboundLoginPacket::reducedDebugInfo,
43
		ByteBufCodecs.BOOL,
44
		ClientboundLoginPacket::showDeathScreen,
45
		ByteBufCodecs.BOOL,
46
		ClientboundLoginPacket::doLimitedCrafting,
47
		CommonPlayerSpawnInfo.STREAM_CODEC,
48
		ClientboundLoginPacket::commonPlayerSpawnInfo,
49
		ByteBufCodecs.BOOL,
50
		ClientboundLoginPacket::onlineMode,
51
		ByteBufCodecs.BOOL,
52
		ClientboundLoginPacket::enforcesSecureChat,
53
		ClientboundLoginPacket::new
54
	);
55
56
	@Override
57
	public PacketType<ClientboundLoginPacket> type() {
58
		return GamePacketTypes.CLIENTBOUND_LOGIN;
59
	}
60
61
	public void handle(final ClientGamePacketListener listener) {
62
		listener.handleLogin(this);
63
	}
64
}
65

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