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 le) {
        this.transactionId = integer;
        this.tag = le;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.transactionId = mg.readVarInt();
        this.tag = mg.readNbt();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeVarInt(this.transactionId);
        mg.writeNbt(this.tag);
    }
    
    @Override
    public void handle(final ClientGamePacketListener nl) {
        nl.handleTagQueryPacket(this);
    }
    
    public int getTransactionId() {
        return this.transactionId;
    }
    
    @Nullable
    public CompoundTag getTag() {
        return this.tag;
    }
    
    @Override
    public boolean isSkippable() {
        return true;
    }
}
