package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.Packet;

public class ClientboundBlockEntityDataPacket implements Packet<ClientGamePacketListener> {
    private BlockPos pos;
    private int type;
    private CompoundTag tag;
    
    public ClientboundBlockEntityDataPacket() {
    }
    
    public ClientboundBlockEntityDataPacket(final BlockPos fk, final int integer, final CompoundTag jt) {
        this.pos = fk;
        this.type = integer;
        this.tag = jt;
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.pos = kv.readBlockPos();
        this.type = kv.readUnsignedByte();
        this.tag = kv.readNbt();
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeBlockPos(this.pos);
        kv.writeByte((byte)this.type);
        kv.writeNbt(this.tag);
    }
    
    @Override
    public void handle(final ClientGamePacketListener lw) {
        lw.handleBlockEntityData(this);
    }
    
    public BlockPos getPos() {
        return this.pos;
    }
    
    public int getType() {
        return this.type;
    }
    
    public CompoundTag getTag() {
        return this.tag;
    }
}
