diff --git a/src/main/java/io/minimum/minecraft/velocity/protocol/StateRegistry.java b/src/main/java/io/minimum/minecraft/velocity/protocol/StateRegistry.java
index e7c3f4352..b1075d9d6 100644
--- a/src/main/java/io/minimum/minecraft/velocity/protocol/StateRegistry.java
+++ b/src/main/java/io/minimum/minecraft/velocity/protocol/StateRegistry.java
@@ -33,6 +33,7 @@ public enum StateRegistry {
TO_CLIENT.register(0x00, Disconnect.class, Disconnect::new);
// Encryption Success will follow once Mojang auth/encryption is done
TO_CLIENT.register(0x02, ServerLoginSuccess.class, ServerLoginSuccess::new);
+ TO_CLIENT.register(0x03, SetCompression.class, SetCompression::new);
}
};
@@ -50,7 +51,7 @@ public enum StateRegistry {
this.state = state;
}
- public void register(int id, Class extends MinecraftPacket> clazz, Supplier extends MinecraftPacket> packetSupplier) {
+ public
void register(int id, Class
clazz, Supplier
packetSupplier) {
idsToSuppliers.put(id, packetSupplier);
packetClassesToIds.put(clazz, id);
}
diff --git a/src/main/java/io/minimum/minecraft/velocity/protocol/netty/MinecraftCompressDecoder.java b/src/main/java/io/minimum/minecraft/velocity/protocol/netty/MinecraftCompressDecoder.java
new file mode 100644
index 000000000..08042f378
--- /dev/null
+++ b/src/main/java/io/minimum/minecraft/velocity/protocol/netty/MinecraftCompressDecoder.java
@@ -0,0 +1,51 @@
+package io.minimum.minecraft.velocity.protocol.netty;
+
+import com.google.common.base.Preconditions;
+import io.minimum.minecraft.velocity.protocol.ProtocolUtils;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.MessageToMessageDecoder;
+
+import java.util.List;
+import java.util.zip.Inflater;
+
+public class MinecraftCompressDecoder extends MessageToMessageDecoder {
+ private static final int MAXIMUM_INITIAL_BUFFER_SIZE = 65536; // 64KiB
+
+ private final int threshold;
+
+ public MinecraftCompressDecoder(int threshold) {
+ this.threshold = threshold;
+ }
+
+ @Override
+ protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List