package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import javax.annotation.Nullable;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;

public class ClientboundTagQueryPacket implements Packet<ClientGamePacketListener> {
    private int transactionId;
    @Nullable
    private CompoundTag tag;
    
    public ClientboundTagQueryPacket() {
    }
    
    public ClientboundTagQueryPacket(final int integer, @Nullable final CompoundTag jt) {
        this.transactionId = integer;
        this.tag = jt;
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.transactionId = kv.readVarInt();
        this.tag = kv.readNbt();
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeVarInt(this.transactionId);
        kv.writeNbt(this.tag);
    }
    
    @Override
    public void handle(final ClientGamePacketListener lw) {
        lw.handleTagQueryPacket(this);
    }
    
    public int getTransactionId() {
        return this.transactionId;
    }
    
    @Nullable
    public CompoundTag getTag() {
        return this.tag;
    }
    
    @Override
    public boolean isSkippable() {
        return true;
    }
}
