package net.minecraft.network.protocol.login;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.Packet;

public class ClientboundLoginCompressionPacket implements Packet<ClientLoginPacketListener> {
    private int compressionThreshold;
    
    public ClientboundLoginCompressionPacket() {
    }
    
    public ClientboundLoginCompressionPacket(final int integer) {
        this.compressionThreshold = integer;
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.compressionThreshold = kv.readVarInt();
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeVarInt(this.compressionThreshold);
    }
    
    @Override
    public void handle(final ClientLoginPacketListener rh) {
        rh.handleCompression(this);
    }
    
    public int getCompressionThreshold() {
        return this.compressionThreshold;
    }
}
