ClientboundRecipeBookSettingsPacket 0x4D

ClientboundRecipeBookSettingsPacket: Minecraft 26.3 packet (0x4D Play clientbound). Wire name 'recipe_book_settings', fields: bookSettings, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x4D77PLAYClientboundGamePacketTypes.CLIENTBOUND_RECIPE_BOOK_SETTINGS: "recipe_book_settings"

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
bookSettingsRecipeBookSettings

Fields are the components of the packet record.

Stream codec

static final StreamCodec<FriendlyByteBuf, ClientboundRecipeBookSettingsPacket> STREAM_CODEC = StreamCodec.composite( RecipeBookSettings.STREAM_CODEC, ClientboundRecipeBookSettingsPacket::bookSettings,

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleRecipeBookSettings(ClientboundRecipeBookSettingsPacket clientboundrecipebooksettingspacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundRecipeBookSettingsPacket.java23 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
import net.minecraft.stats.RecipeBookSettings;
8
9
public record ClientboundRecipeBookSettingsPacket(RecipeBookSettings bookSettings) implements Packet<ClientGamePacketListener> {
10
	public static final StreamCodec<FriendlyByteBuf, ClientboundRecipeBookSettingsPacket> STREAM_CODEC = StreamCodec.composite(
11
		RecipeBookSettings.STREAM_CODEC, ClientboundRecipeBookSettingsPacket::bookSettings, ClientboundRecipeBookSettingsPacket::new
12
	);
13
14
	@Override
15
	public PacketType<ClientboundRecipeBookSettingsPacket> type() {
16
		return GamePacketTypes.CLIENTBOUND_RECIPE_BOOK_SETTINGS;
17
	}
18
19
	public void handle(final ClientGamePacketListener listener) {
20
		listener.handleRecipeBookSettings(this);
21
	}
22
}
23