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 fu, final int integer, final CompoundTag le) {
        this.pos = fu;
        this.type = integer;
        this.tag = le;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.pos = mg.readBlockPos();
        this.type = mg.readUnsignedByte();
        this.tag = mg.readNbt();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeBlockPos(this.pos);
        mg.writeByte((byte)this.type);
        mg.writeNbt(this.tag);
    }
    
    @Override
    public void handle(final ClientGamePacketListener nl) {
        nl.handleBlockEntityData(this);
    }
    
    public BlockPos getPos() {
        return this.pos;
    }
    
    public int getType() {
        return this.type;
    }
    
    public CompoundTag getTag() {
        return this.tag;
    }
}
