ClientboundRecipeBookRemovePacket 0x4C

ClientboundRecipeBookRemovePacket: Minecraft 26.3 packet (0x4C Play clientbound). Wire name 'recipe_book_remove', fields: recipes, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x4C76PLAYClientboundGamePacketTypes.CLIENTBOUND_RECIPE_BOOK_REMOVE: "recipe_book_remove"

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
recipesList<RecipeDisplayId>

Fields are the components of the packet record.

Stream codec

static final StreamCodec<ByteBuf, ClientboundRecipeBookRemovePacket> STREAM_CODEC = StreamCodec.composite( RecipeDisplayId.STREAM_CODEC.apply(ByteBufCodecs.list()), ClientboundRecipeBookRemovePacket::

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleRecipeBookRemove(ClientboundRecipeBookRemovePacket clientboundrecipebookremovepacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundRecipeBookRemovePacket.java25 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import io.netty.buffer.ByteBuf;
4
import java.util.List;
5
import net.minecraft.network.codec.ByteBufCodecs;
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.world.item.crafting.display.RecipeDisplayId;
10
11
public record ClientboundRecipeBookRemovePacket(List<RecipeDisplayId> recipes) implements Packet<ClientGamePacketListener> {
12
	public static final StreamCodec<ByteBuf, ClientboundRecipeBookRemovePacket> STREAM_CODEC = StreamCodec.composite(
13
		RecipeDisplayId.STREAM_CODEC.apply(ByteBufCodecs.list()), ClientboundRecipeBookRemovePacket::recipes, ClientboundRecipeBookRemovePacket::new
14
	);
15
16
	@Override
17
	public PacketType<ClientboundRecipeBookRemovePacket> type() {
18
		return GamePacketTypes.CLIENTBOUND_RECIPE_BOOK_REMOVE;
19
	}
20
21
	public void handle(final ClientGamePacketListener listener) {
22
		listener.handleRecipeBookRemove(this);
23
	}
24
}
25