From c041bea1b6ff82469313094c312f84a9c39e5ffa Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 3 May 2021 20:17:51 -0400 Subject: [PATCH] Avoid calling writeVarInt in the (very) common uncompressed packet case --- .../proxy/protocol/netty/MinecraftCompressEncoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressEncoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressEncoder.java index f6cb495ca..356c27231 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressEncoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressEncoder.java @@ -39,7 +39,7 @@ public class MinecraftCompressEncoder extends MessageToByteEncoder { int uncompressed = msg.readableBytes(); if (uncompressed < threshold) { // Under the threshold, there is nothing to do. - ProtocolUtils.writeVarInt(out, 0); + out.writeByte(0); out.writeBytes(msg); } else { ProtocolUtils.writeVarInt(out, uncompressed);