0x46 S46PacketSetCompressionLevel
Changes the compression threshold mid-game. Same as S03 but for PLAY state.
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| threshold | VarInt | New compression threshold |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Threshold | VarInt | -1 = disable |
MCP References
NetHandlerPlayClient.handleSetCompressionLevel()Handler Interface
INetHandlerPlayClientVanilla Source
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
Deobfuscated MCP 1.8.9 source of S46PacketSetCompressionLevel, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S46PacketSetCompressionLevel.java) at build time and verified present.
Deep Dive
Role in the protocol
Mid-connection compression threshold change. The client handler reads the VarInt threshold and, only for real network connections (isLocalChannel() false), reconfigures the Netty pipeline: it updates the threshold on the existing decompress decoder or inserts one, and symmetrically for the compress encoder. In vanilla 1.8.9 compression is negotiated once during the login state, so this play-state packet is effectively a modded-server feature.
Vanilla handling
func_175100_a guards with 'if (!netManager.isLocalChannel())' and calls netManager.setCompressionTreshold(threshold). NetworkManager.setCompressionTreshold mutates the pipeline handlers in place: NettyCompressionDecoder for incoming data and NettyCompressionEncoder for outgoing, inserting the handlers when absent and removing them when the threshold is negative. From that point every packet larger than the threshold is zlib-compressed on the wire.
Why clients touch it
No module in the 8 clients references S46 beyond the vanilla handler, the packet registry, and Rise's NetworkAPI script-bridge class list. A disabler has no use for it: compression changes do not alter packet semantics, timings, or the ability to spoof data, and the threshold is a server policy the client cannot exploit. Anything that cares about compression (packet-size spoofing) operates on payload construction, not on this control packet.
Exploit surface
The packet arrives mid-stream and the client applies it immediately, so a hostile server could toggle the threshold repeatedly; each change reconfigures the pipeline, but the cost is negligible and the result is simply a different compression ratio. A negative threshold disables compression. There is no length validation: an enormous threshold effectively disables compression for the session, which is only a bandwidth concern. The change applies to the next packet in flight, not retroactively.
Server-Side Handling
The server-side counterpart is NetworkManager.setCompressionTreshold, which the client handler invokes after receiving S46. Vanilla 1.8.9 negotiates compression once during login (the login-state S03PacketEnableCompression) and never sends S46; the packet exists for modded and plugin servers that change the threshold after the play state begins. The threshold applies to both directions from the moment the pipeline is reconfigured.
Protocol Analysis
Single VarInt threshold; any negative value disables compression. The client skips the whole operation for local channels (singleplayer and LAN), so the handler is a one-line guard around a pipeline mutation. Because the packet is processed inline in the receiving thread, the new threshold takes effect for the very next packet the encoder writes, with no handshake or acknowledgement.
Anti-Cheat Landscape
Invisible to anti-cheats. Compression level is transport policy, not gameplay data; no movement, combat or timing check reads it. The only observable effect of a changed threshold is packet sizes on the wire, which server-side proxies handle transparently.
implementation Implementation Cases
Play-state compression threshold control, handled entirely inside the Netty pipeline: the vanilla handler reconfigures the decompress and compress handlers only for non-local channels. None of the 8 clients has a module for it; it is invisible to gameplay and to anti-cheat logic.
anticheat Anti-Cheat Checks
Compression level is transport policy, not gameplay data, and the corpus reflects that: the only hit is Artemis's packet generator HardcodeMap, which maps the name PacketPlayOutSetCompression to the PacketPlayServerCompression interface for the protocol generator. That is build infrastructure, not a check. No anticheat reads the threshold; changing it only changes wire sizes, which proxies handle transparently, so there is no flag surface.
Related Packets
Wiki Cross-Reference
Single VarInt threshold applied mid-game to the Netty pipeline; a negative value disables compression. Takes effect on the very next packet.
Vanilla 1.8.9 negotiates compression once at login via S03; S46 exists for modded servers that change the threshold during play.
MCP 1.8.9 S46PacketSetCompressionLevel implements Packet
Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.