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 mg) throws IOException {
        this.compressionThreshold = mg.readVarInt();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeVarInt(this.compressionThreshold);
    }
    
    @Override
    public void handle(final ClientLoginPacketListener sw) {
        sw.handleCompression(this);
    }
    
    public int getCompressionThreshold() {
        return this.compressionThreshold;
    }
}
