ClientboundSetTitlesAnimationPacket 0x75

ClientboundSetTitlesAnimationPacket: Minecraft 26.3 packet (0x75 Play clientbound). Wire name 'set_titles_animation', fields: fadeIn, stay, fadeOut

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x75117PLAYClientboundGamePacketTypes.CLIENTBOUND_SET_TITLES_ANIMATION: "set_titles_animation"

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

FieldType
fadeInint
stayint
fadeOutint

Stream codec

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

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void setTitlesAnimation(ClientboundSetTitlesAnimationPacket clientboundsettitlesanimationpacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundSetTitlesAnimationPacket.java55 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 ClientboundSetTitlesAnimationPacket implements Packet<ClientGamePacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ClientboundSetTitlesAnimationPacket> STREAM_CODEC = Packet.codec(
10
		ClientboundSetTitlesAnimationPacket::write, ClientboundSetTitlesAnimationPacket::new
11
	);
12
	private final int fadeIn;
13
	private final int stay;
14
	private final int fadeOut;
15
16
	public ClientboundSetTitlesAnimationPacket(final int fadeIn, final int stay, final int fadeOut) {
17
		this.fadeIn = fadeIn;
18
		this.stay = stay;
19
		this.fadeOut = fadeOut;
20
	}
21
22
	private ClientboundSetTitlesAnimationPacket(final FriendlyByteBuf input) {
23
		this.fadeIn = input.readInt();
24
		this.stay = input.readInt();
25
		this.fadeOut = input.readInt();
26
	}
27
28
	private void write(final FriendlyByteBuf output) {
29
		output.writeInt(this.fadeIn);
30
		output.writeInt(this.stay);
31
		output.writeInt(this.fadeOut);
32
	}
33
34
	@Override
35
	public PacketType<ClientboundSetTitlesAnimationPacket> type() {
36
		return GamePacketTypes.CLIENTBOUND_SET_TITLES_ANIMATION;
37
	}
38
39
	public void handle(final ClientGamePacketListener listener) {
40
		listener.setTitlesAnimation(this);
41
	}
42
43
	public int getFadeIn() {
44
		return this.fadeIn;
45
	}
46
47
	public int getStay() {
48
		return this.stay;
49
	}
50
51
	public int getFadeOut() {
52
		return this.fadeOut;
53
	}
54
}
55