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 ServerboundPlaceRecipePacket implements Packet<ServerGamePacketListener> {
    private int containerId;
    private ResourceLocation recipe;
    private boolean shiftDown;
    
    public ServerboundPlaceRecipePacket() {
    }
    
    public ServerboundPlaceRecipePacket(final int integer, final Recipe<?> bgw, final boolean boolean3) {
        this.containerId = integer;
        this.recipe = bgw.getId();
        this.shiftDown = boolean3;
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.containerId = kv.readByte();
        this.recipe = kv.readResourceLocation();
        this.shiftDown = kv.readBoolean();
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeByte(this.containerId);
        kv.writeResourceLocation(this.recipe);
        kv.writeBoolean(this.shiftDown);
    }
    
    @Override
    public void handle(final ServerGamePacketListener pl) {
        pl.handlePlaceRecipe(this);
    }
    
    public int getContainerId() {
        return this.containerId;
    }
    
    public ResourceLocation getRecipe() {
        return this.recipe;
    }
    
    public boolean isShiftDown() {
        return this.shiftDown;
    }
}
