ClientboundSetEntityLinkPacket .java

net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket (class): members: getSourceId, getDestId, sourceId, destId, handle, STREAM_CODEC, type.

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

Implements

API Surface (4)

PacketType<ClientboundSetEntityLinkPacket> type()
void handle(final ClientGamePacketListener listener)
int getSourceId()
int getDestId()

Fields & Constants (3)

STREAM_CODEC
sourceId
destId

Same Package (197)

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ClientboundSetEntityLinkPacket.java49 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import net.minecraft.network.FriendlyByteBuf;
4
import net.minecraft.network.codec.StreamCodec;
5
import net.minecraft.network.protocol.Packet;
6
import net.minecraft.network.protocol.PacketType;
7
import net.minecraft.world.entity.Entity;
8
import org.jspecify.annotations.Nullable;
9
10
public class ClientboundSetEntityLinkPacket implements Packet<ClientGamePacketListener> {
11
	public static final StreamCodec<FriendlyByteBuf, ClientboundSetEntityLinkPacket> STREAM_CODEC = Packet.codec(
12
		ClientboundSetEntityLinkPacket::write, ClientboundSetEntityLinkPacket::new
13
	);
14
	private final int sourceId;
15
	private final int destId;
16
17
	public ClientboundSetEntityLinkPacket(final Entity sourceEntity, final @Nullable Entity destEntity) {
18
		this.sourceId = sourceEntity.getId();
19
		this.destId = destEntity != null ? destEntity.getId() : 0;
20
	}
21
22
	private ClientboundSetEntityLinkPacket(final FriendlyByteBuf input) {
23
		this.sourceId = input.readInt();
24
		this.destId = input.readInt();
25
	}
26
27
	private void write(final FriendlyByteBuf output) {
28
		output.writeInt(this.sourceId);
29
		output.writeInt(this.destId);
30
	}
31
32
	@Override
33
	public PacketType<ClientboundSetEntityLinkPacket> type() {
34
		return GamePacketTypes.CLIENTBOUND_SET_ENTITY_LINK;
35
	}
36
37
	public void handle(final ClientGamePacketListener listener) {
38
		listener.handleEntityLinkPacket(this);
39
	}
40
41
	public int getSourceId() {
42
		return this.sourceId;
43
	}
44
45
	public int getDestId() {
46
		return this.destId;
47
	}
48
}
49

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