package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.protocol.Packet;

public class ClientboundPlaceGhostRecipePacket implements Packet<ClientGamePacketListener> {
    private int containerId;
    private ResourceLocation recipe;
    
    public ClientboundPlaceGhostRecipePacket() {
    }
    
    public ClientboundPlaceGhostRecipePacket(final int integer, final Recipe<?> bmu) {
        this.containerId = integer;
        this.recipe = bmu.getId();
    }
    
    public ResourceLocation getRecipe() {
        return this.recipe;
    }
    
    public int getContainerId() {
        return this.containerId;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.containerId = mg.readByte();
        this.recipe = mg.readResourceLocation();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeByte(this.containerId);
        mg.writeResourceLocation(this.recipe);
    }
    
    @Override
    public void handle(final ClientGamePacketListener nl) {
        nl.handlePlaceRecipe(this);
    }
}
