ServerboundEntityTagQueryPacket 0x19

ServerboundEntityTagQueryPacket: Minecraft 26.3 packet (0x19 Play serverbound). Wire name 'entity_tag_query', fields: transactionId, entityId, handled

Minecraft 26.3PlayServerboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x1925PLAYServerboundGamePacketTypes.SERVERBOUND_ENTITY_TAG_QUERY: "entity_tag_query"

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

FieldType
transactionIdint
entityIdint

Stream codec

static final StreamCodec<FriendlyByteBuf, ServerboundEntityTagQueryPacket> STREAM_CODEC = Packet.codec( ServerboundEntityTagQueryPacket::write, ServerboundEntityTagQueryPacket::new );

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

Handling

Resolved on the ServerGamePacketListener packet-listener interface by void handleEntityTagQuery(ServerboundEntityTagQueryPacket serverboundentitytagquerypacket). The implementation in the game is ServerGamePacketListenerImpl.

Full Source

ServerboundEntityTagQueryPacket.java47 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.StreamCodec;
5
import net.minecraft.network.protocol.Packet;
6
import net.minecraft.network.protocol.PacketType;
7
8
public class ServerboundEntityTagQueryPacket implements Packet<ServerGamePacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ServerboundEntityTagQueryPacket> STREAM_CODEC = Packet.codec(
10
		ServerboundEntityTagQueryPacket::write, ServerboundEntityTagQueryPacket::new
11
	);
12
	private final int transactionId;
13
	private final int entityId;
14
15
	public ServerboundEntityTagQueryPacket(final int transactionId, final int entityId) {
16
		this.transactionId = transactionId;
17
		this.entityId = entityId;
18
	}
19
20
	private ServerboundEntityTagQueryPacket(final FriendlyByteBuf input) {
21
		this.transactionId = input.readVarInt();
22
		this.entityId = input.readVarInt();
23
	}
24
25
	private void write(final FriendlyByteBuf output) {
26
		output.writeVarInt(this.transactionId);
27
		output.writeVarInt(this.entityId);
28
	}
29
30
	@Override
31
	public PacketType<ServerboundEntityTagQueryPacket> type() {
32
		return GamePacketTypes.SERVERBOUND_ENTITY_TAG_QUERY;
33
	}
34
35
	public void handle(final ServerGamePacketListener listener) {
36
		listener.handleEntityTagQuery(this);
37
	}
38
39
	public int getTransactionId() {
40
		return this.transactionId;
41
	}
42
43
	public int getEntityId() {
44
		return this.entityId;
45
	}
46
}
47