package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.Packet;

public class ServerboundSetJigsawBlockPacket implements Packet<ServerGamePacketListener> {
    private BlockPos pos;
    private ResourceLocation attachementType;
    private ResourceLocation targetPool;
    private String finalState;
    
    public ServerboundSetJigsawBlockPacket() {
    }
    
    public ServerboundSetJigsawBlockPacket(final BlockPos fk, final ResourceLocation sm2, final ResourceLocation sm3, final String string) {
        this.pos = fk;
        this.attachementType = sm2;
        this.targetPool = sm3;
        this.finalState = string;
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.pos = kv.readBlockPos();
        this.attachementType = kv.readResourceLocation();
        this.targetPool = kv.readResourceLocation();
        this.finalState = kv.readUtf(32767);
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeBlockPos(this.pos);
        kv.writeResourceLocation(this.attachementType);
        kv.writeResourceLocation(this.targetPool);
        kv.writeUtf(this.finalState);
    }
    
    @Override
    public void handle(final ServerGamePacketListener pl) {
        pl.handleSetJigsawBlock(this);
    }
    
    public BlockPos getPos() {
        return this.pos;
    }
    
    public ResourceLocation getTargetPool() {
        return this.targetPool;
    }
    
    public ResourceLocation getAttachementType() {
        return this.attachementType;
    }
    
    public String getFinalState() {
        return this.finalState;
    }
}
