ClientboundMoveVehiclePacket 0x3A

ClientboundMoveVehiclePacket: Minecraft 26.3 packet (0x3A Play clientbound). Wire name 'move_vehicle', fields: movingTo, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x3A58PLAYClientboundGamePacketTypes.CLIENTBOUND_MOVE_VEHICLE: "move_vehicle"

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
movingToPositionAndRotation

Fields are the components of the packet record.

Stream codec

static final StreamCodec<ByteBuf, ClientboundMoveVehiclePacket> STREAM_CODEC = PositionAndRotation.STREAM_CODEC .map(ClientboundMoveVehiclePacket::new, ClientboundMoveVehiclePacket::movingTo);

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleMoveVehicle(ClientboundMoveVehiclePacket clientboundmovevehiclepacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundMoveVehiclePacket.java27 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.core.PositionAndRotation;
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
10
public record ClientboundMoveVehiclePacket(PositionAndRotation movingTo) implements Packet<ClientGamePacketListener> {
11
	public static final StreamCodec<ByteBuf, ClientboundMoveVehiclePacket> STREAM_CODEC = PositionAndRotation.STREAM_CODEC
12
		.map(ClientboundMoveVehiclePacket::new, ClientboundMoveVehiclePacket::movingTo);
13
14
	public static ClientboundMoveVehiclePacket fromEntity(final Entity entity) {
15
		return new ClientboundMoveVehiclePacket(entity.storePositionAndRotation());
16
	}
17
18
	@Override
19
	public PacketType<ClientboundMoveVehiclePacket> type() {
20
		return GamePacketTypes.CLIENTBOUND_MOVE_VEHICLE;
21
	}
22
23
	public void handle(final ClientGamePacketListener listener) {
24
		listener.handleMoveVehicle(this);
25
	}
26
}
27