ClientboundClearTitlesPacket 0x0E

ClientboundClearTitlesPacket: Minecraft 26.3 packet (0x0E Play clientbound). Wire name 'clear_titles', fields: resetTimes, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x0E14PLAYClientboundGamePacketTypes.CLIENTBOUND_CLEAR_TITLES: "clear_titles"

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
resetTimesboolean

Stream codec

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

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleTitlesClear(ClientboundClearTitlesPacket clientboundcleartitlespacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundClearTitlesPacket.java39 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 ClientboundClearTitlesPacket implements Packet<ClientGamePacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ClientboundClearTitlesPacket> STREAM_CODEC = Packet.codec(
10
		ClientboundClearTitlesPacket::write, ClientboundClearTitlesPacket::new
11
	);
12
	private final boolean resetTimes;
13
14
	public ClientboundClearTitlesPacket(final boolean resetTimes) {
15
		this.resetTimes = resetTimes;
16
	}
17
18
	private ClientboundClearTitlesPacket(final FriendlyByteBuf input) {
19
		this.resetTimes = input.readBoolean();
20
	}
21
22
	private void write(final FriendlyByteBuf output) {
23
		output.writeBoolean(this.resetTimes);
24
	}
25
26
	@Override
27
	public PacketType<ClientboundClearTitlesPacket> type() {
28
		return GamePacketTypes.CLIENTBOUND_CLEAR_TITLES;
29
	}
30
31
	public void handle(final ClientGamePacketListener listener) {
32
		listener.handleTitlesClear(this);
33
	}
34
35
	public boolean shouldResetTimes() {
36
		return this.resetTimes;
37
	}
38
}
39