ClientboundSetTitleTextPacket 0x74

ClientboundSetTitleTextPacket: Minecraft 26.3 packet (0x74 Play clientbound). Wire name 'set_title_text', fields: text, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x74116PLAYClientboundGamePacketTypes.CLIENTBOUND_SET_TITLE_TEXT: "set_title_text"

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
textComponent

Fields are the components of the packet record.

Stream codec

static final StreamCodec<RegistryFriendlyByteBuf, ClientboundSetTitleTextPacket> STREAM_CODEC = StreamCodec.composite( ComponentSerialization.TRUSTED_STREAM_CODEC, ClientboundSetTitleTextPacket::text,

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void setTitleText(ClientboundSetTitleTextPacket clientboundsettitletextpacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundSetTitleTextPacket.java24 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import net.minecraft.network.RegistryFriendlyByteBuf;
4
import net.minecraft.network.chat.Component;
5
import net.minecraft.network.chat.ComponentSerialization;
6
import net.minecraft.network.codec.StreamCodec;
7
import net.minecraft.network.protocol.Packet;
8
import net.minecraft.network.protocol.PacketType;
9
10
public record ClientboundSetTitleTextPacket(Component text) implements Packet<ClientGamePacketListener> {
11
	public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundSetTitleTextPacket> STREAM_CODEC = StreamCodec.composite(
12
		ComponentSerialization.TRUSTED_STREAM_CODEC, ClientboundSetTitleTextPacket::text, ClientboundSetTitleTextPacket::new
13
	);
14
15
	@Override
16
	public PacketType<ClientboundSetTitleTextPacket> type() {
17
		return GamePacketTypes.CLIENTBOUND_SET_TITLE_TEXT;
18
	}
19
20
	public void handle(final ClientGamePacketListener listener) {
21
		listener.setTitleText(this);
22
	}
23
}
24