ClientboundSetEntityMotionPacket .java

net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket (record, 33 lines): members: movement, handle, STREAM_CODEC, type. imports: ByteBuf.

net.minecraft.network.protocol.gamerecord33 linescommon1.1 KB

Implements

API Surface (2)

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

Fields & Constants (1)

STREAM_CODEC

Same Package (197)

Full Source

ClientboundSetEntityMotionPacket.java33 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.network.codec.ByteBufCodecs;
5
import net.minecraft.network.codec.StreamCodec;
6
import net.minecraft.network.protocol.Packet;
7
import net.minecraft.network.protocol.PacketType;
8
import net.minecraft.world.entity.Entity;
9
import net.minecraft.world.phys.Vec3;
10
11
public record ClientboundSetEntityMotionPacket(int id, Vec3 movement) implements Packet<ClientGamePacketListener> {
12
	public static final StreamCodec<ByteBuf, ClientboundSetEntityMotionPacket> STREAM_CODEC = StreamCodec.composite(
13
		ByteBufCodecs.VAR_INT,
14
		ClientboundSetEntityMotionPacket::id,
15
		Vec3.LP_STREAM_CODEC,
16
		ClientboundSetEntityMotionPacket::movement,
17
		ClientboundSetEntityMotionPacket::new
18
	);
19
20
	public ClientboundSetEntityMotionPacket(final Entity entity) {
21
		this(entity.getId(), entity.getDeltaMovement());
22
	}
23
24
	@Override
25
	public PacketType<ClientboundSetEntityMotionPacket> type() {
26
		return GamePacketTypes.CLIENTBOUND_SET_ENTITY_MOTION;
27
	}
28
29
	public void handle(final ClientGamePacketListener listener) {
30
		listener.handleSetEntityMotion(this);
31
	}
32
}
33

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