ClientboundSetActionBarTextPacket 0x59

ClientboundSetActionBarTextPacket: Minecraft 26.3 packet (0x59 Play clientbound). Wire name 'set_action_bar_text', fields: text, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x5989PLAYClientboundGamePacketTypes.CLIENTBOUND_SET_ACTION_BAR_TEXT: "set_action_bar_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, ClientboundSetActionBarTextPacket> STREAM_CODEC = StreamCodec.composite( ComponentSerialization.TRUSTED_STREAM_CODEC, ClientboundSetActionBarTextPacke

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void setActionBarText(ClientboundSetActionBarTextPacket clientboundsetactionbartextpacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundSetActionBarTextPacket.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 ClientboundSetActionBarTextPacket(Component text) implements Packet<ClientGamePacketListener> {
11
	public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundSetActionBarTextPacket> STREAM_CODEC = StreamCodec.composite(
12
		ComponentSerialization.TRUSTED_STREAM_CODEC, ClientboundSetActionBarTextPacket::text, ClientboundSetActionBarTextPacket::new
13
	);
14
15
	@Override
16
	public PacketType<ClientboundSetActionBarTextPacket> type() {
17
		return GamePacketTypes.CLIENTBOUND_SET_ACTION_BAR_TEXT;
18
	}
19
20
	public void handle(final ClientGamePacketListener listener) {
21
		listener.setActionBarText(this);
22
	}
23
}
24