ClientboundPlayerPositionPacket .java

net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket (record): members: change, relatives, handle, STREAM_CODEC, type. imports: Relative.

net.minecraft.network.protocol.gamerecord36 linescommon1.4 KB

Implements

API Surface (3)

ClientboundPlayerPositionPacket of(final int id, final PositionMoveRotation values, final Set<Relative> relatives)
PacketType<ClientboundPlayerPositionPacket> type()
void handle(final ClientGamePacketListener listener)

Fields & Constants (1)

STREAM_CODEC

Same Package (197)

Full Source

ClientboundPlayerPositionPacket.java36 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import java.util.Set;
4
import net.minecraft.network.FriendlyByteBuf;
5
import net.minecraft.network.codec.ByteBufCodecs;
6
import net.minecraft.network.codec.StreamCodec;
7
import net.minecraft.network.protocol.Packet;
8
import net.minecraft.network.protocol.PacketType;
9
import net.minecraft.world.entity.PositionMoveRotation;
10
import net.minecraft.world.entity.Relative;
11
12
public record ClientboundPlayerPositionPacket(int id, PositionMoveRotation change, Set<Relative> relatives) implements Packet<ClientGamePacketListener> {
13
	public static final StreamCodec<FriendlyByteBuf, ClientboundPlayerPositionPacket> STREAM_CODEC = StreamCodec.composite(
14
		ByteBufCodecs.VAR_INT,
15
		ClientboundPlayerPositionPacket::id,
16
		PositionMoveRotation.STREAM_CODEC,
17
		ClientboundPlayerPositionPacket::change,
18
		Relative.SET_STREAM_CODEC,
19
		ClientboundPlayerPositionPacket::relatives,
20
		ClientboundPlayerPositionPacket::new
21
	);
22
23
	public static ClientboundPlayerPositionPacket of(final int id, final PositionMoveRotation values, final Set<Relative> relatives) {
24
		return new ClientboundPlayerPositionPacket(id, values, relatives);
25
	}
26
27
	@Override
28
	public PacketType<ClientboundPlayerPositionPacket> type() {
29
		return GamePacketTypes.CLIENTBOUND_PLAYER_POSITION;
30
	}
31
32
	public void handle(final ClientGamePacketListener listener) {
33
		listener.handleMovePlayer(this);
34
	}
35
}
36

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