ServerboundAcceptTeleportationPacket 0x00

ServerboundAcceptTeleportationPacket: Minecraft 26.3 packet (0x00 Play serverbound). Wire name 'accept_teleportation', fields: id, x, y, z, yRot, xRot

Minecraft 26.3PlayServerboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x000PLAYServerboundGamePacketTypes.SERVERBOUND_ACCEPT_TELEPORTATION: "accept_teleportation"

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 (6)

FieldType
idint
xdouble
ydouble
zdouble
yRotfloat
xRotfloat

Fields are the components of the packet record.

Stream codec

static final StreamCodec<FriendlyByteBuf, ServerboundAcceptTeleportationPacket> STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.VAR_INT, ServerboundAcceptTeleportationPacket::id, ByteBufCodecs.DOU

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

Handling

Resolved on the ServerGamePacketListener packet-listener interface by void handleAcceptTeleportPacket(ServerboundAcceptTeleportationPacket serverboundacceptteleportationpacket). The implementation in the game is ServerGamePacketListenerImpl.

Full Source

ServerboundAcceptTeleportationPacket.java35 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import net.minecraft.network.FriendlyByteBuf;
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
9
public record ServerboundAcceptTeleportationPacket(int id, double x, double y, double z, float yRot, float xRot) implements Packet<ServerGamePacketListener> {
10
	public static final StreamCodec<FriendlyByteBuf, ServerboundAcceptTeleportationPacket> STREAM_CODEC = StreamCodec.composite(
11
		ByteBufCodecs.VAR_INT,
12
		ServerboundAcceptTeleportationPacket::id,
13
		ByteBufCodecs.DOUBLE,
14
		ServerboundAcceptTeleportationPacket::x,
15
		ByteBufCodecs.DOUBLE,
16
		ServerboundAcceptTeleportationPacket::y,
17
		ByteBufCodecs.DOUBLE,
18
		ServerboundAcceptTeleportationPacket::z,
19
		ByteBufCodecs.FLOAT,
20
		ServerboundAcceptTeleportationPacket::yRot,
21
		ByteBufCodecs.FLOAT,
22
		ServerboundAcceptTeleportationPacket::xRot,
23
		ServerboundAcceptTeleportationPacket::new
24
	);
25
26
	@Override
27
	public PacketType<ServerboundAcceptTeleportationPacket> type() {
28
		return GamePacketTypes.SERVERBOUND_ACCEPT_TELEPORTATION;
29
	}
30
31
	public void handle(final ServerGamePacketListener listener) {
32
		listener.handleAcceptTeleportPacket(this);
33
	}
34
}
35