Code/net/minecraft/network/protocol/game/ServerboundPlaceRecipePacke...

29 lines
1.1 KiB
Java
Raw Permalink Normal View History

2025-07-01 06:20:03 +00:00
package net.minecraft.network.protocol.game;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.PacketType;
import net.minecraft.world.item.crafting.display.RecipeDisplayId;
public record ServerboundPlaceRecipePacket(int containerId, RecipeDisplayId recipe, boolean useMaxItems) implements Packet<ServerGamePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ServerboundPlaceRecipePacket> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.CONTAINER_ID,
ServerboundPlaceRecipePacket::containerId,
RecipeDisplayId.STREAM_CODEC,
ServerboundPlaceRecipePacket::recipe,
ByteBufCodecs.BOOL,
ServerboundPlaceRecipePacket::useMaxItems,
ServerboundPlaceRecipePacket::new
);
@Override
public PacketType<ServerboundPlaceRecipePacket> type() {
return GamePacketTypes.SERVERBOUND_PLACE_RECIPE;
}
public void handle(ServerGamePacketListener p_134248_) {
p_134248_.handlePlaceRecipe(this);
}
}