ServerboundTeleportToEntityPacket .java

net.minecraft.network.protocol.game.ServerboundTeleportToEntityPacket (class, 43 lines): members: uuid, getEntity, handle, STREAM_CODEC, type.

net.minecraft.network.protocol.gameclass43 linescommon1.3 KB

Implements

API Surface (2)

PacketType<ServerboundTeleportToEntityPacket> type()
void handle(final ServerGamePacketListener listener)

Fields & Constants (2)

STREAM_CODEC
uuid

Same Package (197)

Full Source

ServerboundTeleportToEntityPacket.java43 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import java.util.UUID;
4
import net.minecraft.network.FriendlyByteBuf;
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.server.level.ServerLevel;
9
import net.minecraft.world.entity.Entity;
10
import org.jspecify.annotations.Nullable;
11
12
public class ServerboundTeleportToEntityPacket implements Packet<ServerGamePacketListener> {
13
	public static final StreamCodec<FriendlyByteBuf, ServerboundTeleportToEntityPacket> STREAM_CODEC = Packet.codec(
14
		ServerboundTeleportToEntityPacket::write, ServerboundTeleportToEntityPacket::new
15
	);
16
	private final UUID uuid;
17
18
	public ServerboundTeleportToEntityPacket(final UUID uuid) {
19
		this.uuid = uuid;
20
	}
21
22
	private ServerboundTeleportToEntityPacket(final FriendlyByteBuf input) {
23
		this.uuid = input.readUUID();
24
	}
25
26
	private void write(final FriendlyByteBuf output) {
27
		output.writeUUID(this.uuid);
28
	}
29
30
	@Override
31
	public PacketType<ServerboundTeleportToEntityPacket> type() {
32
		return GamePacketTypes.SERVERBOUND_TELEPORT_TO_ENTITY;
33
	}
34
35
	public void handle(final ServerGamePacketListener listener) {
36
		listener.handleTeleportToEntityPacket(this);
37
	}
38
39
	public @Nullable Entity getEntity(final ServerLevel level) {
40
		return level.getEntity(this.uuid);
41
	}
42
}
43

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