Fix packet compression

This commit is contained in:
Pokechu22 2017-09-08 17:36:22 -07:00 committed by ORelio
parent 7ba0c3c8fc
commit c85352f819
2 changed files with 10 additions and 13 deletions

View file

@ -1421,12 +1421,10 @@ namespace MinecraftClient.Protocol.Handlers
if (compression_treshold > 0) //Compression enabled?
{
if (the_packet.Length > compression_treshold) //Packet long enough for compressing?
if (the_packet.Length >= compression_treshold) //Packet long enough for compressing?
{
byte[] uncompressed_length = getVarInt(the_packet.Length);
byte[] compressed_packet = ZlibUtils.Compress(the_packet);
byte[] compressed_packet_length = getVarInt(compressed_packet.Length);
the_packet = concatBytes(compressed_packet_length, compressed_packet);
the_packet = concatBytes(getVarInt(the_packet.Length), compressed_packet);
}
else
{