ClientboundUpdateRecipesPacket 0x88

ClientboundUpdateRecipesPacket: Minecraft 26.3 packet (0x88 Play clientbound). Wire name 'update_recipes', fields: Map<ResourceKey<RecipePropertySet>

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x88136PLAYClientboundGamePacketTypes.CLIENTBOUND_UPDATE_RECIPES: "update_recipes"

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
Map<ResourceKey<RecipePropertySet>
itemSetsRecipePropertySet>
stonecutterRecipesSelectableRecipe.SingleInputSet<StonecutterRecipe>

Fields are the components of the packet record.

Stream codec

static final StreamCodec<RegistryFriendlyByteBuf, ClientboundUpdateRecipesPacket> STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.map(HashMap::new, ResourceKey.streamCodec(RecipePropertySet.TYPE_K

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleUpdateRecipes(ClientboundUpdateRecipesPacket clientboundupdaterecipespacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundUpdateRecipesPacket.java35 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import java.util.HashMap;
4
import java.util.Map;
5
import net.minecraft.network.RegistryFriendlyByteBuf;
6
import net.minecraft.network.codec.ByteBufCodecs;
7
import net.minecraft.network.codec.StreamCodec;
8
import net.minecraft.network.protocol.Packet;
9
import net.minecraft.network.protocol.PacketType;
10
import net.minecraft.resources.ResourceKey;
11
import net.minecraft.world.item.crafting.RecipePropertySet;
12
import net.minecraft.world.item.crafting.SelectableRecipe;
13
import net.minecraft.world.item.crafting.StonecutterRecipe;
14
15
public record ClientboundUpdateRecipesPacket(
16
	Map<ResourceKey<RecipePropertySet>, RecipePropertySet> itemSets, SelectableRecipe.SingleInputSet<StonecutterRecipe> stonecutterRecipes
17
) implements Packet<ClientGamePacketListener> {
18
	public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundUpdateRecipesPacket> STREAM_CODEC = StreamCodec.composite(
19
		ByteBufCodecs.map(HashMap::new, ResourceKey.streamCodec(RecipePropertySet.TYPE_KEY), RecipePropertySet.STREAM_CODEC),
20
		ClientboundUpdateRecipesPacket::itemSets,
21
		SelectableRecipe.SingleInputSet.noRecipeCodec(),
22
		ClientboundUpdateRecipesPacket::stonecutterRecipes,
23
		ClientboundUpdateRecipesPacket::new
24
	);
25
26
	@Override
27
	public PacketType<ClientboundUpdateRecipesPacket> type() {
28
		return GamePacketTypes.CLIENTBOUND_UPDATE_RECIPES;
29
	}
30
31
	public void handle(final ClientGamePacketListener listener) {
32
		listener.handleUpdateRecipes(this);
33
	}
34
}
35