ClientboundShowDialogPacket 0x8F

ClientboundShowDialogPacket: Minecraft 26.3 packet (0x8F Play clientbound). Wire name 'show_dialog', fields: dialog, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.common

Protocol slots (1)

IDdecStateDirectionRegistry
0x8F143PLAYClientboundCommonPacketTypes.CLIENTBOUND_SHOW_DIALOG: "show_dialog"

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
dialogHolder<Dialog>

Fields are the components of the packet record.

Stream codec

static final StreamCodec<RegistryFriendlyByteBuf, ClientboundShowDialogPacket> STREAM_CODEC = StreamCodec.composite( Dialog.STREAM_CODEC, ClientboundShowDialogPacket::dialog, ClientboundShowDialogPack

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

Handling

Resolved on the ClientCommonPacketListener packet-listener interface by void handleShowDialog(ClientboundShowDialogPacket clientboundshowdialogpacket). The implementation in the game is ClientCommonPacketListenerImpl.

Full Source

ClientboundShowDialogPacket.java28 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.common;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.core.Holder;
5
import net.minecraft.network.RegistryFriendlyByteBuf;
6
import net.minecraft.network.codec.StreamCodec;
7
import net.minecraft.network.protocol.Packet;
8
import net.minecraft.network.protocol.PacketType;
9
import net.minecraft.server.dialog.Dialog;
10
11
public record ClientboundShowDialogPacket(Holder<Dialog> dialog) implements Packet<ClientCommonPacketListener> {
12
	public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundShowDialogPacket> STREAM_CODEC = StreamCodec.composite(
13
		Dialog.STREAM_CODEC, ClientboundShowDialogPacket::dialog, ClientboundShowDialogPacket::new
14
	);
15
	public static final StreamCodec<ByteBuf, ClientboundShowDialogPacket> CONTEXT_FREE_STREAM_CODEC = StreamCodec.composite(
16
		Dialog.CONTEXT_FREE_STREAM_CODEC.map(Holder::direct, Holder::value), ClientboundShowDialogPacket::dialog, ClientboundShowDialogPacket::new
17
	);
18
19
	@Override
20
	public PacketType<ClientboundShowDialogPacket> type() {
21
		return CommonPacketTypes.CLIENTBOUND_SHOW_DIALOG;
22
	}
23
24
	public void handle(final ClientCommonPacketListener listener) {
25
		listener.handleShowDialog(this);
26
	}
27
}
28